Mar-04-2022, 05:39 PM
I have a geojson file zz.geojson and want to convert it to json and csv. I was trying the below for json conversion, it converts but I only get 1 row output. Can you please tell me what I am missing and also how do I convert to csv with multi output as well.
--it is not allowing me to attach the geojson file, so putting it as zz.txt
--it is not allowing me to attach the geojson file, so putting it as zz.txt
import json with open('H:\pytho\zz.geojson','r') as f: d = json.load(f) for part in d['features']: output = {"type":'FeatureCollection', "features": [{ "type": 'Feature', "properties": part['properties'], "geometry": { "type": 'Point', "coordinates": part['geometry']['coordinates'] } }] } with open('c:\pytho\zz.json','w') as f_out: json.dump(output, f_out, ensure_ascii=False, indent=4) print(json.dumps(output))