Skipping the string serialization in json.loads(OGRGeometry::ExportToJson())

المشرف العام

Administrator
طاقم الإدارة
I have a for loop that exports a bunch of OGRGeometry objects to a python array in what will eventually become a GeoJSON feature collection. Something like this:

features = []for feature in featureList: geom = feature.geometry() if some_condition: features.append({ 'type': 'Feature', 'geometry': json.loads(geom.ExportToJson()), })It's a lot of extra work to serialize and deserialize the geomatry to a string and then deserialize it. How do I just end up with a plain old dictionary in in the geojson format?



أكثر...
 
أعلى