⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂

geoutils.Vector.crop

Contents

geoutils.Vector.crop#

Vector.crop(crop_geom, clip=False, *, inplace=False)[source]#

Crop the vector to given extent.

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

Optionally, clip geometries to that extent (by default keeps all intersecting).

Reprojection is done on the fly if georeferenced objects have different projections.

Parameters:
  • crop_geom (Raster | Vector | list[float] | tuple[float, ...]) – Geometry to crop vector to, as either a Raster object, a Vector object, or a list of coordinates. If crop_geom is a raster or a vector, will crop to the bounds. If crop_geom is a list of coordinates, the order is assumed to be [xmin, ymin, xmax, ymax].

  • clip (bool) – Whether to clip the geometry to the given extent (by default keeps all intersecting).

  • inplace (bool) – Whether to update the vector in-place.

Return type:

Optional[TypeVar(VectorType, bound= Vector)]

Returns:

Cropped vector (or None if inplace).