pixcdust.readers.gpkg

Converted Pixcdust GeoPackage Reader.

Classes

GpkgReader

GeoPackage pixcdust database reader.

Module Contents

class pixcdust.readers.gpkg.GpkgReader(path: str | pathlib.Path, area_of_interest: geopandas.GeoDataFrame | None = None)[source]

Bases: pixcdust.readers.base_reader.BaseReader

GeoPackage pixcdust database reader.

Read a database from a GeoPackage file . You can then request a xr.Dataset, pd.DataFrame or gpd.GeoDataFrame view of the database.

Attributes:

path: Path to read. variables: Not supported. area_of_interest: Optionally only read points in area_of_interest. MULTI_FILE_SUPPORT: False, only support one file.

_gdf_data: geopandas.GeoDataFrame | None = None[source]
layers: list[str][source]
property data: xarray.Dataset[source]

Return an xarray.Dataset view from the database loaded.

Equivalent to to_xarray.

Returns:

Dataset read

to_geodataframe() geopandas.GeoDataFrame[source]

Convert the database read to a gpd.GeoDataFrame. Only points in self.area_of_interest are included.

Returns:

GeoDataFrame read.

read_single_layer(layer: str) geopandas.GeoDataFrame[source]

Read and return a single layer of geopackage database.

Don’t load the read data into the class (can’t be then converted by the reader). Use read for more advanced usage.

Args:

layer : name of the geodataframe layer to read. Must be in self.layers

Returns:

Geodataframe containing data read from layer

read(layers: List[str] | None = None) None[source]

Load all layers, or subset of layers, from geopackage database. You can then access from data or with methods like to_xarray, to_dataframe or to_geodataframe.

Args:

layers: Optional list of layers to load. Default to all.