Skip to content

Instantly share code, notes, and snippets.

@mastersigat
Created February 21, 2019 01:06
Show Gist options
  • Save mastersigat/cd9c053a713398839af01515794bb27e to your computer and use it in GitHub Desktop.
Save mastersigat/cd9c053a713398839af01515794bb27e to your computer and use it in GitHub Desktop.
#Leaflet / fonds carte d'une base militaire
license: mit
<html>
<head>
<title>A Leaflet map!</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map {width: 90%; height:600px; margin: auto; }
</style>
</head>
<body>
<div id="map"></div>
<script>
//Appel et configuration carte
var map = L.map('map', {
center: [48.303, -4.509],
zoom: 15 });
// Ajout fonds de carte (tile et WMS)
var baselayers = {
// Services de tuiles
OSM: L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'),
GOOGLE: L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}'),
ESRI: L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'),
IGN: L.tileLayer('https://wxs.ign.fr/{apikey}/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE={style}&TILEMATRIXSET=PM&FORMAT={format}&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}'),
// WMS
Ancien:L.tileLayer.wms('http://geobretagne.fr/geoserver/photo/wms?', {layers: 'satellite-ancien'})
};baselayers.OSM.addTo(map);
// Selecteur fonds de carte
L.control.layers(baselayers, {position: 'topright', collapsed: false, autoZIndex: true}).addTo(map);
// Echelle cartographique
L.control.scale().addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment