Skip to content

Commit

Permalink
Merge pull request #3840 from GeotrekCE/update_ign
Browse files Browse the repository at this point in the history
Update documentation to match changes of IGN
  • Loading branch information
Chatewgne authored Jan 4, 2024
2 parents 3bebc89 + cfc8f5b commit 67667a9
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 42 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
89 changes: 63 additions & 26 deletions docs/install/advanced-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/<key>/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}',
'&copy; IGN - GeoPortail'),
('Ortho', '//wxs.ign.fr/<key>/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}',
'&copy; IGN - GeoPortail'),
('Cadastre', '//wxs.ign.fr/<key>/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}',
'&copy; IGN - GeoPortail'),
('OSM', 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', '&copy; OSM contributors'),
]
LEAFLET_CONFIG['OVERLAYS'] = [
('Cadastre',
'//wxs.ign.fr/<key>/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}',
'&copy; 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:

Expand All @@ -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': '&copy; <a href="https://www.openstreetmap.org/copyright">Contributeurs d\'OpenStreetMap</a>',
'maxNativeZoom': 19,
'maxZoom': 22
}
),
(
'OpenTopoMap',
'//{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
{
'attribution': 'map data: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)',
'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
~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions geotrek/common/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 18 additions & 4 deletions geotrek/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)',
'maxNativeZoom': 17,
'maxZoom': 22
}
),
(
'OpenStreetMap',
'//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
'attribution': '&copy; <a href="https://www.openstreetmap.org/copyright">Contributeurs d\'OpenStreetMap</a>',
'maxNativeZoom': 19,
'maxZoom': 22
}
)
],
'TILES_EXTENT': SPATIAL_EXTENT,
# Extent in API projection (Leaflet view default extent)
Expand Down
13 changes: 3 additions & 10 deletions tools/check_ign_key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 67667a9

Please sign in to comment.