Updates to the OGC API - Maps Support#2308
Updates to the OGC API - Maps Support#2308doublebyte1 wants to merge 16 commits intogeopython:masterfrom
Conversation
|
Should the bbox-crs not be used to convert the bbox into the requested crs? |
Whenever it exists, yes; but this is an optional parameter, so we should have a fallback if we want to support a minimal map query (e.g.: no crs, no bbox-crs, no bbox). |
|
Makes some sense to me. Is there a reason to derive the default CRS from bbox or should we align this with crs list and storage_crs as implemented for OAFeat? |
If we don' t have bbox-crs and bbox as parameters, we still need some defaults to provide a map to the user. The defaults are taken from what is defined on the spatial extents of the collections (bbox and bbox-crs), but I am open to more ideas (: Examples: If the spatial extents of the collection are not defined in the config, I also defined some defaults. But I am actually not sure, if that is even possible? In the case of our WMS providers, the storage_crs make less sense, because they are basically facades. |
|
Ahh. Using bbox and bbox-crs in that context makes sense. I was more thinking along the lines of conformance with https://docs.pygeoapi.io/en/latest/crs.html |
|
Does the map emit its bbox and CRS? It is my understand that to know how to draw a map the client would need to know the extents of the map which I presume is done by the client dictating to the server these values. Is |
I see your point now. No, we do not give that information back to the client. This is what is written in the Standard:
Also, the bounding box is not optional. I need to update the code to reflect that, and the fact that the default crs of the bounding box is CRS84, rather than 4326. Regarding the native storage crs, I guess we need the user to declare it in the config? there is a layer crs in the GetCapabilities of the WMS service. |
…e WebMercator bbox - Support defaults for crs, bbox and bbox-crs
…s of the axis order defined in the CRS, only for OAM
…g to the Standard - fix typo in bbox-crs par
- fixed tests for wms_facade
- added Content-Crs and Content-Bbox to OAM
|
CI failures seem unrelated |
| ] | ||
|
|
||
| DEFAULT_CRS = 'http://www.opengis.net/def/crs/EPSG/0/4326' | ||
| DEFAULT_CRS = 'http://www.opengis.net/def/crs/OGC/1.3/CRS84' |
There was a problem hiding this comment.
Can these be a part of pygeoapi.crs? We have the concept of DEFAULT_STORAGE_CRS and DEFAULT_CRS already.
| 'crs', collection_def.get('crs', DEFAULT_CRS))] | ||
| query_args['bbox_crs'] = CRS_CODES[request.params.get( | ||
| 'bbox-crs', collection_def.get('crs', DEFAULT_CRS))] | ||
| query_args['transparent'] = request.params.get('transparent', True) |
| bbox = transform_bbox(bbox, query_args['bbox_crs'], query_args['crs']) | ||
|
|
||
| bbox = transform_bbox(bbox, query_args['bbox-crs'], | ||
| query_args['crs'], True) |
There was a problem hiding this comment.
| query_args['crs'], True) | |
| query_args['crs'], always_xy=True) |
Might be worth keeping this as a keyword argument to maintain clarity about what is happening here
| 'http://www.opengis.net/def/crs/EPSG/0/4326': 'EPSG:4326', | ||
| 'http://www.opengis.net/def/crs/EPSG/0/3857': 'EPSG:3857' | ||
| 'http://www.opengis.net/def/crs/EPSG/0/3857': 'EPSG:3857', | ||
| 'http://www.opengis.net/def/crs/OGC/1.3/CRS84': 'urn:ogc:def:crs:OGC:1.3:CRS84' # noqa |
There was a problem hiding this comment.
I get an error when I try to use a URN for WMS. The error says the CRS should be in the format AUTHORITY:CODE
|
@webb-ben Thanks a lot for the quick review! 👍🏽 Those are all great comments, addressed in my latest commits. |
There was a problem hiding this comment.
+1. Wonder if we could just draw the image with default bbox on the map once for those lower zooms. Starts to become a whole hack though.
diff --git a/pygeoapi/templates/collections/collection.html b/pygeoapi/templates/collections/collection.html
index 1d522c3..887eebe 100644
--- a/pygeoapi/templates/collections/collection.html
+++ b/pygeoapi/templates/collections/collection.html
@@ -169,6 +169,7 @@
var clampedBounds = L.latLngBounds(clampedSw, clampedNe);
var ogcapi_layer = null;
+ var image_layer = null;
{# if this collection has a map representation, add it to the map #}
{% for link in data['links'] %}
@@ -179,12 +180,12 @@
"transparent": true,
"bounds": clampedBounds
});
+ image_layer = L.imageOverlay("{{ link['href'] }}", clampedBounds, {opacity: 0.7, transparent: true});
bbox_layer.setStyle({
fillOpacity: 0
});
{% endif %}
{% endfor %}
-
// Check bounds and toggle the visibility of the imageOverlay, accordingly
function toggleOverlayVisibility() {
@@ -199,9 +200,9 @@
var isWithinBounds = (viewWidth <= 360) && (centerLng >= -180 && centerLng <= 180);
if (isWithinBounds) {
- if (!map.hasLayer(ogcapi_layer)) map.addLayer(ogcapi_layer);
+ if (!map.hasLayer(ogcapi_layer)) map.addLayer(ogcapi_layer); map.removeLayer(image_layer);
} else {
- if (map.hasLayer(ogcapi_layer)) map.removeLayer(ogcapi_layer);
+ if (map.hasLayer(ogcapi_layer)) map.removeLayer(ogcapi_layer); map.addLayer(image_layer);
}
}
}


Overview
This PR also addresses a current issue with the map preview on the collection page, which affects the demo server.
Additional information
In the collection page, we only show the preview map when the view is within the limits of the crs:
TODOS:
Dependency policy (RFC2)
Updates to public demo
I created an additional PR here, to add the storage_crs configuration option.
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)