I have a shapefile of multiple watersheds, and I want to extract one of them to save as its own shapefile. I have no clue which package or command to use.

Can someone point me to a function within GeoPandas or another Python package?

import geopandas

shed = geopandas.read_file('CA_HUC12.shp')
OBJECTID    TNMID   LoadDate    GNIS_ID AreaAcres   AreaSqKm    States         Geometry 
1       2012-10-15  0.0 21270.0 86.076712   CA  180300120503    Canoas Creek   POLYGON ((-120.1708092427523 36.07190695803973..
2       2012-10-15  0.0 32827.0 132.846273  CA  180600150201    Bear Creek     POLYGON ((-122.1102488777835 37.24771269698346...

1 Answer 1


This is based on the wonderful GeoPython tutorial here. You can use slicing to get your new watershed: new_shapefile.shp as shown below

out = "C:/your_data_folder/new_shapefile.shp"
selection = shed[161:162] # where you watershed of interest is in row 161

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.