geofileops.has_spatial_index#

geofileops.has_spatial_index(path: str | PathLike[Any], layer: str | LayerInfo | None = None, no_geom_ok: bool = False, datasource: Dataset | None = None) bool#

Check if the layer/column has a spatial index.

Parameters:
  • path (PathLike) – The path to the datasource.

  • layer (str, optional) – The layer. Defaults to None.

  • no_geom_ok (bool, options) – If True and the file doesn’t have a geometry column, don’t throw an error. Defaults to False.

  • datasource (gdal.Dataset, optional) – the already opened gdal dataset found on path. This can be used to avoid opening and closing the file many times. If specified, the datasource will not be closed! Defaults to None.

Raises:

ValueError – an invalid parameter value was passed.

Returns:

True if a spatial index exists, False if it doesn’t exist.

Return type:

bool