API de mapa de folletos con capa satelital de Google
-
29-10-2019 - |
Pregunta
Estoy muy interesado en el API de mapa de folleto.
Sin embargo, necesito poder usar la capa satelital de Google. No he podido encontrar un ejemplo sobre cómo agregar una capa satelital de Google al folleto. Entiendo que aún necesitaré cargar la API de Google Maps para hacer esto (OpenLayers tiene un ejemplo).
Solución
Follet tiene una página oficial para publicar todos los complementos disponibles: http://leafletjs.com/plugins.html
Encontrará complementos allí para agregar el soporte de las capas de Google al folleto.
Otros consejos
No necesita un complemento o la API de Google, puede agregarlo como una capa de mosaico XYZ.
Calles
googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
Híbrido:
googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
Satélite:
googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
Terreno
googleTerrain = L.tileLayer('http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
Note the difference in the "lyrs" parameter in the URL:
Hybrid: s,h;
Satellite: s;
Streets: m;
Terrain: p;
Hay un complemento de terceros para él: Demo: http://psha.org.ru/leaflet/bel.html (Cambie a Google Maps con el conmutador) Fuente: http://psha.org.ru/leaflet/google.js
Este repositorio contiene pocas capas de mosaicos Google y otros y otros complementos muy útiles:https://github.com/shramov/leaflet-plugins
Capa de título de Google con Tráfico
var googleTraffic = L.tileLayer('https://{s}.google.com/vt/lyrs=m@221097413,traffic&x={x}&y={y}&z={z}', {
maxZoom: 20,
minZoom: 2,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
});
Por favor vea su Términos generales
Espero que alguien ayude a esto
Alternativa a la API de Google Maps para la capa satelital: Folletos.js con fichas de imágenes de Esri World
<script>
var map = L.map('map').setView([-41.2858, 174.78682], 14);
var mapLink = '<a href="http://www.esri.com/">Esri</a>';
var wholink = 'i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community';
L.tileLayer(
'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: '© '+mapLink+', '+wholink,
maxZoom: 18,
}).addTo(map);
</script>