From d8c2d360e9553fbc31fd06d4f0a4c6731bceb11d Mon Sep 17 00:00:00 2001 From: Olivier Maury <Olivier.Maury@inrae.fr> Date: Wed, 8 Nov 2023 09:12:24 +0100 Subject: [PATCH] =?UTF-8?q?Migrer=20les=20couches=20IGN=20vers=20G=C3=A9op?= =?UTF-8?q?lateforme.=20fixes=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../www/client/ui/map/TileSuppliers.java | 45 +++++++------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java index c1a9f7b..fa5a045 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java @@ -23,7 +23,7 @@ import ol.tilegrid.WmtsTileGridOptions; /** * Helper methods to construct various tiles for OpenLayers. * - * Service list for IGN : https://geoservices.ign.fr/documentation/services + * Service list for IGN : https://geoservices.ign.fr/services-geoplateforme * * @author Olivier Maury * @author Louis Tromel @@ -34,7 +34,6 @@ public abstract class TileSuppliers { * Base infos to create an IGN layer. * * @author ltromel - * */ private static class IgnWmtsLayer { @@ -59,7 +58,7 @@ public abstract class TileSuppliers { private String style = "normal"; /** - * Layer name displayed in tempo. + * Layer name displayed on map. */ private String title; @@ -68,11 +67,6 @@ public abstract class TileSuppliers { */ private String type = "base"; - /** - * URL requested (contains the key). - */ - private String url; - /** * @return the attributions */ @@ -115,13 +109,6 @@ public abstract class TileSuppliers { return type; } - /** - * @return the url - */ - String getUrl() { - return url; - } - /** * @param values the attributions to set */ @@ -164,15 +151,13 @@ public abstract class TileSuppliers { type = layerType; } - /** - * @param layerUrl the url to set - */ - void setUrl(final String layerUrl) { - url = layerUrl; - } - } + /** + * Attributions attribute. + */ + private static final String ATTRIBUTIONS = "layer-attributions"; + /** * I18n constants. */ @@ -193,10 +178,9 @@ public abstract class TileSuppliers { */ public static Base createIgnAdministrativeLimits() { final IgnWmtsLayer wmts = new IgnWmtsLayer(); - wmts.setLayer("ADMINEXPRESS-COG-CARTO.LATEST"); + wmts.setLayer("ADMINEXPRESS-COG.LATEST"); wmts.setTitle(CSTS.ignAdministrativeLimits()); wmts.setType(""); - wmts.setUrl("https://wxs.ign.fr/administratif/geoportail/wmts"); wmts.setAttributions(" - " + CSTS.ignOverlayAttributions()); return createIgnWmtsLayer(wmts); } @@ -210,7 +194,6 @@ public abstract class TileSuppliers { wmts.setTitle(CSTS.ignAerial()); wmts.setAttributions(CSTS.ignAerialAttributions()); wmts.setFormat("image/jpeg"); - wmts.setUrl("https://wxs.ign.fr/ortho/geoportail/wmts"); return createIgnWmtsLayer(wmts); } @@ -221,7 +204,6 @@ public abstract class TileSuppliers { wmts.setAttributions(" - " + CSTS.ignOverlayAttributions()); wmts.setType(""); wmts.setStyle("normal"); - wmts.setUrl("https://wxs.ign.fr/agriculture/geoportail/wmts"); return createIgnWmtsLayer(wmts); } @@ -233,7 +215,6 @@ public abstract class TileSuppliers { wmts.setLayer("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2"); wmts.setTitle(CSTS.ignInternationalMap()); wmts.setAttributions(CSTS.ignInternationalMapAttributions()); - wmts.setUrl("https://wxs.ign.fr/cartes/geoportail/wmts"); return createIgnWmtsLayer(wmts); } @@ -244,12 +225,11 @@ public abstract class TileSuppliers { wmts.setAttributions(" - " + CSTS.ignOverlayAttributions()); wmts.setType(""); wmts.setStyle("estompage_grayscale"); - wmts.setUrl("https://wxs.ign.fr/altimetrie/geoportail/wmts"); return createIgnWmtsLayer(wmts); } /** - * See https://geoservices.ign.fr/services-web-decouverte . + * See https://geoservices.ign.fr/services-geoplateforme-diffusion . * * @param wmts basic caracteristics to generate an IGN served layer * @return base layer @@ -257,7 +237,7 @@ public abstract class TileSuppliers { private static Base createIgnWmtsLayer(final IgnWmtsLayer wmts) { final Projection projection = Projection.get("EPSG:3857"); final WmtsOptions wmtsOptions = OLFactory.createOptions(); - wmtsOptions.setUrl(wmts.getUrl()); + wmtsOptions.setUrl("https://data.geopf.fr/wmts"); wmtsOptions.setLayer(wmts.getLayer()); wmtsOptions.setFormat(wmts.getFormat()); wmtsOptions.setMatrixSet("PM"); @@ -276,6 +256,7 @@ public abstract class TileSuppliers { wmtsLayer.set(TITLE, wmts.getTitle()); wmtsLayer.set(TYPE, wmts.getType()); wmtsLayer.setVisible(false); + wmtsLayer.set(ATTRIBUTIONS, wmts.getAttributions()); return wmtsLayer; } @@ -287,6 +268,7 @@ public abstract class TileSuppliers { layer.set(TITLE, CSTS.mapBaseLayerEmpty()); layer.set(TYPE, "base"); layer.setVisible(false); + layer.set(ATTRIBUTIONS, "-"); return layer; } @@ -304,6 +286,7 @@ public abstract class TileSuppliers { tile.set(TITLE, "OpenTopoMap"); tile.set(TYPE, "base"); tile.setVisible(false); + tile.set(ATTRIBUTIONS, options.getAttributions()); return tile; } @@ -326,6 +309,7 @@ public abstract class TileSuppliers { final Tile osmLayer = new Tile(osmLayerOptions); osmLayer.set(TITLE, "OpenStreetMap"); osmLayer.set(TYPE, "base"); + osmLayer.set(ATTRIBUTIONS, options.getAttributions()); return osmLayer; } @@ -347,6 +331,7 @@ public abstract class TileSuppliers { tile.set(TITLE, "OpenStreetMap Piano"); tile.set(TYPE, "base"); tile.setVisible(false); + tile.set(ATTRIBUTIONS, options.getAttributions()); return tile; } -- GitLab