-
-
Notifications
You must be signed in to change notification settings - Fork 315
Updates to the OGC API - Maps Support #2308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ad0131e
- Introduced guardrails to ensure we dont go outside the limits of th…
doublebyte1 0202914
- support maps request, even when there are no spatial extents define…
doublebyte1 9da21f5
- removed failing tests in wms_facade provider
doublebyte1 eb5e9bb
- fixed flake8
doublebyte1 3f604ce
- Make sure we only show the map preview, when the view is within bou…
doublebyte1 8200a8e
- updated unit tests for the wms_facade provider
doublebyte1 e9fafd0
- Set input and output coordinates always treated as (x, y) regardles…
doublebyte1 2eccaa0
- Reimplement the logic for default crs and bbox-crs in OAM, accordin…
doublebyte1 8a47ecc
- updated default_crs code in wms_facade provider
doublebyte1 5a53c31
- updated documentation
doublebyte1 5b87efd
- fixed flake8 errors
doublebyte1 9995993
- update crs84 code on wms_facade
doublebyte1 d3bf796
- improve code readability of query arg
doublebyte1 7b359b5
- put back missed transparency arg
doublebyte1 0b0f5f0
- use DEFAULT_CRS from crs.py
doublebyte1 1bab8b2
- added another alias for crs84
doublebyte1 2f9eed4
- put back preview of OAM, in extents greater than the world.
doublebyte1 3a6cf4b
- fixed wms_facade test
doublebyte1 ec0c2d1
- fixed flake8 errors
doublebyte1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,7 @@ <h3>{% trans %}Storage CRS{% endtrans %}</h3> | |
| {% block extrafoot %} | ||
| <script> | ||
| var map = L.map('collection-map').setView([{{ 0 }}, {{ 0 }}], 1); | ||
|
|
||
| map.addLayer(new L.TileLayer( | ||
| '{{ config['server']['map']['url'] }}', { | ||
| maxZoom: 18, | ||
|
|
@@ -154,18 +155,76 @@ <h3>{% trans %}Storage CRS{% endtrans %}</h3> | |
| ['{{ data['extent']['spatial']['bbox'][0][1] }}', '{{ data['extent']['spatial']['bbox'][0][2] }}'] | ||
| ]); | ||
|
|
||
| {# if this collection has a map representation, add it to the map #} | ||
| {% for link in data['links'] %} | ||
| {% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/map' and link['href'] %} | ||
| L.imageOverlay.ogcapi("{{ data['base_url'] }}", {collection: "{{ data['id'] }}", "opacity": .7, "transparent": true}).addTo(map); | ||
| var lbounds = bbox_layer.getBounds(); | ||
|
|
||
| // Make sure that we pass valid coordinates to the imageOverlay | ||
| function clampLat(lat) { | ||
| return Math.max(-85.0511, Math.min(lat, 85.0511)); | ||
| } | ||
|
|
||
| var sw = lbounds.getSouthWest(); | ||
| var ne = lbounds.getNorthEast(); | ||
| var clampedSw = L.latLng(clampLat(sw.lat), sw.lng); | ||
| var clampedNe = L.latLng(clampLat(ne.lat), ne.lng); | ||
| var clampedBounds = L.latLngBounds(clampedSw, clampedNe); | ||
|
|
||
| var ogcapi_layer = null; | ||
| var image_overlay = null; | ||
|
|
||
| {# if this collection has a map representation, add it to the map #} | ||
| {% for link in data['links'] %} | ||
| {% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/map' and link['href'] %} | ||
| ogcapi_layer = L.imageOverlay.ogcapi("{{ data['base_url'] }}", { | ||
| collection: "{{ data['id'] }}", | ||
| "opacity": .7, | ||
| "transparent": true, | ||
| "bounds": clampedBounds | ||
| }); | ||
| image_layer = L.imageOverlay("{{ link['href'] }}", clampedBounds, {opacity: 0.7, transparent: true}); | ||
| bbox_layer.setStyle({ | ||
| fillOpacity: 0 | ||
| }); | ||
| bbox_layer.setStyle({ | ||
| fillOpacity: 0 | ||
| }); | ||
|
Comment on lines
+184
to
189
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplication of the bbox fill |
||
| {% endif %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| // Check bounds and toggle the visibility of the imageOverlay, accordingly | ||
| function toggleOverlayVisibility() { | ||
|
|
||
| if (ogcapi_layer) { | ||
| var currentBounds = map.getBounds(); | ||
| var west = currentBounds.getWest(); | ||
| var east = currentBounds.getEast(); | ||
| var centerLng = map.getCenter().lng; | ||
|
|
||
| var viewWidth = east - west; | ||
|
|
||
| var isWithinBounds = (viewWidth <= 360) && (centerLng >= -180 && centerLng <= 180); | ||
|
|
||
| if (isWithinBounds) { | ||
| if (!map.hasLayer(ogcapi_layer)) { | ||
| map.addLayer(ogcapi_layer); | ||
| } | ||
| map.removeLayer(image_layer); | ||
| } else { | ||
| if (map.hasLayer(ogcapi_layer)) { | ||
| map.removeLayer(ogcapi_layer); | ||
| } | ||
| map.addLayer(image_layer); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| map.on('moveend', toggleOverlayVisibility); | ||
|
|
||
| map.addLayer(bbox_layer); | ||
| map.fitBounds(bbox_layer.getBounds(), {maxZoom: 10}); | ||
|
|
||
| map.fitBounds(clampedBounds, {maxZoom: 10}); | ||
|
|
||
| // Run the initial visibility check | ||
| toggleOverlayVisibility(); | ||
|
|
||
| // Allow to get bbox query parameter of a rectangular area specified by | ||
| // dragging the mouse while pressing the Ctrl key | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep transparency arg parse?