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.
import json
with open('H:\pycodesfile\zz.geojson','r') as f:
d = json.load(f)
for part in d['features']:
#fName = part["properties"]
output = {"type":'FeatureCollection',
"features": [{
"type": 'Feature',
"properties": part['properties'],
"geometry": {
"type": 'Point',
"coordinates": part['geometry']['coordinates']
}
}]
}
with open('H:\pycodesfile\zz.json','w') as f_out:
json.dump(output, f_out, ensure_ascii=False, indent=4)
print(json.dumps(output))[code][/code]
geojson to json --missing multiple row output
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 1 guest