python
import json
with open('data.geojson') as file:
data = json.load(file)
print(data)
python
import json
with open('data.geojson') as file:
data = json.load(file)
features = data['features']
for feature in features:
properties = feature['properties']
geometry = feature['geometry']
python
import json
data = [
{
'geometry': {
'type': 'Point',
'coordinates': [101.0, 0.0]
},
'properties': {
'name': 'Point 1'
}
},
{
'geometry': {
'type': 'Point',
'coordinates': [102.0, 1.0]
},
'properties': {
'name': 'Point 2'
}
}
]
with open('output.geojson', 'w') as file:
json.dump(data, file)