src.geoserver
Functions and utilities for loading and serving data with geoserver. Imports here are accessible directly by from src import geoserver.
Submodules
Functions
|
Create a GeoServer layer for a given data store if it does not currently exist. |
|
Create PostGIS database store in a GeoServer workspace for a given database. |
|
Create a GeoServer workspace if it does not currently exist. |
|
Upload a NetCDF file to GeoServer, ready for serving to clients. |
|
Upload a GeoTiff file to GeoServer, ready for serving to clients. |
Create a GeoServer style for rasters using the viridis color scale. |
Package Contents
- src.geoserver.create_datastore_layer(workspace_name: str, data_store_name: str, layer_name: str, metadata_elem: str = '') None
Create a GeoServer layer for a given data store if it does not currently exist. Can be used to create layers for a database table, or to create a database view for a custom dynamic query.
- Parameters:
workspace_name (str) – The name of the workspace the data store is associated to
data_store_name (str) – The name of the data store the layer is being created from.
layer_name (str) – The name of the new layer. This is the same as the name of the database table if creating a layer from a table.
metadata_elem (str = "") – An optional XML str that contains the metadata element used to configure custom SQL queries.
- Raises:
HTTPError – If geoserver responds with an error, raises it as an exception since it is unexpected.
- src.geoserver.create_db_store_if_not_exists(db_name: str, workspace_name: str, new_data_store_name: str) None
Create PostGIS database store in a GeoServer workspace for a given database. If it already exists, do not do anything.
- Parameters:
db_name (str) – The name of the connected database, to connect datastore to
workspace_name (str) – The name of the workspace to create views for
new_data_store_name (str) – The name of the new datastore to create
- Raises:
HTTPError – If geoserver responds with an error, raises it as an exception since it is unexpected.
- src.geoserver.create_workspace_if_not_exists(workspace_name: str) None
Create a GeoServer workspace if it does not currently exist.
- Parameters:
workspace_name (str) – The name of the workspace to create if it does not exists.
- Raises:
HTTPError – If geoserver responds with an error, raises it as an exception since it is unexpected.
- src.geoserver.add_nc_to_geoserver(nc_filepath: pathlib.Path, band_name: str, workspace_name: str, model_id: int) None
Upload a NetCDF file to GeoServer, ready for serving to clients.
- Parameters:
nc_filepath (pathlib.Path) – The filepath to the NetCDF file to be served.
band_name (str) – The name of the NetCDF band/layer getting served
workspace_name (str) – The name of the existing GeoServer workspace that the store is to be added to.
model_id (int) – The id of the model being added, to facilitate layer naming.
- src.geoserver.add_gtiff_to_geoserver(gtiff_filepath: pathlib.Path, workspace_name: str, model_id: int) None
Upload a GeoTiff file to GeoServer, ready for serving to clients.
- Parameters:
gtiff_filepath (pathlib.Path) – The filepath to the GeoTiff file to be served.
workspace_name (str) – The name of the existing GeoServer workspace that the store is to be added to.
model_id (int) – The id of the model being added, to facilitate layer naming.
- src.geoserver.create_viridis_style_if_not_exists() None
Create a GeoServer style for rasters using the viridis color scale.