I have outmulti
being a list of 389 Polygon & Multipolygon objects in Python. I want to write outmulti
to an shp file and then be able to actually see all the Polygons and Multipolygons in the space.
I am stuck here.. How can I achieve that?
Thanks in advance
Convert your list to geopandas.GeoDataFrame
and save that. If you know the projection, you should pass it to GeoDataFrame as well.
import geopandas
gdf = geopandas.GeoDataFrame(geometry=outmulti)
# gdf = geopandas.GeoDataFrame(geometry=outmulti, crs="EPSG:4326") # if you have coordinates in degrees
gdf.to_file("my_file.shp")
To see your geometries in space, you can plot them with geopandas.
gdf.plot()
Check the documentation for details.