geoservercloud.py
- class geoservercloud.GeoServerCloud(url: str = 'http://localhost:9090/geoserver/cloud', user: str = 'admin', password: str = 'geoserver', verifytls: bool = True)
Bases:
object
Facade class allowing CRUD operations on GeoServer resources
- url
base GeoServer URL
- Type:
str
- user
GeoServer username
- Type:
str
- password
GeoServer password
- Type:
str
- assign_role_to_user(user: str, role: str) tuple[str, int]
Assign a role to a GeoServer user
- create_acl_admin_rule(priority: int = 0, access: str = 'ADMIN', role: str | None = None, user: str | None = None, workspace_name: str | None = None) tuple[dict | str, int]
Create a GeoServer ACL admin rule
- create_acl_rule(priority: int = 0, access: str = 'DENY', role: str | None = None, user: str | None = None, service: str | None = None, request: str | None = None, workspace_name: str | None = None) tuple[dict | str, int]
Create a GeoServer ACL data rule
- create_acl_rules_for_requests(requests: list[str], priority: int = 0, access: str = 'DENY', role: str | None = None, service: str | None = None, workspace_name: str | None = None) list[tuple[dict | str, int]]
Create ACL rules for multiple type of OGC requests
- create_feature_type(layer_name: str, workspace_name: str | None = None, datastore_name: str | None = None, title: str | dict = 'Default title', abstract: str | dict = 'Default abstract', attributes: dict = {'geom': {'required': True, 'type': 'Point'}}, epsg: int = 4326, keywords: list[str] = []) tuple[str, int]
Create a feature type or update it if it already exist.
- create_gridset(epsg: int) tuple[str, int]
Create a gridset for GeoWebCache for a given projection Supported EPSG codes are 2056, 21781 and 3857
- create_jndi_datastore(workspace_name: str, datastore_name: str, jndi_reference: str, pg_schema: str = 'public', description: str | None = None, set_default_datastore: bool = False) tuple[str, int]
Create a PostGIS datastore from JNDI resource, or update it if it already exist.
- create_layer_group(group: str, workspace_name: str | None, layers: list[str], title: str | dict, abstract: str | dict, epsg: int = 4326, mode: str = 'SINGLE', enabled: bool = True, advertised: bool = True) tuple[str, int]
Create a layer group or update it if it already exists.
- create_pg_datastore(workspace_name: str, datastore_name: str, pg_host: str, pg_port: int, pg_db: str, pg_user: str, pg_password: str, pg_schema: str = 'public', description: str | None = None, set_default_datastore: bool = False) tuple[str, int]
Create a PostGIS datastore from the DB connection parameters, or update it if it already exist.
- create_role(role_name: str) tuple[str, int]
Create a GeoServer role if it does not already exist
- create_style_definition(style_name: str, filename: str, workspace_name: str | None = None) tuple[str, int]
Create a style definition
- create_style_from_file(style_name: str, file: str, workspace_name: str | None = None) tuple[str, int]
Create a style (SLD) from a file, or update it if it already exists. Supported file extensions are .sld and .zip.
- create_style_from_string(style_name: str, style_string: str, workspace_name: str | None = None) tuple[str, int]
Create a style (SLD) from its definition as a string or update it if it already exists.
- create_user(user: str, password: str, enabled: bool = True) tuple[str, int]
Create a GeoServer user
- create_wms() None
- create_wms_layer(workspace_name: str, wms_store_name: str, native_layer_name: str, published_layer_name: str | None = None) tuple[str, int]
Publish a remote WMS layer If it already exists, delete and recreate it (update is not supported by GeoServer)
- create_wms_store(workspace_name: str, wms_store_name: str, capabilities_url: str) tuple[str, int]
Create a cascaded WMS store, or update it if it already exist.
- create_wmts() None
- create_wmts_layer(workspace_name: str, wmts_store: str, native_layer: str, published_layer: str | None = None, epsg: int = 4326, international_title: dict[str, str] | None = None, international_abstract: dict[str, str] | None = None) tuple[str, int]
Publish a remote WMTS layer (first delete it if it already exists)
- create_wmts_store(workspace_name: str, name: str, capabilities: str) tuple[str, int]
Create a cascaded WMTS store, or update it if it already exist.
- create_workspace(workspace_name: str, isolated: bool = False, set_default_workspace: bool = False) tuple[str, int]
Create a workspace in GeoServer, if it does not already exist. It if exists, update it
- delete_acl_admin_rule(id: int | str) tuple[str, int]
Delete a GeoServer ACL admin rule by id
- delete_all_acl_admin_rules() tuple[str, int]
Delete all existing GeoServer ACL admin rules
- delete_all_acl_rules() tuple[str, int]
Delete all existing GeoServer ACL data rules
- delete_feature_type(workspace_name: str, datastore_name: str, layer_name: str) tuple[str, int]
Delete a feature type and associated layer
- delete_gwc_layer(workspace_name: str, layer: str) tuple[str, int]
- delete_layer_group(workspace_name: str, layer_group_name: str) tuple[str, int]
Delete a layer group
- delete_role(role_name: str) tuple[str, int]
Delete a GeoServer role
- delete_user(user: str) tuple[str, int]
Delete a GeoServer user
- delete_wms_layer(workspace_name: str, wms_store_name: str, wms_layer_name: str) tuple[str, int]
Delete a WMS layer
- delete_wms_store(workspace_name: str, wms_store_name: str) tuple[str, int]
Delete a WMS store recursively
- delete_workspace(workspace_name: str) tuple[str, int]
Delete a GeoServer workspace (recursively)
- describe_feature_type(workspace_name: str | None = None, type_name: str | None = None, format: str = 'application/json') dict[str, Any] | str
WFS DescribeFeatureType request Return the feature type(s) as dict if found, otherwise return the response content as string
- get_acl_rules() tuple[dict[str, Any] | str, int]
Return all GeoServer ACL data rules
- get_datastores(workspace_name: str) tuple[list[str] | str, int]
Get all datastores for a given workspace
- get_feature(workspace_name: str, type_name: str, feature_id: int | None = None, max_feature: int | None = None, format: str = 'application/json') dict[str, Any] | str
WFS GetFeature request Return the feature(s) as dict if found, otherwise return the response content as string
- get_feature_info(layers: list[str], bbox: tuple[float, float, float, float], size: tuple[int, int], srs: str = 'EPSG:2056', info_format: str = 'application/json', transparent: bool = True, styles: list[str] | None = None, xy: list[float] = [0, 0]) ResponseWrapper | None
WMS GetFeatureInfo request
- get_feature_type(workspace_name: str, datastore_name: str, feature_type_name: str) tuple[dict[str, Any] | str, int]
Get a feature type by workspace, datastore and name
- get_feature_types(workspace_name: str, datastore_name: str) tuple[list[dict[str, Any]] | str, int]
Get all feature types for a given workspace and datastore
- get_gwc_layer(workspace_name: str, layer: str) tuple[dict[str, Any] | str, int]
- get_layer_group(workspace_name: str, layer_group_name: str) tuple[dict[str, Any] | str, int]
Get a layer group by name
- get_layer_groups(workspace_name: str) tuple[list[dict[str, str]] | str, int]
Get all layer groups for a given workspace
- get_legend_graphic(layer: list[str], format: str = 'image/png', language: str | None = None, style: str | None = None, workspace_name: str | None = None) Response
WMS GetLegendGraphic request
- get_map(layers: list[str], bbox: tuple[float, float, float, float], size: tuple[int, int], srs: str = 'EPSG:2056', format: str = 'image/png', transparent: bool = True, styles: list[str] | None = None, language: str | None = None) ResponseWrapper | None
WMS GetMap request
- get_pg_datastore(workspace_name: str, datastore_name: str) tuple[dict[str, Any] | str, int]
Get a datastore by workspace and name
- get_property_value(workspace_name: str, type_name: str, property: str) dict | list | str
WFS GetPropertyValue request Return the properties as dict (if one feature was found), a list (if multiple features were found), an empty dict if no feature was found or the response content as string
- get_style_definition(style: str, workspace_name: str | None = None) tuple[dict[str, Any] | str, int]
Get a style definition by name
- get_styles(workspace_name: str | None = None) tuple[list[str] | str, int]
Get all styles for a given workspace. If no workspace is provided, get all global styles
- get_tile(layer, format, tile_matrix_set, tile_matrix, row, column) ResponseWrapper | None
WMTS GetTile request
- get_user_roles(user: str) tuple[list[str] | str, int]
Get all roles assigned to a GeoServer user
- get_wfs_layers(workspace_name: str) Any | dict[str, Any]
- get_wms_layer(workspace_name: str, wms_store_name: str, wms_layer_name: str) tuple[dict[str, Any] | str, int]
Get a WMS layer by workspace, store and name
- get_wms_layers(workspace_name: str, accept_languages: str | None = None) Any | dict[str, Any]
- get_wms_store(workspace_name: str, datastore_name: str) tuple[dict[str, Any] | str, int]
Get a WMS by workspace and name
- get_workspace(workspace_name: str) tuple[dict[str, str] | str, int]
Get a workspace by name
- get_workspace_wms_settings(workspace_name: str) tuple[dict[str, Any] | str, int]
Get the WMS settings for a given workspace
- get_workspaces() tuple[list[dict[str, str]] | str, int]
Get all GeoServer workspaces
- publish_gwc_layer(workspace_name: str, layer: str, epsg: int = 4326) tuple[str, int]
- publish_workspace(workspace_name: str, versions: list[str] = ['1.1.1', '1.3.0'], cite_compliant: bool = False, schema_base_url: str = 'http://schemas.opengis.net', verbose: bool = False, bbox_for_each_crs: bool = False, watermark: dict = {'enabled': False, 'position': 'BOT_RIGHT', 'transparency': 100}, interpolation: str = 'Nearest', get_feature_info_mime_type_checking_enabled: bool = False, get_map_mime_type_checking_enabled: bool = False, dynamic_styling_disabled: bool = False, features_reprojection_disabled: bool = False, max_buffer: int = 0, max_request_memory: int = 0, max_rendering_time: int = 0, max_rendering_errors: int = 0, max_requested_dimension_values: int = 100, cache_configuration: dict = {'enabled': False, 'maxEntries': 1000, 'maxEntrySize': 51200}, remote_style_max_request_time: int = 60000, remote_style_timeout: int = 30000, default_group_style_enabled: bool = True, transform_feature_info_disabled: bool = False, auto_escape_template_values: bool = False) tuple[str, int]
Publish the WMS service for a given workspace
- recreate_workspace(workspace_name: str, isolated: bool = False, set_default_workspace: bool = False) tuple[str, int]
Create a workspace in GeoServer, and first delete it if it already exists.
- remove_role_from_user(user: str, role: str) tuple[str, int]
Remove a role from a GeoServer user
- set_default_layer_style(layer_name: str, workspace_name: str, style: str) tuple[str, int]
Set the default style for a layer
- set_default_locale_for_service(workspace_name: str, locale: str | None) tuple[str, int]
Set a default language for localized WMS requests
- unset_default_locale_for_service(workspace_name) tuple[str, int]
Remove the default language for localized WMS requests
- update_user(user: str, password: str | None = None, enabled: bool | None = None) tuple[str, int]
Update a GeoServer user