Skip to content

read_geopackage

read_geopackage(
    path: str | PathLike[str],
    *,
    layer: str | None = None,
    nodata: Sequence[float | str] | None = None,
) -> boitata.PointSet | boitata.Polylines

Reads a GeoPackage feature layer as a PointSet or Polylines.

Parameters:

Name Type Description Default
path str or Path

The .gpkg file.

required
layer str

Feature table to read; required when the file has more than one.

None
nodata sequence of float or str

Values read as null, as in read_csv: numbers match numerically, strings match text case-insensitively. Default -99, -999, 1e21 and text such as NA, N/A or NULL. SQL NULLs are always null.

None

Returns:

Type Description
PointSet or Polylines

Point and multipoint layers give one point per member, a multipoint repeating its row; rows without a geometry or with an empty one are dropped. Line and polygon layers give Polylines, lines as open parts and polygon rings as closed parts without the repeated closing vertex; a row without a geometry is a feature without parts. 2D geometries get z = 0, M values are dropped. Integer, real and boolean columns are float64, blobs are skipped, the rest are text. The CRS is "EPSG:<code>" when the layer's spatial reference is an EPSG one, otherwise its WKT definition.

Raises:

Type Description
FileError

When the file does not exist.

InvalidInput

When the file is not a GeoPackage, layer is missing or ambiguous, or the layer mixes points with lines or holds geometry collections.

used in