geofileops.create_spatial_index#

geofileops.create_spatial_index(path: Union[str, PathLike[Any]], layer: Optional[str] = None, cache_size_mb: Optional[int] = 128, exist_ok: bool = False, force_rebuild: bool = False, no_geom_ok: bool = False)#

Create a spatial index on the layer specified.

Parameters:
  • path (PathLike) – The file path.

  • layer (str, optional) – The layer. If not specified, and there is only one layer in the file, this layer is used. Otherwise exception.

  • cache_size_mb (int, optional) – cache memory in MB that can be used while creating spatial index for spatialite files (.gpkg or .sqlite). If None, the default cache_size from sqlite is used. Defaults to 128.

  • exist_ok (bool, optional) – If True and the index exists already, don’t throw an error. Defaults to False.

  • force_rebuild (bool, options) – True to force rebuild even if index exists already. Defaults to False.

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