[GIS] How to convert GeoSeries polygons to lists of coordinates

geodataframegeopandasgeoseries

I have a GeoDataFrame consisting polygons. How can I convert each polygon into a list of coordinates? Is there any attribute, method or function in GeoPandas to do this?

enter image description here

Best Answer

A very effective, very fast solution would be to build a function and then use apply instead of a list comprehension

def coord_lister(geom):
    coords = list(geom.exterior.coords)
    return (coords)

coordinates = shp.geometry.apply(coord_lister)