gdf.vct.crop() or Vector.crop()

gdf.vct.crop() or Vector.crop()#

VectorBase.crop(bbox=None, mode='intersects', *, inplace=False, crop_geom=None, **kwargs)[source]#

Crop vector to a bounding box, without modifying geometric features.

Overloads:

Equivalent to selecting geometries intersecting or contained within a bounding box. To cut each feature with another geometry or bounding box, use clip().

Match-reference: a reference raster or vector can be passed to match bounds during cropping.

Parameters:
  • bbox (geoutils.raster.base.RasterBase | DataArray | VectorBase | GeoDataFrame | tuple[float, float, float, float]) – Bounding box or georeferenced reference object defining the selected extent.

  • mode (Literal['intersects', 'within']) – "intersects" keeps every geometry touching the extent. "within" keeps only geometries entirely inside it.

  • inplace (bool) – Whether to replace this vector’s selected rows. Dask-backed vectors cannot be changed in place.

  • crop_geom (Any) – Deprecated alias of bbox.

  • kwargs (Any) – Deprecated clip argument. Use clip() for exact clipping.

Returns:

A vector or dataframe containing unchanged selected geometries, or None when inplace=True.