geoservercloud.py
- class geoservercloud.GeoServerCloud(url: str = 'http://localhost:9090/geoserver/cloud', user: str = 'admin', password: str = 'geoserver', verifytls: bool = True)
Bases:
objectFacade 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
- Parameters:
user (str) – Username
role (str) – Name of the role
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- cleanup()
Cleanup internal state
- 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
- Parameters:
priority (int, optional) – Rule priority (default: 0)
access (str, optional) – Access level, e.g. “ADMIN” (default: “ADMIN”)
role (str, optional) – Optional role the rule applies to
user (str, optional) – Optional user the rule applies to
workspace_name (str, optional) – Optional workspace the rule applies to
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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
- Parameters:
priority (int, optional) – Rule priority (default: 0)
access (str, optional) – Access level, e.g. “DENY” (default: “DENY”)
role (str, optional) – Optional role the rule applies to
user (str, optional) – Optional user the rule applies to
service (str, optional) – Optional OGC service the rule applies to, e.g. “WMS”
request (str, optional) – Optional request type the rule applies to, e.g. “GetMap”
workspace_name (str, optional) – Optional workspace the rule applies to
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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 types of OGC requests
- Parameters:
requests (list of str) – List of request types, e.g. [“GetMap”, “GetFeatureInfo”]
priority (int, optional) – Base priority for the rules (default: 0)
access (str, optional) – Access level, e.g. “DENY” (default: “DENY”)
role (str, optional) – Optional role the rules apply to
service (str, optional) – Optional OGC service the rules apply to, e.g. “WMS”
workspace_name (str, optional) – Optional workspace the rules apply to
- Returns:
List of tuples of (content, status_code), one per created rule
- Return type:
list of tuple
- create_coverage(workspace_name: str, coveragestore_name: str, coverage_name: str, title: str | None = None, native_name: str | None = None) tuple[str, int]
Publish a coverage layer from a given coverage store
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
coverage_name (str) – Name for the coverage
title (str, optional) – Optional title for the coverage (default: same as coverage_name)
native_name (str, optional) – Native name of the coverage (default: same as coverage_name)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_coverage_store(workspace_name: str, coveragestore_name: str, url: str, type: str = 'ImageMosaic', enabled: bool = True, metadata: dict | None = None) tuple[dict[str, Any] | str, int]
Create a coverage store from a store definition. When using a directory path as URL, coverages will be auto-discovered
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
url (str) – Directory path on the server or URL of the granules (raster images)
type (str, optional) – Type of the coverage store, e.g. ImageMosaic, GeoTIFF (default: “ImageMosaic”)
enabled (bool, optional) – Whether the coverage store is enabled (default: True)
metadata (dict, optional) – Optional metadata dictionary (e.g. {“cogSettings”: {“rangeReaderSettings”: “HTTP”}})
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_datastore(workspace_name: str, datastore_name: str, datastore_type: str, connection_parameters: dict[str, Any], description: str | None = None, enabled: bool = True, set_default_datastore: bool = False) tuple[str, int]
Create a generic datastore of any type in GeoServer, or update if it already exists. This method accepts flexible connection parameters, allowing to create any type of datastore.
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name for the datastore
datastore_type (str) – Type of datastore (e.g., “PostGIS”, “Shapefile”, “Directory of spatial files (shapefiles)”)
connection_parameters (dict) – Dict of connection parameters specific to the datastore type
description (str, optional) – Optional description
enabled (bool, optional) – Whether the datastore should be enabled (default: True)
set_default_datastore (bool, optional) – Whether to set as default datastore (default: False)
- Returns:
Tuple of (datastore_name, status_code)
- Return type:
tuple
- Example:
>>> create_datastore( ... workspace_name="myworkspace", ... datastore_name="my_store", ... datastore_type="PostGIS", ... connection_parameters={ ... "dbtype": "postgis", ... "host": "localhost", ... "port": 5432, ... "database": "mydb", ... "user": "user", ... "passwd": "password", ... "schema": "public", ... "Expose primary keys": "true", ... } ... )
- create_feature_type(layer_name: str, workspace_name: str | None = None, datastore_name: str | None = None, title: str | dict | None = None, abstract: str | dict | None = None, attributes: dict | None = None, epsg: int = 4326, keywords: list[str] | None = None, time_dimension_info: TimeDimensionInfo | None = None, layer_links: list[dict[str, str]] | None = None, native_name: str | None = None, cql_filter: str | None = None) tuple[str, int]
Create a feature type or update it if it already exists.
- Parameters:
layer_name (str) – Name of the feature type / layer
workspace_name (str) – Name of the workspace
datastore_name (str) – Name for the datastore
title (str or dict, optional) – Title for the feature type (can be internationalized as dict)
abstract (str or dict, optional) – Abstract for the feature type (can be internationalized as dict)
attributes (dict, optional) – Dict defining the feature type attributes (name and type). If omitted, GeoServer will infer the attributes from the native table
epsg (int, optional) – EPSG code for the feature type SRS (default: 4326)
keywords (list of str, optional) – List of keywords for the feature type
time_dimension_info (TimeDimensionInfo, optional) – Time dimension configuration for the feature type
layer_links (list of dict, optional) – List of metadata links for the feature type, e.g. [{‘content’:”mymetadataurl”, ‘metadataType’:”ISO19115:2003”, ‘type’:”text/xml”}]
native_name (str, optional) – Native name of the feature type (default: same as layer_name)
cql_filter (str, optional) – CQL filter to filter the data, e.g. key=’Value’
- Returns:
Tuple of (datastore_name, status_code)
- Return type:
tuple
- Example:
>>> create_feature_type( ... layer_name="mylayer", ... workspace_name="myworkspace", ... datastore_name="mystore", ... native_name="nativename", ... title={"en": "English Title"}, ... abstract={"en": "English Abstract"}, ... attributes={ ... "geom": { ... "type": "Point", ... "required": True, ... }, ... "id": { ... "type": "integer", ... "required": True, ... }, ... "title": { ... "type": "string", ... "required": False, ... }, ... "timestamp": { ... "type": "datetime", ... "required": False, ... }, ... }, ... epsg=4326, ... keywords=["example"], ... time_dimension_info=TimeDimensionInfo( ... attribute="timestamp", ... presentation="LIST", ... default_value_strategy="MAXIMUM", ... ), ... layer_links=[{'content':"mymetadataurl", 'metadataType':"ISO19115:2003", 'type':"text/xml"}], ... cql_filter="key='Value'" ... )
- create_gridset(epsg: int) tuple[str, int]
Create a gridset for GeoWebCache for a given projection Supported EPSG codes are 2056, 21781 and 3857
- Parameters:
epsg (int) – EPSG code for the gridset
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_gwc_blobstore(id: str, bucket: str, max_connections: int, aws_access_key: str | None = None, aws_secret_key: str | None = None, prefix: str | None = None, enabled: bool | None = None, default: bool | None = None, access: str | None = None, use_https: bool | None = None, proxy_domain: str | None = None, proxy_workstation: str | None = None, proxy_host: str | None = None, proxy_port: str | None = None, proxy_username: str | None = None, proxy_password: str | None = None, use_gzip: bool | None = None, endpoint: str | None = None) tuple[str, int]
Create or update a blobstore for GeoWebCache cache storage
- Parameters:
id – Identifier of the blobstore
bucket – Name of the AWS S3 bucket where to store tiles
max_connections – Maximum number of allowed open HTTP connections
aws_access_key – AWS access key, not required if using anonymous or role-based credentials
aws_secret_key – AWS secret key, not required if using anonymous or role-based credentials
prefix – Optional base prefix path to use as the root to store tiles under the bucket
enabled – Whether the blobstore is enabled
default – Whether this blobstore is the default one
access – Access control for stored tiles, either “PUBLIC” or “PRIVATE”
use_https – Whether to use HTTPS (True) or HTTP (False) when talking to S3 (GeoServer defaults to True if omitted)
proxy_domain – Optional Windows domain name for configuring an NTLM proxy
proxy_workstation – Optional Windows workstation name for configuring NTLM proxy support
proxy_host – Optional proxy host the client will connect through
proxy_port – Optional proxy port the client will connect through
proxy_username – Optional proxy user name to use if connecting through a proxy
proxy_password – Optional proxy password to use when connecting through a proxy
use_gzip – Whether to use gzip compression
endpoint – Host of the S3-compatible server (if not AWS)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_imagemosaic_store_from_directory(workspace_name: str, coveragestore_name: str, directory_path: str) tuple[str, int]
Create an ImageMosaic coverage store from a directory on the server which contains granules (raster images). Granules and coverages will be auto-discovered. Similar to creating a store from the WebUI. Calls /workspaces/{workspace_name}/coveragestores/{coveragestore_name}/external.imagemosaic
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
directory_path (str) – Directory path on the server containing the granules
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_imagemosaic_store_from_properties_zip(workspace_name: str, coveragestore_name: str, properties_zip: bytes) tuple[str, int]
Upload an ImageMosaic coverage store configuration as ZIP to create an empty coverage store. The ZIP contains two files: indexer.properties and datastore.properties Calls /workspaces/{workspace_name}/coveragestores/{coveragestore_name}/file.imagemosaic?configure=none
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
properties_zip (bytes) – ZIP archive content containing indexer.properties and datastore.properties
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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 a JNDI resource, or update it if it already exists.
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name for the datastore
jndi_reference (str) – JNDI resource reference name
pg_schema (str, optional) – PostgreSQL schema (default: “public”)
description (str, optional) – Optional description
set_default_datastore (bool, optional) – Whether to set as default datastore (default: False)
- Returns:
Tuple of (datastore_name, status_code)
- Return type:
tuple
- create_layer_group(group: str, workspace_name: str | None, layers: list[str] | None = None, styles: list[str] | None = None, title: str | dict | None = None, abstract: str | dict | None = None, epsg: int = 4326, mode: str = 'SINGLE', enabled: bool = True, advertised: bool = True, global_styles: bool = False) tuple[str, int]
Create a layer group, or update it if it already exists.
- Parameters:
group (str) – Name for the layer group
workspace_name (str, optional) – Name of the workspace
layers (list of str, optional) – List of layer names to include in the group
styles (list of str, optional) – List of style names associated with each layer
title (str or dict, optional) – Title for the layer group (can be internationalized as dict)
abstract (str or dict, optional) – Abstract for the layer group (can be internationalized as dict)
epsg (int, optional) – EPSG code used to compute the layer group bounds (default: 4326)
mode (str, optional) – Layer group mode, e.g. “SINGLE”, “NAMED”, “CONTAINER”, “EO” (default: “SINGLE”)
enabled (bool, optional) – Whether the layer group is enabled (default: True)
advertised (bool, optional) – Whether the layer group is advertised (default: True)
global_styles (bool, optional) – Whether the provided styles are global styles rather than workspace styles (default: False)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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 exists.
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name for the datastore
pg_host (str) – PostgreSQL host
pg_port (int) – PostgreSQL port
pg_db (str) – PostgreSQL database name
pg_user (str) – PostgreSQL user
pg_password (str) – PostgreSQL password
pg_schema (str, optional) – PostgreSQL schema (default: “public”)
description (str, optional) – Optional description
set_default_datastore (bool, optional) – Whether to set as default datastore (default: False)
- Returns:
Tuple of (datastore_name, status_code)
- Return type:
tuple
- create_pmtiles_datastore(workspace_name: str, datastore_name: str, pmtiles_url: str, description: str | None = None, range_reader_provider: str = 'file', caching_enabled: bool = True, caching_block_aligned: bool = True, http_timeout_millis: int = 5000, http_trust_all_certificates: bool = False, s3_use_default_credentials_provider: bool = False, s3_force_path_style: bool = True, gcs_default_credentials_chain: bool = False) tuple[str, int]
Create a PMTiles datastore, or update it if it already exists.
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name for the PMTiles datastore
pmtiles_url (str) – URL or path to the PMTiles file
description (str, optional) – Optional description for the datastore
range_reader_provider (str, optional) – Range reader provider type (default: “file”)
caching_enabled (bool, optional) – Enable caching for range reader (default: True)
caching_block_aligned (bool, optional) – Enable block-aligned caching (default: True)
http_timeout_millis (int, optional) – HTTP timeout in milliseconds (default: 5000)
http_trust_all_certificates (bool, optional) – Trust all SSL certificates for HTTP (default: False)
s3_use_default_credentials_provider (bool, optional) – Use default AWS credentials provider for S3 (default: False)
s3_force_path_style (bool, optional) – Force path-style access for S3 (default: True)
gcs_default_credentials_chain (bool, optional) – Use default credentials chain for Google Cloud Storage (default: False)
- Returns:
Tuple of (datastore_name, status_code)
- Return type:
tuple
- Example:
>>> create_pmtiles_datastore( ... workspace_name="pmtiles_workspace", ... datastore_name="pmtiles_store", ... pmtiles_url="file:///mnt/pmtiles/mypmtilesfile.pmtiles", ... description="My PMTiles datastore", ... range_reader_provider="file", ... )
- create_role(role_name: str) tuple[str, int]
Create a GeoServer role if it does not already exist
- Parameters:
role_name (str) – Name of the role
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_style_definition(style_name: str, filename: str, workspace_name: str | None = None, format: str = 'sld') tuple[str, int]
Create a style definition, or update it if it already exists.
- Parameters:
style_name (str) – Name for the style
filename (str) – Filename of the style resource, e.g. “mystyle.sld”
workspace_name (str, optional) – Name of the workspace, or None for a global style
format (str, optional) – Style format, e.g. “sld” or “mbstyle” (default: “sld”)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_style_from_file(style_name: str, file: str, workspace_name: str | None = None) tuple[str, int]
Create a style from a file, or update it if it already exists. Supported file extensions are .sld, .zip and .mbstyle.
- Parameters:
style_name (str) – Name for the style
file (str) – Path to the style file (.sld, .zip or .mbstyle)
workspace_name (str, optional) – Name of the workspace, or None for a global style
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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.
- Parameters:
style_name (str) – Name for the style
style_string (str) – SLD style definition as a string
workspace_name (str, optional) – Name of the workspace, or None for a global style
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_user(user: str, password: str, enabled: bool = True) tuple[str, int]
Create a GeoServer user
- Parameters:
user (str) – Username
password (str) – Password for the user
enabled (bool, optional) – Whether the user should be enabled (default: True)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_wms(workspace: str | None = None) None
Initialize a WMS OWSLib client scoped to the given workspace
- Parameters:
workspace (str, optional) – Name of the workspace, or None to use the default workspace
- 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)
- Parameters:
workspace_name (str) – Name of the workspace
wms_store_name (str) – Name of the WMS store
native_layer_name (str) – Name of the layer on the remote WMS server
published_layer_name (str, optional) – Name for the published layer (default: same as native_layer_name)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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 exists.
- Parameters:
workspace_name (str) – Name of the workspace
wms_store_name (str) – Name for the WMS store
capabilities_url (str) – URL of the remote WMS GetCapabilities document
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_wmts(workspace_name: str | None = None) None
Initialize a WMTS OWSLib client scoped to the given workspace
- Parameters:
workspace_name (str, optional) – Name of the workspace, or None to use the default workspace
- 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)
- Parameters:
workspace_name (str) – Name of the workspace
wmts_store (str) – Name of the WMTS store
native_layer (str) – Name of the layer on the remote WMTS server
published_layer (str, optional) – Name for the published layer (default: same as native_layer)
epsg (int, optional) – EPSG code for the layer SRS (default: 4326)
international_title (dict, optional) – Internationalized title, e.g. {“en”: “English Title”}
international_abstract (dict, optional) – Internationalized abstract, e.g. {“en”: “English Abstract”}
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- create_wmts_store(workspace_name: str, name: str, capabilities: str, enabled: bool = True, default: bool | None = None, disable_on_conn_failure: bool | None = None, use_connection_pooling: bool | None = True, max_connections: int | None = None, read_timeout: int | None = None, connect_timeout: int | None = None) tuple[str, int]
Create a cascaded WMTS store, or update it if it already exists.
- Parameters:
workspace_name (str) – Name of the workspace
name (str) – Name for the WMTS store
capabilities (str) – URL of the remote WMTS GetCapabilities document
enabled (bool, optional) – Whether the store should be enabled (default: True)
default (bool, optional) – Whether this is the default WMTS store
disable_on_conn_failure (bool, optional) – Disable the store on connection failure
use_connection_pooling (bool, optional) – Whether to use connection pooling (default: True)
max_connections (int, optional) – Maximum number of connections
read_timeout (int, optional) – Read timeout in seconds
connect_timeout (int, optional) – Connect timeout in seconds
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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. If it exists, update it.
- Parameters:
workspace_name (str) – Name of the workspace
isolated (bool, optional) – Whether the workspace should be isolated (default: False)
set_default_workspace (bool, optional) – Whether to set as the default workspace (default: False)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_acl_admin_rule(id: int | str) tuple[str, int]
Delete a GeoServer ACL admin rule by id
- Parameters:
id (int or str) – Id of the ACL admin rule
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_all_acl_admin_rules() tuple[str, int]
Delete all existing GeoServer ACL admin rules
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_all_acl_rules() tuple[str, int]
Delete all existing GeoServer ACL data rules
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_coverage_store(workspace_name: str, coveragestore_name: str) tuple[str, int]
Delete a coverage store recursively
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_datastore(workspace_name: str, datastore_name: str) tuple[str, int]
Delete a datastore recursively
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_feature_type(workspace_name: str, datastore_name: str, layer_name: str) tuple[str, int]
Delete a feature type and associated layer
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
layer_name (str) – Name of the feature type / layer
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_gwc_layer(workspace_name: str, layer: str) tuple[str, int]
Delete a GeoWebCache layer
- Parameters:
workspace_name (str) – Name of the workspace
layer (str) – Name of the layer
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_layer_group(workspace_name: str, layer_group_name: str) tuple[str, int]
Delete a layer group
- Parameters:
workspace_name (str) – Name of the workspace
layer_group_name (str) – Name of the layer group
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_role(role_name: str) tuple[str, int]
Delete a GeoServer role
- Parameters:
role_name (str) – Name of the role
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_user(user: str) tuple[str, int]
Delete a GeoServer user
- Parameters:
user (str) – Username
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_wms_layer(workspace_name: str, wms_store_name: str, wms_layer_name: str) tuple[str, int]
Delete a WMS layer
- Parameters:
workspace_name (str) – Name of the workspace
wms_store_name (str) – Name of the WMS store
wms_layer_name (str) – Name of the WMS layer
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_wms_store(workspace_name: str, wms_store_name: str) tuple[str, int]
Delete a WMS store recursively
- Parameters:
workspace_name (str) – Name of the workspace
wms_store_name (str) – Name of the WMS store
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_wmts_store(workspace_name: str, wmts_store_name: str) tuple[str, int]
Delete a WMTS store recursively
- Parameters:
workspace_name (str) – Name of the workspace
wmts_store_name (str) – Name of the WMTS store
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- delete_workspace(workspace_name: str) tuple[str, int]
Delete a GeoServer workspace (recursively)
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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
- Parameters:
workspace_name (str, optional) – Optional workspace name
type_name (str, optional) – Optional name of the feature type
format (str, optional) – Response format (default: “application/json”)
- Returns:
Feature type(s) as a dict, or the response content as a string
- Return type:
dict or str
- get_acl_rules() tuple[dict[str, Any] | str, int]
Return all GeoServer ACL data rules
- Returns:
Tuple of (rules, status_code)
- Return type:
tuple
- get_coverage(workspace_name: str, coveragestore_name: str, coverage_name: str) tuple[dict[str, object] | str, int]
Get a single coverage for a given workspace, coverage store, and coverage name
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
coverage_name (str) – Name of the coverage
- Returns:
Tuple of (coverage, status_code)
- Return type:
tuple
- get_coverage_store(workspace_name: str, coveragestore_name: str) tuple[dict[str, Any] | str, int]
Get a coverage store by workspace and name
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
- Returns:
Tuple of (coverage_store, status_code)
- Return type:
tuple
- get_coverages(workspace_name: str, coveragestore_name: str) tuple[list[dict[str, str]] | str, int]
Get all coverages for a given workspace and coverage store
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
- Returns:
Tuple of (coverages, status_code)
- Return type:
tuple
- get_datastore(workspace_name: str, datastore_name: str) tuple[dict[str, Any] | str, int]
Get a datastore by workspace and name
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
- Returns:
Tuple of (datastore, status_code)
- Return type:
tuple
- get_datastores(workspace_name: str) tuple[list[dict[str, str]] | str, int]
Get all datastores for a given workspace
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (datastores, status_code)
- Return type:
tuple
- 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
- Parameters:
workspace_name (str) – Name of the workspace
type_name (str) – Name of the feature type
feature_id (int, optional) – Optional feature id to fetch a single feature
max_feature (int, optional) – Maximum number of features to return
format (str, optional) – Response format (default: “application/json”)
- Returns:
Feature(s) as a dict, or the response content as a string
- Return type:
dict or str
- 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], time: str | None = None, workspace_name: str | None = None) ResponseWrapper | None
WMS GetFeatureInfo request
- Parameters:
layers (list of str) – List of layer names to query
bbox (tuple of float) – Bounding box as (minx, miny, maxx, maxy)
size (tuple of int) – Image size as (width, height) in pixels
srs (str, optional) – Spatial reference system (default: “EPSG:2056”)
info_format (str, optional) – Format of the returned feature info (default: “application/json”)
transparent (bool, optional) – Whether the background should be transparent (default: True)
styles (list of str, optional) – List of style names to apply to the layers
xy (list of float, optional) – Pixel coordinates (x, y) to query (default: [0, 0])
time (str, optional) – Optional time value for time-enabled layers
workspace_name (str, optional) – Optional workspace name
- Returns:
owslib.util.ResponseWrapper with the feature info, or None
- Return type:
ResponseWrapper, optional
- 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
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
feature_type_name (str) – Name of the feature type
- Returns:
Tuple of (feature_type, status_code)
- Return type:
tuple
- 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
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
- Returns:
Tuple of (feature_types, status_code)
- Return type:
tuple
- get_gwc_layer(workspace_name: str, layer: str) tuple[dict[str, Any] | str, int]
Get a GeoWebCache layer by workspace and layer name
- Parameters:
workspace_name (str) – Name of the workspace
layer (str) – Name of the layer
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- get_layer_group(workspace_name: str, layer_group_name: str) tuple[dict[str, Any] | str, int]
Get a layer group by name
- Parameters:
workspace_name (str) – Name of the workspace
layer_group_name (str) – Name of the layer group
- Returns:
Tuple of (layer_group, status_code)
- Return type:
tuple
- get_layer_groups(workspace_name: str) tuple[list[dict[str, str]] | str, int]
Get all layer groups for a given workspace
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (layer_groups, status_code)
- Return type:
tuple
- get_legend_graphic(layer: str | list[str], format: str = 'image/png', language: str | None = None, style: str | None = None, workspace_name: str | None = None) Response
WMS GetLegendGraphic request
- Parameters:
layer (str or list of str) – Name of the layer(s) to get a legend for
format (str, optional) – Image format (default: “image/png”)
language (str, optional) – Optional language code for localized content
style (str, optional) – Optional style name to use for the legend
workspace_name (str, optional) – Optional workspace name
- Returns:
HTTP response with the legend image
- Return type:
requests.Response
- 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, time: str | None = None) ResponseWrapper | None
WMS GetMap request
- Parameters:
layers (list of str) – List of layer names to render
bbox (tuple of float) – Bounding box as (minx, miny, maxx, maxy)
size (tuple of int) – Image size as (width, height) in pixels
srs (str, optional) – Spatial reference system (default: “EPSG:2056”)
format (str, optional) – Image format (default: “image/png”)
transparent (bool, optional) – Whether the background should be transparent (default: True)
styles (list of str, optional) – List of style names to apply to the layers
language (str, optional) – Optional language code for localized content
time (str, optional) – Optional time value for time-enabled layers
- Returns:
owslib.util.ResponseWrapper with the map image, or None
- Return type:
ResponseWrapper, optional
- get_pg_datastore(workspace_name: str, datastore_name: str) tuple[dict[str, Any] | str, int]
Get a datastore by workspace and name
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the datastore
- Returns:
Tuple of (datastore, status_code)
- Return type:
tuple
- 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
- Parameters:
workspace_name (str) – Name of the workspace
type_name (str) – Name of the feature type
property (str) – Name of the property to fetch
- Returns:
Property value(s) as a dict or list, or the response content as a string
- Return type:
dict or list or str
- get_style_definition(style: str, workspace_name: str | None = None) tuple[dict[str, Any] | str, int]
Get a style definition by name
- Parameters:
style (str) – Name of the style
workspace_name (str, optional) – Name of the workspace, or None for a global style
- Returns:
Tuple of (style_definition, status_code)
- Return type:
tuple
- get_styles(workspace_name: str | None = None) tuple[list[dict[str, str]] | str, int]
Get all styles for a given workspace. If no workspace is provided, get all global styles
- Parameters:
workspace_name (str, optional) – Name of the workspace, or None for global styles
- Returns:
Tuple of (styles, status_code)
- Return type:
tuple
- get_tile(layer: str, format: str, tile_matrix_set: str, tile_matrix: str, row: int, column: int, workspace_name: str | None = None) ResponseWrapper | None
WMTS GetTile request
- Parameters:
layer – Name of the WMTS layer
format – Image format (e.g. “image/png”)
tile_matrix_set – Tile matrix set (e.g. “EPSG:3857”)
tile_matrix – Tile matrix (zoom level)
row – Tile row
column – Tile column
workspace_name – Optional workspace name
- Returns:
owslib.util.ResponseWrapper with the tile image or None
- get_user_roles(user: str) tuple[list[str] | str, int]
Get all roles assigned to a GeoServer user
- Parameters:
user (str) – Username
- Returns:
Tuple of (roles, status_code)
- Return type:
tuple
- get_version() tuple[dict[str, dict[str, list]] | str, int]
Get GeoServer version information
- Returns:
- A tuple containing:
content (dict[str, dict[str, list]] or str): The version information as a dictionary if the request is successful ({‘about’: {‘resource’: […]}}) or an error message as a string if the request fails.
status (int): The HTTP status code of the response.
- Return type:
tuple
- get_wfs_layers(workspace_name: str) Any | dict[str, Any]
Get the capabilities of all WFS layers for a given workspace
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Parsed WFS capabilities document
- Return type:
Any or dict
- 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
- Parameters:
workspace_name (str) – Name of the workspace
wms_store_name (str) – Name of the WMS store
wms_layer_name (str) – Name of the WMS layer
- Returns:
Tuple of (wms_layer, status_code)
- Return type:
tuple
- get_wms_layers(workspace_name: str, accept_languages: str | None = None) Any | dict[str, Any]
Get the capabilities of all WMS layers for a given workspace
- Parameters:
workspace_name (str) – Name of the workspace
accept_languages (str, optional) – Optional comma-separated list of preferred languages for localized content
- Returns:
Parsed WMS capabilities document
- Return type:
Any or dict
- get_wms_store(workspace_name: str, datastore_name: str) tuple[dict[str, Any] | str, int]
Get a WMS store by workspace and name
- Parameters:
workspace_name (str) – Name of the workspace
datastore_name (str) – Name of the WMS store
- Returns:
Tuple of (wms_store, status_code)
- Return type:
tuple
- get_workspace(workspace_name: str) tuple[dict[str, str] | str, int]
Get a workspace by name
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (workspace, status_code)
- Return type:
tuple
- get_workspace_wms_settings(workspace_name: str) tuple[dict[str, Any] | str, int]
Get the WMS settings for a given workspace
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (wms_settings, status_code)
- Return type:
tuple
- get_workspaces() tuple[list[dict[str, str]] | str, int]
Get all GeoServer workspaces
- Returns:
Tuple of (workspaces, status_code)
- Return type:
tuple
- harvest_granules_to_coverage_store(workspace_name: str, coveragestore_name: str, directory_path: str) tuple[str, int]
Harvest granules (raster files) from a server directory into an existing ImageMosaic coverage store
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
directory_path (str) – Directory path on the server containing the granules
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- publish_granule_to_coverage_store(workspace_name: str, coveragestore_name: str, method: str, granule_path: str) tuple[str, int]
Publish a single granule (raster image) to an existing ImageMosaic coverage store. The granule is an existing file stored either on the server or remotely.
- Parameters:
workspace_name (str) – Name of the workspace
coveragestore_name (str) – Name of the coverage store
method (str) – “external” for a file on the server, “remote” for a remote file
granule_path (str) – file path (for external granules) or URL (for remote granules)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- publish_gwc_layer(workspace_name: str, layer: str, epsg: int = 4326, id: str | None = None, enabled: bool = True, grid_subsets: list[GridSubset] | None = None, mime_formats: list[str] | None = None, parameter_filters: list[ParameterFilter] | None = None, meta_width_height: list[int] | None = None, gutter: int | None = None, expire_cache: int | None = None, expire_clients: int | None = None, cache_warning_skips: list[Any] | None = None) tuple[str, int]
Publish a GeoWebCache layer, or update it if it already exists.
- Parameters:
workspace_name (str) – Name of the workspace
layer (str) – Name of the layer to cache
epsg (int, optional) – EPSG code used to derive the default grid subset (default: 4326)
id (str, optional) – Optional GeoWebCache layer id
enabled (bool, optional) – Whether the cached layer is enabled (default: True)
grid_subsets (list of GridSubset, optional) – List of grid subsets to cache (default: derived from epsg)
mime_formats (list of str, optional) – List of MIME types to cache, e.g. [“image/png”]
parameter_filters (list of ParameterFilter, optional) – List of parameter filters applied to the cache
meta_width_height (list of int, optional) – Meta-tiling factors as [width, height]
gutter (int, optional) – Gutter size in pixels
expire_cache (int, optional) – Cache expiration time in seconds
expire_clients (int, optional) – Client cache expiration time in seconds
cache_warning_skips (list, optional) – List of warnings to skip when seeding the cache
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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
- Parameters:
workspace_name (str) – Name of the workspace
versions (list of str, optional) – WMS versions to enable (default: [“1.1.1”, “1.3.0”])
cite_compliant (bool, optional) – Whether the service should be CITE compliant (default: False)
schema_base_url (str, optional) – Base URL for OGC schemas (default: “http://schemas.opengis.net”)
verbose (bool, optional) – Enable verbose XML output (default: False)
bbox_for_each_crs (bool, optional) – Whether to compute the bounding box for each supported CRS (default: False)
watermark (dict, optional) – Watermark configuration (default: disabled)
interpolation (str, optional) – Default interpolation method (default: “Nearest”)
get_feature_info_mime_type_checking_enabled (bool, optional) – Restrict allowed MIME types for GetFeatureInfo (default: False)
get_map_mime_type_checking_enabled (bool, optional) – Restrict allowed MIME types for GetMap (default: False)
dynamic_styling_disabled (bool, optional) – Disable the SLD_BODY parameter in requests (default: False)
features_reprojection_disabled (bool, optional) – Disable on-the-fly feature reprojection (default: False)
max_buffer (int, optional) – Maximum buffer size in pixels for rendering, 0 for unlimited (default: 0)
max_request_memory (int, optional) – Maximum memory in KB usable per request, 0 for unlimited (default: 0)
max_rendering_time (int, optional) – Maximum rendering time in seconds, 0 for unlimited (default: 0)
max_rendering_errors (int, optional) – Maximum number of rendering errors tolerated, 0 for unlimited (default: 0)
max_requested_dimension_values (int, optional) – Maximum number of dimension values that can be requested (default: 100)
cache_configuration (dict, optional) – GetMap caching configuration (default: disabled)
remote_style_max_request_time (int, optional) – Maximum time in ms allowed to fetch a remote style (default: 60000)
remote_style_timeout (int, optional) – Timeout in ms for fetching a remote style (default: 30000)
default_group_style_enabled (bool, optional) – Whether a default style is generated for layer groups (default: True)
transform_feature_info_disabled (bool, optional) – Disable XSLT transformation of GetFeatureInfo output (default: False)
auto_escape_template_values (bool, optional) – Automatically escape template values in GetFeatureInfo output (default: False)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- 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.
- Parameters:
workspace_name (str) – Name of the workspace
isolated (bool, optional) – Whether the workspace should be isolated (default: False)
set_default_workspace (bool, optional) – Whether to set as the default workspace (default: False)
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- remove_role_from_user(user: str, role: str) tuple[str, int]
Remove a role from a GeoServer user
- Parameters:
user (str) – Username
role (str) – Name of the role
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- set_default_layer_style(layer_name: str, workspace_name: str, style: str) tuple[str, int]
Set the default style for a layer
- Parameters:
layer_name (str) – Name of the layer
workspace_name (str) – Name of the workspace
style (str) – Name of the style to set as default
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- set_default_locale_for_service(workspace_name: str, locale: str | None) tuple[str, int]
Set a default language for localized WMS requests
- Parameters:
workspace_name (str) – Name of the workspace
locale (str, optional) – Locale code to set as default (e.g. “en”), or None to unset
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- unset_default_locale_for_service(workspace_name) tuple[str, int]
Remove the default language for localized WMS requests
- Parameters:
workspace_name (str) – Name of the workspace
- Returns:
Tuple of (content, status_code)
- Return type:
tuple
- update_user(user: str, password: str | None = None, enabled: bool | None = None) tuple[str, int]
Update a GeoServer user
- Parameters:
user (str) – Username
password (str, optional) – New password for the user
enabled (bool, optional) – Whether the user should be enabled
- Returns:
Tuple of (content, status_code)
- Return type:
tuple