pip install geojson
python
import json
from geojson import Point, Feature, FeatureCollection, dump
python
point = Point((116.397, 39.907))
python
feature = Feature(geometry=point, properties={"name": "Beijing"})
python
feature_collection = FeatureCollection([feature])
python
with open('data.geojson', 'w') as f:
dump(feature_collection, f)
python
with open('data.geojson', 'r') as f:
data = json.load(f)
feature_collection = FeatureCollection(data['features'])