How would I write a proper geoJson
, readable by a GIS, from the results of the rasterstats package?
stats = zonal_stats("somePolygons.shp",
"someTif.tif",
geojson_out=True)
Something like
import geojson
with open("newfile.geojson", "w") as myFile:
myfile.write(geojson.dump(stats))
does not work.
The object I am getting from rasterstats
is a geoJson
. There are 200 Polygons in my geoJson
object.
Do I really have to write my geoJson
"manually" like suggested in an answere here, or is there a way to do that automatically?