src.geoserver.database_layers
Functions to handle serving database layers and views via geoserver.
Attributes
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. |
Module Contents
- src.geoserver.database_layers.log
- src.geoserver.database_layers._xml_header
- src.geoserver.database_layers.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.database_layers.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.