geost.read_collection_geopackage#

geost.read_collection_geopackage(filepath: str | Path, collection_type: Collection, horizontal_reference: str | int | CRS = 28992, vertical_reference: str | int | CRS = 5709)[source]#

Read a GeoST stored Geopackage file of geost.base.Collection objects. The Geopackage contains the Collection’s “header” and “data” attributes as layers which are read into the specified Collection.

Parameters:
  • filepath (str | Path) – GeoST stored Geopackage file of a geost.base.Collection object.

  • collection_type (Collection) – Type of GeoST Collection object the data needs to be. Subclasses of Collection (e.g. geost.base.BoreholeCollection, geost.base.CptCollection) for the available types.

  • horizontal_reference (str | int | CRS, optional) – EPSG of the data’s horizontal reference. Takes anything that can be interpreted by pyproj.crs.CRS.from_user_input(). The default is 28992.

  • vertical_reference (str | int | CRS, optional) – EPSG of the data’s vertical datum. Takes anything that can be interpreted by pyproj.crs.CRS.from_user_input(). However, it must be a vertical datum. FYI: “NAP” is EPSG 5709 and The Belgian reference system (Ostend height) is ESPG 5710. The default is 5709.

Returns:

Subclass which is specified as collection_type.

Return type:

Subclass of geost.base.Collection

Raises:

ValueError – Raises ValueError if the collection_type is not supported.

Examples

Any GeoST Collection object can be stored as a geopackage file:

>>> original_collection = geost.data.boreholes_usp()
>>> original_collection
BoreholeCollection:
# header = 67
>>> original_collection.to_geopackage("./collection.gpkg")

Reading the stored collection using geost.read_collection_geopackage returns the stored collection:

>>> collection = geost.read_collection_geopackage(
...     "./collection.gpkg", collection_type=BoreholeCollection
...     )
>>> collection
BoreholeCollection:
# header = 67