diff --git a/CHANGELOG.md b/CHANGELOG.md index a21099d11..bcd3301cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Changes - [#257](https://github.com/jirik/layman/issues/257) Endpoints [GET Layers](doc/rest.md#get-layers) and [GET Maps](doc/rest.md#get-maps) can filter and reorder results according to new query parameters. - [#257](https://github.com/jirik/layman/issues/257) Responses of [GET Layers](doc/rest.md#get-layers), [GET Workspace Layers](doc/rest.md#get-workspace-layer), [GET Workspace Layer](doc/rest.md#get-workspace-layer), [PATCH Workspace Layer](doc/rest.md#patch-workspace-layer), [GET Maps](doc/rest.md#get-maps), [GET Workspace Maps](doc/rest.md#get-workspace-map), [GET Workspace Map](doc/rest.md#get-workspace-map), and [PATCH Workspace Map](doc/rest.md#patch-workspace-map) contains new attribute `updated_at` with date and time of last PATCH/POST request to given publication. +- [#302](https://github.com/jirik/layman/issues/302) Metadata properties [wms_url](doc/metadata.md#wms_url) and [wfs_url](doc/metadata.md#wfs_url) contain new URL parameter `LAYERS` whose value is name of the layer. It's non-standard way how to store name of the layer at given WMS/WFS instance within metadata record. ## v1.11.0 2021-03-16 diff --git a/doc/metadata.md b/doc/metadata.md index d8d705bc5..b3ade095e 100644 --- a/doc/metadata.md +++ b/doc/metadata.md @@ -268,11 +268,13 @@ XPath for Map: `/gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentifica ### wfs_url +It contains standard SERVICE, REQUEST, and VERSION parameters and non-standard LAYERS parameter that holds name of the feature type at given WFS instance. + Multiplicity: 1 Shape: String -Example: `"http://localhost:8600/geoserver/workspace1/ows"` +Example: `"http://localhost:8600/geoserver/workspace1/ows?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0&LAYERS=layer"` Synchronizable: yes @@ -280,11 +282,13 @@ XPath for Layer: `/gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd: ### wms_url +It contains standard SERVICE, REQUEST, and VERSION parameters and non-standard LAYERS parameter that holds name of the layer at given WMS instance. + Multiplicity: 1 Shape: String -Example: `"http://localhost:8600/geoserver/workspace1_wms/ows"` +Example: `"http://localhost:8600/geoserver/workspace1_wms/ows?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0&LAYERS=layer"` Synchronizable: yes diff --git a/src/layman/common/metadata.py b/src/layman/common/metadata.py index 75bc01845..95dc58b93 100644 --- a/src/layman/common/metadata.py +++ b/src/layman/common/metadata.py @@ -77,11 +77,11 @@ def extent_equals(a, b, limit=0.95): }, 'wms_url': { 'upper_mp': '1', - 'equals_fn': lambda a, b: strip_capabilities_params(a) == strip_capabilities_params(b), + 'equals_fn': lambda a, b: strip_capabilities_and_layers_params(a) == strip_capabilities_and_layers_params(b), }, 'wfs_url': { 'upper_mp': '1', - 'equals_fn': lambda a, b: strip_capabilities_params(a) == strip_capabilities_params(b), + 'equals_fn': lambda a, b: strip_capabilities_and_layers_params(a) == strip_capabilities_and_layers_params(b), }, 'layer_endpoint': { 'upper_mp': '1', @@ -137,9 +137,9 @@ def prop_equals_strict(values, equals_fn=None): return result -def strip_capabilities_params(url): +def strip_capabilities_and_layers_params(url): from layman.layer.geoserver.wms import strip_params_from_url - return strip_params_from_url(url, ['SERVICE', 'REQUEST', 'VERSION']) + return strip_params_from_url(url, ['SERVICE', 'REQUEST', 'VERSION', 'LAYERS']) def _is_extent_empty(e): diff --git a/src/layman/layer/micka/csw.py b/src/layman/layer/micka/csw.py index 67dcc1b28..84e49302d 100644 --- a/src/layman/layer/micka/csw.py +++ b/src/layman/layer/micka/csw.py @@ -219,8 +219,8 @@ def _get_property_values( 'graphic_url': url_for('rest_workspace_layer_thumbnail.get', username=workspace, layername=layername), 'extent': extent, - 'wms_url': wms.add_capabilities_params_to_url(wms_url), - 'wfs_url': wfs.add_capabilities_params_to_url(wfs_url), + 'wms_url': f"{wms.add_capabilities_params_to_url(wms_url)}&LAYERS={layername}", + 'wfs_url': f"{wfs.add_capabilities_params_to_url(wfs_url)}&LAYERS={layername}", 'layer_endpoint': url_for('rest_workspace_layer.get', username=workspace, layername=layername), 'scale_denominator': scale_denominator, 'language': languages, diff --git a/src/layman/layer/micka/util_test_filled_template.xml b/src/layman/layer/micka/util_test_filled_template.xml index 1d0c34f1f..e171c88c9 100644 --- a/src/layman/layer/micka/util_test_filled_template.xml +++ b/src/layman/layer/micka/util_test_filled_template.xml @@ -217,7 +217,7 @@ - http://www.env.cz/corine/data/download.zip?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0 + http://www.env.cz/corine/data/download.zip?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0&LAYERS=layer OGC:WMS-1.3.0-http-get-capabilities @@ -230,7 +230,7 @@ - http://www.env.cz/corine/data/download.zip?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0 + http://www.env.cz/corine/data/download.zip?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0&LAYERS=layer OGC:WFS-2.0.0-http-get-capabilities diff --git a/src/layman/layer/rest_test_filled_template.xml b/src/layman/layer/rest_test_filled_template.xml index d64a46c8a..c20ff6803 100644 --- a/src/layman/layer/rest_test_filled_template.xml +++ b/src/layman/layer/rest_test_filled_template.xml @@ -269,7 +269,7 @@ - http://localhost:8000/geoserver/testuser1_wms/ows?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0 + http://localhost:8000/geoserver/testuser1_wms/ows?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0&LAYERS=ne_110m_admin_0_countries_shp OGC:WMS-1.3.0-http-get-capabilities @@ -282,7 +282,7 @@ - http://localhost:8000/geoserver/testuser1/wfs?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0 + http://localhost:8000/geoserver/testuser1/wfs?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0&LAYERS=ne_110m_admin_0_countries_shp OGC:WFS-2.0.0-http-get-capabilities