diff --git a/docs/changelog.rst b/docs/changelog.rst index 31ae033fff..ca56375ed1 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -22,6 +22,12 @@ CHANGELOG - Improve documentation for database restore - Improve documentation aboute suricate's workflow (#3070) +- Update layer section for maps since IGN updates + +**Maintenance** + +- Update ``check_ign_keys`` script to match new IGN urls +- Update ``base.py`` configuration for layers **Bug fixes** diff --git a/docs/install/advanced-configuration.rst b/docs/install/advanced-configuration.rst index 62bc814712..bbe4086754 100644 --- a/docs/install/advanced-configuration.rst +++ b/docs/install/advanced-configuration.rst @@ -173,25 +173,7 @@ Map settings Change or add WMTS tiles layers (IGN, OSM, Mapbox…) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -By default, you have 2 basemaps layers in your Geotrek-admin (OSM and OSM black and white): - -.. code-block :: python - - LEAFLET_CONFIG['TILES'] = [ - ('Scan', '//wxs.ign.fr//wmts?LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - '© IGN - GeoPortail'), - ('Ortho', '//wxs.ign.fr//wmts?LAYER=ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - '© IGN - GeoPortail'), - ('Cadastre', '//wxs.ign.fr//wmts?LAYER=CADASTRALPARCELS.PARCELS&EXCEPTIONS=image/jpeg&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - '© IGN - GeoPortail'), - ('OSM', 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', '© OSM contributors'), - ] - - LEAFLET_CONFIG['OVERLAYS'] = [ - ('Cadastre', - '//wxs.ign.fr//wmts?LAYER=CADASTRALPARCELS.PARCELS&EXCEPTIONS=text/xml&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=bdparcellaire_o&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', - '© IGN - GeoPortail'), - ] +By default, you have 2 basemaps layers in your Geotrek-admin (OSM and OpenTopoMap) You can change or add more basemaps layers like this: @@ -213,17 +195,72 @@ Example with IGN and OSM basemaps: .. code-block :: python LEAFLET_CONFIG['TILES'] = [ - ('IGN Scan', '//wxs.ign.fr/YOURAPIKEY/wmts?LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', '© IGN Geoportail'), - ('IGN Plan V2', '//wxs.ign.fr/essentiels/geoportail/wmts?LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&EXCEPTIONS=image/png&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', '© IGN Geoportail'), - ('IGN Ortho', '//wxs.ign.fr/essentiels/geoportail/wmts?LAYER=ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=image/jpeg&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', '© IGN Geoportail'), - ('IGN Cadastre', '//wxs.ign.fr/essentiels/geoportail/wmts?LAYER=CADASTRALPARCELS.PARCELLAIRE_EXPRESS&EXCEPTIONS=image/jpeg&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=bdparcellaire_o&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', '© IGN Geoportail'), - ('OSM', 'https//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', '© OpenStreetMap contributors'), - ('OSM Stamen Terrain', '//tile.stamen.com/terrain/{z}/{x}/{y}.jpg', '© OpenStreetMap contributors / Stamen Design'), - ('OpenTopoMap', 'https//a.tile.opentopomap.org/{z}/{x}/{y}.png', 'Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)') + ( + 'IGN Plan V2', + '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', + { + 'attribution': 'Plan IGNV2 - Carte © IGN/Geoportail', + 'maxNativeZoom': 16, + 'maxZoom': 22 + } + ), + ( + 'IGN Orthophotos', + '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', + { + 'attribution': 'Orthophotos - Carte © IGN/Geoportail', + 'maxNativeZoom': 19, + 'maxZoom': 22 + } + ), + ( + 'OpenStreetMap', + '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + { + 'attribution': '© Contributeurs d\'OpenStreetMap', + 'maxNativeZoom': 19, + 'maxZoom': 22 + } + ), + ( + 'OpenTopoMap', + '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png', + { + 'attribution': 'map data: © OpenStreetMap contributors, SRTM | map style: © OpenTopoMap (CC-BY-SA)', + 'maxNativeZoom': 17, + 'maxZoom': 22 + } + ), + ( + 'IGN Scan 25', + '//data.geopf.fr/private/wmts?apikey=ign_scan_ws&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', + { + 'attribution': 'Plan Scan 25 Touristique - Carte © IGN/Geoportail', + 'maxNativeZoom': 17, + 'maxZoom': 22 + } + ), ] To use some IGN Geoportail WMTS tiles (Scan25, Scan100, etc.), you may need an API key. You can find more information about this on https://geoservices.ign.fr/services-web-issus-des-scans-ign. +You can also configure overlays layers like this : + +.. code-block :: python + + LEAFLET_CONFIG['OVERLAYS'] = [ + ( + 'IGN Cadastre', + '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=CADASTRALPARCELS.PARCELLAIRE_EXPRESS&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', + { + 'attribution': 'Cadastre - Carte © IGN/Geoportail', + 'maxNativeZoom': 19, + 'maxZoom': 22 + } + ), + ] + + Map layers zoom ~~~~~~~~~~~~~~~ diff --git a/geotrek/common/tests/__init__.py b/geotrek/common/tests/__init__.py index dcaa36522a..4019fff7d6 100644 --- a/geotrek/common/tests/__init__.py +++ b/geotrek/common/tests/__init__.py @@ -150,8 +150,8 @@ def test_structure_is_set(self): obj = self.model.objects.last() self.assertEqual(obj.structure, self.user.profile.structure) - @override_settings(FORCED_LAYERS=[('OSM', [(42, 100000), (43.87017822557581, 7.506408691406249), - (43.90185050527358, 7.555847167968749), (42, 100000)])]) + @override_settings(FORCED_LAYERS=[('OpenStreetMap', [(42, 100000), (43.87017822557581, 7.506408691406249), + (43.90185050527358, 7.555847167968749), (42, 100000)])]) def test_forced_layers(self): if self.model is None: return # Abstract test should not run diff --git a/geotrek/settings/base.py b/geotrek/settings/base.py index 14fde455d4..e3291ca1bc 100644 --- a/geotrek/settings/base.py +++ b/geotrek/settings/base.py @@ -447,10 +447,24 @@ def api_bbox(bbox, buffer): LEAFLET_CONFIG = { 'SRID': 3857, 'TILES': [ - ('OpenTopoMap', 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', - {'attribution': 'Données: © Contributeurs OpenStreetMap, SRTM | Affichage: © OpenTopoMap (CC-BY-SA)', - 'maxZoom': 17}), - ('OSM', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', '© Contributeurs OpenStreetMap'), + ( + 'OpenTopoMap', + '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png', + { + 'attribution': 'map data: © OpenStreetMap contributors, SRTM | map style: © OpenTopoMap (CC-BY-SA)', + 'maxNativeZoom': 17, + 'maxZoom': 22 + } + ), + ( + 'OpenStreetMap', + '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + { + 'attribution': '© Contributeurs d\'OpenStreetMap', + 'maxNativeZoom': 19, + 'maxZoom': 22 + } + ) ], 'TILES_EXTENT': SPATIAL_EXTENT, # Extent in API projection (Leaflet view default extent) diff --git a/tools/check_ign_key.sh b/tools/check_ign_key.sh index 9f5e251a0f..6020b4bdad 100755 --- a/tools/check_ign_key.sh +++ b/tools/check_ign_key.sh @@ -8,21 +8,14 @@ if test -z "$referer" -o -z "$key"; then exit 1 fi -layers_jpeg="GEOGRAPHICALGRIDSYSTEMS.MAPS GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR ORTHOIMAGERY.ORTHOPHOTOS" -layers_png="CADASTRALPARCELS.PARCELS" +layers_jpeg="GEOGRAPHICALGRIDSYSTEMS.MAPS GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN25TOUR SCAN100_PYR-JPEG_WLD_WM_WMTS_3D" echo '------------------------------------------------------------' echo GetCapabilities -curl -s -I --header "Referer: $referer" "http://wxs.ign.fr/$key/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities" | head -n 1 +curl -s -I --header "Referer: $referer" "https://data.geopf.fr/private/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities&apikey=$key" | head -n 1 for layer in $layers_jpeg; do echo '------------------------------------------------------------' echo $layer - curl -s -I --header "Referer: $referer" "https://wxs.ign.fr/$key/wmts?LAYER=$layer&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX=12&TILEROW=1478&TILECOL=2112" | head -n 1 -done; - -for layer in $layers_png; do - echo '------------------------------------------------------------' - echo $layer - curl -s -I --header "Referer: $referer" "https://wxs.ign.fr/$key/wmts?LAYER=$layer&EXCEPTIONS=text/xml&FORMAT=image/png&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX=12&TILEROW=1478&TILECOL=2112" | head -n 1 + curl -s -I --header "Referer: $referer" "https://data.geopf.fr/private/wmts?apikey=$key&LAYER=$layer&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX=12&TILEROW=1478&TILECOL=2112" | head -n 1 done;