Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6773 closed defect (fixed)

ArcGIS JSON with multiples paths for feature is not parsed well to GeoJSON

Reported by: ethervoid Owned by: warmerdam
Priority: normal Milestone: 2.1.3
Component: default Version: 2.1.1
Severity: major Keywords: arcgis geojson multiline
Cc:

Description

I have a JSON from ArcGIS this way:

{"objectIdFieldName":"OBJECTID","globalIdFieldName":"GlobalID","geometryProperties":{"shapeLengthFieldName":"Shape__Length","units":"esriMeters"},"geometryType":"esriGeometryPolyline","spatialReference":{"wkid":102100,"latestWkid":3857},"fields":[{"name":"OBJECTID","type":"esriFieldTypeOID","alias":"OBJECTID","sqlType":"sqlTypeOther","domain":null,"defaultValue":null},{"name":"Id","type":"esriFieldTypeInteger","alias":"Id","sqlType":"sqlTypeOther","domain":null,"defaultValue":null},{"name":"NAME","type":"esriFieldTypeString","alias":"NAME","sqlType":"sqlTypeOther","length":50,"domain":null,"defaultValue":null}],"features":[{"attributes":{"OBJECTID":718,"Id":0,"NAME":"LEONA DR"},"geometry":{"paths":[[[-13599252.3267,4548298.0004],[-13599251.8815,4548305.3243],[-13599250.6569,4548318.0003],[-13599248.9872,4548326.7325],[-13599246.6495,4548336.5917],[-13599244.2004,4548346.8733],[-13599241.1948,4548356.8733],[-13599238.1893,4548366.0282],[-13599234.8496,4548374.0563],[-13599230.9535,4548384.0563],[-13599224.0517,4548399.9717]],[[-13599214.4229,4547925.0618],[-13599204.5652,4547939.147],[-13599192.2142,4547964.9104],[-13599188.7633,4547972.6565],[-13599185.3124,4547980.4028],[-13599183.5313,4547985.0505],[-13599180.637,4547992.6559],[-13599178.4106,4547999.2752],[-13599175.5163,4548011.5284],[-13599174.737,4548015.4719],[-13599173.5126,4548021.6688],[-13599172.2881,4548028.57],[-13599171.6201,4548033.0768],[-13599170.9522,4548039.133],[-13599170.6182,4548046.0342],[-13599170.8409,4548052.6536],[-13599171.0634,4548059.1323],[-13599171.2861,4548066.7377],[-13599171.7314,4548075.1881],[-13599172.3993,4548082.7935],[-13599173.7352,4548089.8357],[-13599175.071,4548094.9058],[-13599178.2992,4548107.4407],[-13599180.0804,4548113.2152],[-13599182.752,4548120.6798],[-13599185.9803,4548128.9895],[-13599188.0954,4548133.778],[-13599190.3217,4548138.144],[-13599193.3274,4548143.7777],[-13599209.1348,4548169.9743],[-13599229.5063,4548203.7765],[-13599233.8476,4548211.5227],[-13599238.6344,4548221.6635],[-13599241.0835,4548228.0014],[-13599243.0873,4548234.621],[-13599244.757,4548240.8182],[-13599246.5381,4548247.156],[-13599248.3192,4548254.7616],[-13599250.1004,4548263.2122],[-13599251.7701,4548277.2964],[-13599252.438,4548286.5922],[-13599252.4381,4548294.761]]]}}]}

It has two elements in the paths array for the feature. If we use the following command:

ogr2ogr -f GeoJSON test.json input_data.json OGRGeoJSON -nlt PROMOTE_TO_MULTI

we're going to have a GeoJSON but with the multiple paths squashed into one Multiline:

MULTILINESTRING((-122.164162176726 37.7793209627591,-122.164158177426 37.779372962943,-122.164147176657 37.7794629633113,-122.164132177487 37.7795249623969,-122.16411117757 37.7795949631801,-122.164089176931 37.7796679629525,-122.164062177167 37.7797389632845,-122.164035178301 37.7798039633185,-122.164005177265 37.7798609629955,-122.163970178003 37.7799319631421,-122.163908178079 37.7800449625747,-122.163821681097 37.7766730251935,-122.163733127871 37.7767730346131,-122.163622176951 37.7769559626334,-122.163591176988 37.7770109622242,-122.163560177026 37.7770659631942,-122.163544177133 37.7770989631885,-122.163518177194 37.7771529636638,-122.163498177102 37.7771999625201,-122.163472177163 37.777286963542,-122.163465176592 37.7773149634329,-122.163454177619 37.7773589630371,-122.163443177749 37.777407963324,-122.163437177003 37.7774399627404,-122.163431177155 37.7774829632656,-122.163428176782 37.7775319634703,-122.16343017733 37.7775789627957,-122.163432176081 37.7776249630884,-122.16343417663 37.7776789631795,-122.163438176828 37.7777389629188,-122.163444176675 37.7777929629266,-122.163456177269 37.7778429640557,-122.163468176965 37.7778789628313,-122.163497176379 37.7779679631804,-122.163513177171 37.7780089632733,-122.163537176562 37.778061963377,-122.163566176874 37.7781209638095,-122.163585177141 37.7781549630384,-122.163605176334 37.7781859624262,-122.163632176996 37.7782259626935,-122.163774177287 37.7784119629068,-122.163957177585 37.7786519634523,-122.163996176146 37.7787069624913,-122.164039176702 37.7787789634435,-122.164061177342 37.778823963293,-122.164079177783 37.778870963217,-122.164094176954 37.7789149640251,-122.164110176847 37.7789599630819,-122.164126176741 37.7790139636177,-122.164142177533 37.7790739636935,-122.164157176703 37.779173962765,-122.164163176551 37.7792399636969,-122.164163177449 37.779297962789))

instead of a MultiLineString with two elements like this one, which is the correct output:

MULTILINESTRING((-122.164162176726 37.7793209627591,-122.164158177426 37.779372962943,-122.164147176657 37.7794629633113,-122.164132177487 37.7795249623969,-122.16411117757 37.7795949631801,-122.164089176931 37.7796679629525,-122.164062177167 37.7797389632845,-122.164035178301 37.7798039633185,-122.164005177265 37.7798609629955,-122.163970178003 37.7799319631421,-122.163908178079 37.7800449625747),(-122.163821681097 37.7766730251935,-122.163733127871 37.7767730346131,-122.163622176951 37.7769559626334,-122.163591176988 37.7770109622242,-122.163560177026 37.7770659631942,-122.163544177133 37.7770989631885,-122.163518177194 37.7771529636638,-122.163498177102 37.7771999625201,-122.163472177163 37.777286963542,-122.163465176592 37.7773149634329,-122.163454177619 37.7773589630371,-122.163443177749 37.777407963324,-122.163437177003 37.7774399627404,-122.163431177155 37.7774829632656,-122.163428176782 37.7775319634703,-122.16343017733 37.7775789627957,-122.163432176081 37.7776249630884,-122.16343417663 37.7776789631795,-122.163438176828 37.7777389629188,-122.163444176675 37.7777929629266,-122.163456177269 37.7778429640557,-122.163468176965 37.7778789628313,-122.163497176379 37.7779679631804,-122.163513177171 37.7780089632733,-122.163537176562 37.778061963377,-122.163566176874 37.7781209638095,-122.163585177141 37.7781549630384,-122.163605176334 37.7781859624262,-122.163632176996 37.7782259626935,-122.163774177287 37.7784119629068,-122.163957177585 37.7786519634523,-122.163996176146 37.7787069624913,-122.164039176702 37.7787789634435,-122.164061177342 37.778823963293,-122.164079177783 37.778870963217,-122.164094176954 37.7789149640251,-122.164110176847 37.7789599630819,-122.164126176741 37.7790139636177,-122.164142177533 37.7790739636935,-122.164157176703 37.779173962765,-122.164163176551 37.7792399636969,-122.164163177449 37.779297962789))

Change History (4)

comment:1 by Jukka Rahkonen, 7 years ago

There was a fix for multilinestrings in https://trac.osgeo.org/gdal/changeset/34773.

I made a test with 2.2.0-dev and the issue seems to be fixed. My result is

MULTILINESTRING (( -13599252.3267 4548298.0004, -13599251.8815 4548305.3243, -13599250.6569 4548318.0003, -13599248.9872 4548326.7325, -13599246.6495 4548336.5917, -13599244.2004 4548346.8733, -13599241.1948 4548356.8733, -13599238.1893 4548366.0282, -13599234.8496 4548374.0563, -13599230.9535 4548384.0563, -13599224.0517 4548399.9717 ), ( -13599214.4229 4547925.0618, -13599204.5652 4547939.147, -13599192.2142 4547964.9104, -13599188.7633 4547972.6565, -13599185.3124 4547980.4028, -13599183.5313 4547985.0505, -13599180.637 4547992.6559, -13599178.4106 4547999.2752, -13599175.5163 4548011.5284, -13599174.737 4548015.4719, -13599173.5126 4548021.6688, -13599172.2881 4548028.57, -13599171.6201 4548033.0768, -13599170.9522 4548039.133, -13599170.6182 4548046.0342, -13599170.8409 4548052.6536, -13599171.0634 4548059.1323, -13599171.2861 4548066.7377, -13599171.7314 4548075.1881, -13599172.3993 4548082.7935, -13599173.7352 4548089.8357, -13599175.071 4548094.9058, -13599178.2992 4548107.4407, -13599180.0804 4548113.2152, -13599182.752 4548120.6798, -13599185.9803 4548128.9895, -13599188.0954 4548133.778, -13599190.3217 4548138.144, -13599193.3274 4548143.7777, -13599209.1348 4548169.9743, -13599229.5063 4548203.7765, -13599233.8476 4548211.5227, -13599238.6344 4548221.6635, -13599241.0835 4548228.0014, -13599243.0873 4548234.621, -13599244.757 4548240.8182, -13599246.5381 4548247.156, -13599248.3192 4548254.7616, -13599250.1004 4548263.2122, -13599251.7701 4548277.2964, -13599252.438 4548286.5922, -13599252.4381 4548294.761 ))

Coordinates differ because of "ERROR 6: EPSG PCS/GCS code 102100 not found in EPSG support files. Is this a valid EPSG coordinate system?" but that is a different thing.

Last edited 7 years ago by Jukka Rahkonen (previous) (diff)

comment:2 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 37099:

GeoJSON: support multilinestring from esriGeometryPolyline (fixes #6773)

comment:3 by Even Rouault, 7 years ago

Milestone: 2.1.3

I've just backported r34773 to 2.1 in r37099

comment:4 by ethervoid, 7 years ago

I've tested with the 2.1 branch and works.

Thank you very much for your quick response :)

Note: See TracTickets for help on using tickets.