geofileops.get_layerinfo#

geofileops.get_layerinfo(path: str | PathLike[Any], layer: str | None = None, raise_on_nogeom: bool = True, datasource: Dataset | None = None) LayerInfo#

Get information about a layer in a geofile.

Parameters:
  • path (PathLike) – path to the file to get info about. GDAL vsi paths are also supported.

  • layer (str, optional) – the layer you want info about. Doesn’t need to be specified if there is only one layer in the geofile.

  • raise_on_nogeom (bool, optional) – True to raise if the layer doesn’t have a geometry column. If False, the returned LayerInfo.geometrycolumn will be None. Defaults to True.

  • 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 if the layer definition has errors like invalid column names,...

Returns:

the information about the layer.

Return type:

LayerInfo