restgeojsonarcgisarcgis-server

Download GeoJSON-Map from ArcGis-Server


I'm trying to download a map of all roads in the German state of North Rhine Westphalia in the GeoJSON-format. I found an ArcGIS-hosted server using a REST-Api and tried to understand how it works but as I am completely new to using these services, I might have made a mistake somewhere. Maybe anyone can help me...

I just added f=geojson to the REST-URL but then nothing happens although the GeoJSON-format should be supported. Where did I make a mistake?

The address is: https://www.arcgishostedserver.nrw.de/arcgis/rest/services/Verkehrswege_NRW/MapServer/0/

So in my case I tried https://www.arcgishostedserver.nrw.de/arcgis/rest/services/Verkehrswege_NRW/MapServer/0/f=geojson.


Solution

  • The URL you mentioned is meant to provide general information about a single layer (id=0) in a Map Service.

    To get the actual data, you need to use the Query operation. You can see a link to the supported operations in the end of the HTML page of the layer (first URL in your question), and you can also add the f=geojson parameter to get it in GeoJson format. Note that you must provide at least where parameter to specify the quety.

    For example, this will fetch all features where OBJECTID field is lower than 10, as GeoJson:

    https://www.arcgishostedserver.nrw.de/arcgis/rest/services/Verkehrswege_NRW/MapServer/0/query?where=OBJECTID+%3C+10&f=geojson

    If you set f=html (or just omit f), you'll get an HTML form for setting all optional parameters.