Convert geopandas shapely polygon to geojson

前端 未结 6 1940
猫巷女王i
猫巷女王i 2021-02-18 19:24

I created a circle using geopandas and it returned a shapely polygon:

POLYGON: ((...))

I want this same polygon as a geojson object. I ran acr

6条回答
  •  故里飘歌
    2021-02-18 19:41

    Shapely returns a python dict where all the coordinates are in tuples. You need to convert to JSON in order for mapbox, etc... to properly accept it.

    json.dumps(shapely.geometry.mapping(shapelyObject))
    

提交回复
热议问题