src.eddie.geoserver.terria_catalogs

Functions for handling creating TerriaJS catalog items by reading the geoserver workspaces.

Attributes

CatalogItem

CatalogGroup

Catalog

Classes

Workspaces

Enum to label and access geoserver workspaces initialized within data_to_db.py.

Functions

create_vector_layer_catalog_item(→ CatalogItem)

Create a JSON TerriaJS catalog item for a single GeoServer vector WFS layer.

create_raster_layer_catalog_item(→ CatalogItem)

Create a JSON TerriaJS catalog item for a single GeoServer raster WMS layer.

get_layers_as_terria_group(→ CatalogGroup)

Query geoserver for available layers within a workspace, and return a terria catalog to serve the data.

get_terria_catalog(→ Catalog)

Query geoserver for available layers from key workspaces, and return a terria catalog to serve the data.

Module Contents

type src.eddie.geoserver.terria_catalogs.CatalogItem = dict[str, str | int]
type src.eddie.geoserver.terria_catalogs.CatalogGroup = dict[str, str | bool | list[CatalogItem]]
type src.eddie.geoserver.terria_catalogs.Catalog = dict[Literal['catalog'], list[CatalogGroup]]
class src.eddie.geoserver.terria_catalogs.Workspaces

Bases: enum.StrEnum

Enum to label and access geoserver workspaces initialized within data_to_db.py.

STATIC_FILES_WORKSPACE

Workspace containing layers loaded from static files.

Type:

str

INPUT_LAYERS_WORKSPACE

Workspace containing layers loaded from external sources used as input for later modelling or visualisation.

Type:

str

STATIC_FILES_WORKSPACE = 'static_files'
INPUT_LAYERS_WORKSPACE = 'input_layers'
EXTRUDED_LAYERS_WORKSPACE = 'extruded_layers'
src.eddie.geoserver.terria_catalogs.create_vector_layer_catalog_item(workspace_name: str, workspace_url: str, layer_name: str, max_features: int = 60000) CatalogItem

Create a JSON TerriaJS catalog item for a single GeoServer vector WFS layer.

Parameters:
  • workspace_name (str)

  • workspace_url (str) – The URL to the GeoServer workspace.

  • layer_name (str) – The name of the layer in Geoserver.

  • max_features (int = 60000) – The maximum number of features to fetch from Geoserver.

Returns:

JSON TerriaJS catalog item for a single GeoServer raster WMS layer.

Return type:

CatalogItem

src.eddie.geoserver.terria_catalogs.create_raster_layer_catalog_item(workspace_url: str, layer_name: str) CatalogItem

Create a JSON TerriaJS catalog item for a single GeoServer raster WMS layer.

Parameters:
  • workspace_url (str) – The URL to the GeoServer workspace.

  • layer_name (str) – The name of the layer in Geoserver.

Returns:

JSON TerriaJS catalog item for a single GeoServer raster WMS layer.

Return type:

CatalogItem

src.eddie.geoserver.terria_catalogs.get_layers_as_terria_group(workspace_name: str) CatalogGroup

Query geoserver for available layers within a workspace, and return a terria catalog to serve the data. The style definition may be empty.

Parameters:

workspace_name (str) – The name of the geoserver workspace to query for.

Returns:

Represents the Terria JSON catalog group items for each layer within the workspace.

Return type:

CatalogGroup

Raises:

HTTPError – If geoserver responds with anything but OK or NOT_FOUND, raises it as an exception since it is unexpected.

src.eddie.geoserver.terria_catalogs.get_terria_catalog() Catalog

Query geoserver for available layers from key workspaces, and return a terria catalog to serve the data.

Returns:

Represents the Terria JSON catalog items for each layer within the workspaces.

Return type:

Catalog

Raises:

HTTPError – If geoserver responds with anything but OK or NOT_FOUND, raises it as an exception since it is unexpected.