I have a line shapefile named "river" which has 385 features. I would like to calculate the length of each feature using Python. I am currently using GDAL, Shapely, and Fiona libraries.
Appreciate it's not one of the modules you've listed but using geopandas may be of some use here.
#using geopandas import geopandas as gp #read shapefile in gf = gp.read_file('path/to/shapefile') #set crs to a projected coordinate system #choose appropriately for your location gf = gf.to_crs(epsg=00000) #create column in dataframe with length of each feature gf['length'] = gf.geometry.length