Skip to content

Commit

Permalink
Update documentation and confniguratio to match new IGN requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Potiron committed Dec 1, 2023
1 parent 1aa50fa commit ad4da05
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 40 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ CHANGELOG
**Documentation**

- Improve documentation for database restore
- Update layer section for maps since IGN updates

**Maintenance**

- Update check_ign_keys script to match new IGN urls
- Update base.py configuratio for layers


2.101.4 (2023-11-15)
Expand Down
98 changes: 72 additions & 26 deletions docs/install/advanced-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,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 @@ -212,17 +194,81 @@ 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': 19,
'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
}
),
(
'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
}
),
(
'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': 19,
'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
22 changes: 18 additions & 4 deletions geotrek/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,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'),
(
'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
}
)
],
'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 ad4da05

Please sign in to comment.