Skip to content

Commit

Permalink
Add LAYERS URL parameter to wms_url/wfs_url metadata properties
Browse files Browse the repository at this point in the history
Part of #302
  • Loading branch information
jirik committed Apr 6, 2021
1 parent 3bf83e0 commit b27a01c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/layman/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/layman/layer/micka/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/layman/layer/micka/util_test_filled_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.env.cz/corine/data/download.zip?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0</gmd:URL>
<gmd:URL>http://www.env.cz/corine/data/download.zip?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0&amp;LAYERS=layer</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gmx:Anchor xlink:href="https://services.cuzk.cz/registry/codelist/OnlineResourceProtocolValue/OGC:WMS-1.3.0-http-get-capabilities">OGC:WMS-1.3.0-http-get-capabilities</gmx:Anchor>
Expand All @@ -230,7 +230,7 @@
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.env.cz/corine/data/download.zip?SERVICE=WFS&amp;REQUEST=GetCapabilities&amp;VERSION=2.0.0</gmd:URL>
<gmd:URL>http://www.env.cz/corine/data/download.zip?SERVICE=WFS&amp;REQUEST=GetCapabilities&amp;VERSION=2.0.0&amp;LAYERS=layer</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gmx:Anchor xlink:href="https://services.cuzk.cz/registry/codelist/OnlineResourceProtocolValue/OGC:WFS-2.0.0-http-get-capabilities">OGC:WFS-2.0.0-http-get-capabilities</gmx:Anchor>
Expand Down
4 changes: 2 additions & 2 deletions src/layman/layer/rest_test_filled_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://localhost:8000/geoserver/testuser1_wms/ows?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0</gmd:URL>
<gmd:URL>http://localhost:8000/geoserver/testuser1_wms/ows?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0&amp;LAYERS=ne_110m_admin_0_countries_shp</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gmx:Anchor xlink:href="https://services.cuzk.cz/registry/codelist/OnlineResourceProtocolValue/OGC:WMS-1.3.0-http-get-capabilities">OGC:WMS-1.3.0-http-get-capabilities</gmx:Anchor>
Expand All @@ -282,7 +282,7 @@
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://localhost:8000/geoserver/testuser1/wfs?SERVICE=WFS&amp;REQUEST=GetCapabilities&amp;VERSION=2.0.0</gmd:URL>
<gmd:URL>http://localhost:8000/geoserver/testuser1/wfs?SERVICE=WFS&amp;REQUEST=GetCapabilities&amp;VERSION=2.0.0&amp;LAYERS=ne_110m_admin_0_countries_shp</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gmx:Anchor xlink:href="https://services.cuzk.cz/registry/codelist/OnlineResourceProtocolValue/OGC:WFS-2.0.0-http-get-capabilities">OGC:WFS-2.0.0-http-get-capabilities</gmx:Anchor>
Expand Down

0 comments on commit b27a01c

Please sign in to comment.