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))
Larz60+ write Mar-04-2022, 06:10 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please fix indentation as well. Thank you.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please fix indentation as well. Thank you.