For example to calculate the area is like this:
How do we find the length of the perimiter?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Same way as area but:
Returns a Series containing the length of each geometry.
You can use GeoSeries.length for this. Note that geopandas uses Shapely that is crs agnostic. You will need to reproject your geodataframe to a crs in a unit that makes sense.
import geopandas as gpd gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) gdf.crs gdf["perimeter"] = gdf["geometry"].length gdf.head() # As you can see, the perimeter is calculated in the unit of the crs e.g. degrees length. not very meaningful. # lets reproject and try again ECKERT_IV_PROJ4_STRING = "+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs" gdf_eckert4 = gdf.to_crs(ECKERT_IV_PROJ4_STRING) gdf_eckert4["perimeter"] = gdf_eckert4["geometry"].length gdf_eckert4.head()
Note that the length of a polygon (perimeter) is arbitrary depending on the resolution of your polygon. It is also known as the coastline paradox