Can ArcPy's AsShape be used with GeoJSON FeatureCollection of Polygons with Labels?

المشرف العام

Administrator
طاقم الإدارة
The AsShape documentation provides examples that work very well.

However, I have been given what I believe to be valid GeoJSON that is a FeatureCollection of two polygons each with a Label.

It validates fine with the JSON Formatter & Validator but when I try AsShape on it, as per the code below, it throws an AssertionError on FeatureCollection.

I'm assuming that is because AsShape does not support FeatureCollections and so am wondering if there is another approach that I could use?

import arcpy polyX2_string = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[151.669111722222,-28.8913181547568],[151.669712422222,-28.890733765868],[151.670252222222,-28.8896441436458],[151.670847433333,-28.8891966436458],[151.670976977778,-28.8865389769791],[151.670112977778,-28.8846608880903]]]},"properties":{"Label":"National Park"}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[151.711278388889,-28.8201784658692],[151.710854355556,-28.8192543325359],[151.7100674,-28.8187800769803],[151.709037344444,-28.8184233992026],[151.707838755556,-28.8182234992026],[151.705821266667,-28.8180901992026],[151.705597933333,-28.8194629992025],[151.705198088889,-28.8212781880914]]]},"properties":{"Label":"National Park"}}]} polygon = arcpy.AsShape(polyX2_string)

أكثر...
 
أعلى