File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
mapswipe_workers/mapswipe_workers Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -651,16 +651,22 @@ def csv_to_geojson_centroids(filename):
651651def cast_datatypes_for_geojson (filename ):
652652 '''
653653 Go through geojson file and try to cast all values as float, except project_id
654+ remove redundant geometry property
654655 '''
655656 filename = filename .replace ('csv' , 'geojson' )
656657 with open (filename ) as f :
657658 geojson_data = json .load (f )
658659
660+ properties = list (geojson_data ['features' ][0 ]['properties' ].keys ())
661+
659662 for i in range (0 , len (geojson_data ['features' ])):
660- for property in geojson_data [ 'features' ][ i ][ ' properties' ]. keys () :
663+ for property in properties :
661664 if property in ['project_id' , 'name' , 'project_details' ]:
662665 # don't try to cast project_id
663666 pass
667+ elif property in ['geom' ]:
668+ # remove redundant geometry property
669+ del geojson_data ['features' ][i ]['properties' ][property ]
664670 else :
665671 try :
666672 geojson_data ['features' ][i ]['properties' ][property ] = float (geojson_data ['features' ][i ]['properties' ][property ])
You can’t perform that action at this time.
0 commit comments