Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
/ geoportail-leaflet Public archive

[DEV] Exemple minimal d'intégration des couches géoportail dans leafet.

Notifications You must be signed in to change notification settings

mborne/geoportail-leaflet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

geoportail-leaflet

Description

Exemple minimal d'intégration des couches géoportail dans leafet : minimal.html.

Principe

  • Générer une URL fonctionnellement équivalente à une URL TMS (ex : https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png) :
/**
 * Renvoie l'URL de la couche geoportail
 */
function getGeoportalURL(layerName) {
    var url = "https://wxs.ign.fr/";
    url += GEOPORTAL_API_KEY;
    url += "/geoportail/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile";
    url += "&LAYER=" + layerName;
    url += "&STYLE=normal&FORMAT=image/png";
    url += "&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}";
    return url;
}
  • S'appuyer sur cette méthode pour créer des couches leaflet :
var layerPlanIgn = L.tileLayer(
    getGeoportalURL("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2"),
    {
        attribution: '&copy; <a href="https://www.ign.fr/">IGN</a>',
        maxZoom: 19
    }
);
layerPlanIgn.addTo(map);

Voir aussi

About

[DEV] Exemple minimal d'intégration des couches géoportail dans leafet.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published