我对Leaflet Map API很感兴趣。带Google卫星图层的传单地图API
但是,我需要能够使用谷歌卫星层。我一直无法找到如何将Google卫星图层添加到Leaflet的示例。我知道我仍然需要加载Google Maps API才能做到这一点(OpenLayers有一个例子)。
我对Leaflet Map API很感兴趣。带Google卫星图层的传单地图API
但是,我需要能够使用谷歌卫星层。我一直无法找到如何将Google卫星图层添加到Leaflet的示例。我知道我仍然需要加载Google Maps API才能做到这一点(OpenLayers有一个例子)。
传单有一个官方页面发布所有可用的插件:http://leafletjs.com/plugins.html
你会发现有插件添加谷歌层支持传单。
有它一个第三方插件: 演示:http://psha.org.ru/leaflet/bel.html(交换机与交换机谷歌地图) 来源:http://psha.org.ru/leaflet/Google.js
这个库包含几个板块层谷歌和其他非常有用的其他插件: https://github.com/shramov/leaflet-plugins
您不需要插件或Google API,可以将其添加为XYZ切片图层。
街道
googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
混合型:
googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
卫星:
googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
地形
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;
对于Leaflet 1.0使用:https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant – user2666194 2017-06-22 15:24:54