[GIS] Using ogr2ogr to download GeoJSON files from ArcGIS MapServer

arcgis-rest-apiarcgis-servergeojsonogr

I am trying to download as a GeoJSON file a line feature from a ArcGIS MapServer REST Service run by the National Park Service (link is here) so that I can open the data in QGIS. Using the guide found here, I typed the following command into ogr2ogr:

 ogr2ogr -f GeoJSON Route66.json "http://imgis.nps.gov/arcgis/rest/services/NHT/NHT/MapServer/9/query?where=objectid+%3D+objectid&outfields=*&f=json" OGRGeoJSON -gt 1000

The command downloaded and created the file just fine (though it did complain about not knowing which CRS to project it to), but when I went to open the file in QGIS it displayed with a number of weird artifacts along the feature.

A picture of what I am seeing can be seen:

enter image description here

Does anyone have any idea how I might go about fixing this situation, if there is any fix to it? As a side note, I have opened the REST Service data straight from their server on ArcGIS Explorer Desktop, and don't see a problem there.

I'm running QGIS 2.2 from OpenGeo4W on Windows 7 Professional 64-bit. Thanks for the help in advance!

Best Answer

It looks like ogr2ogr may not be respecting the order of the vertices in the dataset, which is causing the artefacts, as the line is incorrectly jumping between vertices which aren't supposed to be joined.

I just tried downloading the JSON directly by querying the REST endpoint and converted to shapefile using the ArcGIS JSON to Features tool, and the problem doesn't seem to occur.