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):
651
651
def cast_datatypes_for_geojson (filename ):
652
652
'''
653
653
Go through geojson file and try to cast all values as float, except project_id
654
+ remove redundant geometry property
654
655
'''
655
656
filename = filename .replace ('csv' , 'geojson' )
656
657
with open (filename ) as f :
657
658
geojson_data = json .load (f )
658
659
660
+ properties = list (geojson_data ['features' ][0 ]['properties' ].keys ())
661
+
659
662
for i in range (0 , len (geojson_data ['features' ])):
660
- for property in geojson_data [ 'features' ][ i ][ ' properties' ]. keys () :
663
+ for property in properties :
661
664
if property in ['project_id' , 'name' , 'project_details' ]:
662
665
# don't try to cast project_id
663
666
pass
667
+ elif property in ['geom' ]:
668
+ # remove redundant geometry property
669
+ del geojson_data ['features' ][i ]['properties' ][property ]
664
670
else :
665
671
try :
666
672
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