I have a script that obtains feature data from a JSON output of an ArcGIS REST MapServer. At present my script treats the JSON data as a "LineString" Geometry type, but, the JSON data is in fact a "MultiLineString" Geometry type. How do I force my script to treat the data as "MultiLineString"? My current script is:
import ogr
url = 'http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/16/query?geometry=16501408.594,-4372525.989,16523000,-4320000&geometryType=esriGeometryEnvelope&f=pjson&outFields=functionhierarchy,OBJECTID,shape,roadontype,roadnamestring,shape_Length'
ds = ogr.Open(url)
lyr = ds.GetLayer()
if (lyr.GetGeomType() == ogr.wkbLineString):
print ('line')
elif (lyr.GetGeomType() == ogr.wkbMultiLineString):
print ('multiline')
else:
print ('neithor line nor multiline')
del ds, lyr
The JSON data is a MultiLineString type as it consists of seperate lists of many cordinates within a large single list. For example, the JSON output below shows the end of one list of coordinates and the beginning of a subsequent list of coordinates and is a component of the first feature reported in the URL in the script above.
[
16504625.024250001,
-4372770.7781249993
],
[
16504645.846749999,
-4372777.386500001
],
[
16504664.026874997,
-4372785.385625001
]
],
[
[
16504684.332374997,
-4372794.3222500011
],
[
16504706.535875,
-4372804.0945000015
],
[
16504730.744125001,
-4372813.5017499998
],
Because the script treats the data as a "LineString" different sections of the the same paths are connected by relatively long straight lines. An example of the these erroneous relatively long straight lines are shown in the picture below which is a plot of the features in the layer as interpreted by the script.
] ], [ [
. Looks like a bug in GDAL.