quick-refactor #2
4 changed files with 135 additions and 137 deletions
124
WMS choose.htm
124
WMS choose.htm
|
@ -1,124 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<base target="_top">
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
|
|
||||||
<title>Layers Control Tutorial - Leaflet</title>
|
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
|
|
||||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.leaflet-container {
|
|
||||||
height: 400px;
|
|
||||||
width: 600px;
|
|
||||||
max-width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
background-color: white;
|
|
||||||
outline:auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="sliderBox">
|
|
||||||
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">
|
|
||||||
<span id ="sliderOutput"></span>
|
|
||||||
<div id="scaleOutput"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id='map'></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const cities = L.layerGroup();
|
|
||||||
const mLittleton = L.marker([39.61, -105.02]).bindPopup('This is Littleton, CO.').addTo(cities);
|
|
||||||
const mDenver = L.marker([39.74, -104.99]).bindPopup('This is Denver, CO.').addTo(cities);
|
|
||||||
const mAurora = L.marker([39.73, -104.8]).bindPopup('This is Aurora, CO.').addTo(cities);
|
|
||||||
const mGolden = L.marker([39.77, -105.23]).bindPopup('This is Golden, CO.').addTo(cities);
|
|
||||||
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 19,
|
|
||||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
||||||
});
|
|
||||||
|
|
||||||
const osmHOT = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
|
|
||||||
maxZoom: 19,
|
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
|
|
||||||
});
|
|
||||||
|
|
||||||
const map = L.map('map', {
|
|
||||||
center: [48.1214044, -1.7109459],
|
|
||||||
zoom: 17,
|
|
||||||
layers: [osm, cities]
|
|
||||||
});
|
|
||||||
|
|
||||||
const baseLayers = {
|
|
||||||
'OpenStreetMap': osm,
|
|
||||||
'OpenStreetMap.HOT': osmHOT
|
|
||||||
};
|
|
||||||
|
|
||||||
const overlays = {
|
|
||||||
'Cities': cities
|
|
||||||
};
|
|
||||||
|
|
||||||
const layerControl = L.control.layers(baseLayers, overlays).addTo(map);
|
|
||||||
|
|
||||||
|
|
||||||
const crownHill = L.marker([39.75, -105.09]).bindPopup('This is Crown Hill Park.');
|
|
||||||
const rubyHill = L.marker([39.68, -105.00]).bindPopup('This is Ruby Hill Park.');
|
|
||||||
|
|
||||||
const parks = L.layerGroup([crownHill, rubyHill]);
|
|
||||||
|
|
||||||
const IGNOrtho = L.tileLayer("https://wxs.ign.fr/essentiels/geoportail/wmts?" +
|
|
||||||
"&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0" +
|
|
||||||
"&STYLE=normal" +
|
|
||||||
"&TILEMATRIXSET=PM" +
|
|
||||||
"&FORMAT=image/jpeg"+
|
|
||||||
"&LAYER=ORTHOIMAGERY.ORTHOPHOTOS"+
|
|
||||||
"&TILEMATRIX={z}" +
|
|
||||||
"&TILEROW={y}" +
|
|
||||||
"&TILECOL={x}",
|
|
||||||
{
|
|
||||||
minZoom : 0,
|
|
||||||
maxZoom : 24,
|
|
||||||
opacity : 0.5,
|
|
||||||
attribution : "IGN-F/Geoportail",
|
|
||||||
tileSize : 256 // les tuiles du Géooportail font 256x256px
|
|
||||||
});
|
|
||||||
layerControl.addOverlay(IGNOrtho, 'IGNORtho');
|
|
||||||
layerControl.addOverlay(parks, 'Parks');
|
|
||||||
|
|
||||||
|
|
||||||
var slider = document.getElementById("myRange");
|
|
||||||
var output = document.getElementById("sliderOutput");
|
|
||||||
output.innerHTML = slider.value;
|
|
||||||
|
|
||||||
slider.oninput = function() {
|
|
||||||
output.innerHTML = this.value;
|
|
||||||
IGNOrtho.setOpacity(this.value/100);
|
|
||||||
}
|
|
||||||
// gestion de l'échelle
|
|
||||||
L.control.scale().addTo(map);
|
|
||||||
|
|
||||||
|
|
||||||
//var y = map.getSize().y / 2;
|
|
||||||
var position = map.getCenter();
|
|
||||||
var widthInMeter = 6378137 * 2 * Math.PI * Math.cos(map.getCenter().lat * Math.PI / 180);
|
|
||||||
var scaleOutput = document.getElementById("scaleOutput");
|
|
||||||
scaleOutput.innerHTML = widthInMeter;
|
|
||||||
map.on('moveend', function(){
|
|
||||||
scaleOutput.innerHTML = 6378137 * 2 * Math.PI * Math.cos(map.getCenter().lat * Math.PI / 180);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
124
WMS-choose.htm
Normal file
124
WMS-choose.htm
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<base target="_top">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>Layers Control Tutorial - Leaflet</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.leaflet-container {
|
||||||
|
height: 400px;
|
||||||
|
width: 600px;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
background-color: white;
|
||||||
|
outline:auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="sliderBox">
|
||||||
|
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">
|
||||||
|
<span id ="sliderOutput"></span>
|
||||||
|
<div id="scaleOutput"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='map'></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const mLittleton = L.marker([39.61, -105.02]).bindPopup('This is Littleton, CO.');
|
||||||
|
const mDenver = L.marker([39.74, -104.99]).bindPopup('This is Denver, CO.');
|
||||||
|
const mAurora = L.marker([39.73, -104.8]).bindPopup('This is Aurora, CO.');
|
||||||
|
const mGolden = L.marker([39.77, -105.23]).bindPopup('This is Golden, CO.');
|
||||||
|
const crownHill = L.marker([39.75, -105.09]).bindPopup('This is Crown Hill Park.');
|
||||||
|
const rubyHill = L.marker([39.68, -105.00]).bindPopup('This is Ruby Hill Park.');
|
||||||
|
|
||||||
|
const cities = L.layerGroup([
|
||||||
|
mLittleton,
|
||||||
|
mDenver,
|
||||||
|
mAurora,
|
||||||
|
mGolden
|
||||||
|
]);
|
||||||
|
const parks = L.layerGroup([
|
||||||
|
crownHill,
|
||||||
|
rubyHill
|
||||||
|
]);
|
||||||
|
|
||||||
|
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||||
|
});
|
||||||
|
const osmHOT = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>'
|
||||||
|
});
|
||||||
|
const IGNOrtho = L.tileLayer("https://wxs.ign.fr/essentiels/geoportail/wmts?" +
|
||||||
|
"&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0" +
|
||||||
|
"&STYLE=normal" +
|
||||||
|
"&TILEMATRIXSET=PM" +
|
||||||
|
"&FORMAT=image/jpeg"+
|
||||||
|
"&LAYER=ORTHOIMAGERY.ORTHOPHOTOS"+
|
||||||
|
"&TILEMATRIX={z}" +
|
||||||
|
"&TILEROW={y}" +
|
||||||
|
"&TILECOL={x}",
|
||||||
|
{
|
||||||
|
minZoom : 0,
|
||||||
|
maxZoom : 24,
|
||||||
|
opacity : 0.5,
|
||||||
|
attribution : "IGN-F/Geoportail",
|
||||||
|
tileSize : 256 // les tuiles du Géooportail font 256x256px
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const baseLayers = {
|
||||||
|
'OpenStreetMap': osm,
|
||||||
|
'OpenStreetMap.HOT': osmHOT
|
||||||
|
};
|
||||||
|
|
||||||
|
const overlays = {
|
||||||
|
'Cities': cities,
|
||||||
|
'IGNOrtho': IGNOrtho,
|
||||||
|
'Parks': parks
|
||||||
|
};
|
||||||
|
|
||||||
|
const map = L.map('map', {
|
||||||
|
center: [48.1214044, -1.7109459],
|
||||||
|
zoom: 17,
|
||||||
|
layers: [
|
||||||
|
osm
|
||||||
|
]
|
||||||
|
});
|
||||||
|
const layerControl = L.control.layers(baseLayers, overlays).addTo(map);
|
||||||
|
|
||||||
|
var slider = document.getElementById("myRange");
|
||||||
|
var output = document.getElementById("sliderOutput");
|
||||||
|
output.innerHTML = slider.value;
|
||||||
|
|
||||||
|
slider.oninput = function() {
|
||||||
|
output.innerHTML = this.value;
|
||||||
|
IGNOrtho.setOpacity(this.value/100);
|
||||||
|
}
|
||||||
|
// gestion de l'échelle
|
||||||
|
L.control.scale().addTo(map);
|
||||||
|
|
||||||
|
//var y = map.getSize().y / 2;
|
||||||
|
const widthInMeter = 6378137 * 2 * Math.PI * Math.cos(map.getCenter().lat * Math.PI / 180);
|
||||||
|
var scaleOutput = document.getElementById("scaleOutput");
|
||||||
|
scaleOutput.innerHTML = widthInMeter;
|
||||||
|
map.on('moveend', function(){
|
||||||
|
scaleOutput.innerHTML = widthInMeter;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,13 +0,0 @@
|
||||||
- script téléchargement photo aérienne IGN:
|
|
||||||
https://geotribu.fr/articles/2023/2023-03-22_images_aeriennes_historiques/#un-environnement-de-travail-configenv
|
|
||||||
|
|
||||||
- projections cartographique ( plutôt travailler en CC9zones): https://github.com/kartena/Proj4Leaflet
|
|
||||||
|
|
||||||
- geotiff:
|
|
||||||
georaster-layer-for-leaflet: https://github.com/geotiff/georaster-layer-for-leaflet
|
|
||||||
https://geotiff.github.io/georaster-layer-for-leaflet-example/examples/load-file.html
|
|
||||||
|
|
||||||
- mode d'affichage des wms why not: https://leaflet-extras.github.io/leaflet-providers/preview/
|
|
||||||
|
|
||||||
- dessin vectoriel: geoman: https://github.com/geoman-io/leaflet-geoman
|
|
||||||
|
|
11
plugins-interessants.md
Normal file
11
plugins-interessants.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Plugins intéressants
|
||||||
|
|
||||||
|
- [script téléchargement photo aérienne IGN](https://geotribu.fr/articles/2023/2023-03-22_images_aeriennes_historiques/#un-environnement-de-travail-configenv)
|
||||||
|
- projections cartographique ( plutôt travailler en CC9zones):
|
||||||
|
- [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet)
|
||||||
|
- [georaster-layer-for-leaflet](https://github.com/geotiff/georaster-layer-for-leaflet)
|
||||||
|
- [examples](https://geotiff.github.io/georaster-layer-for-leaflet-example/examples/load-file.html)
|
||||||
|
- [preview de certaines maps de *leaflet-providers*](https://leaflet-extras.github.io/leaflet-providers/preview/)
|
||||||
|
- dessin vectoriel:
|
||||||
|
- [geoman](https://github.com/geoman-io/leaflet-geoman)
|
||||||
|
|
Loading…
Reference in a new issue