pygeoops.make_valid#

pygeoops.make_valid(geometry, keep_collapsed: bool = True, only_if_invalid: bool = False)#

Make the input geometry valid.

If the input geometry is already valid, it will be returned. If the geometry must be split into multiple parts of the same type to be made valid, a multi-part geometry will be returned. If the geometry must be split into multiple parts of different types to be made valid, a GeometryCollection will be returned if keep_collapsed=True.

Parameters:
  • geometry (geometry, GeoSeries or arraylike) – geometry or arraylike.

  • keep_collapsed (bool, optional) – When False, geometry components that collapse to a lower dimensionality, for example a one-point linestring, are dropped. Defaults to True.

  • only_if_invalid (bool, optional) – When True, is_valid is ran before applying make_valid only for the geometries that need it. If many input geometries are valid this is faster.

Returns:

the valid version for each of the input

geometries.

Return type:

geometry, GeoSeries or array_like