google-maps-api-3 - 带有 Google 卫星图层的 Leaflet Map API

标签 google-maps-api-3 satellite leaflet

我对 Leaflet Map API 非常感兴趣.

但是,我需要能够使用 Google Satellite Layer。我无法找到有关如何将 Google 卫星图层添加到 Leaflet 的示例。我知道我仍然需要加载 Google Maps API 才能执行此操作(OpenLayers 有一个示例)。

最佳答案

您不需要插件或 Google API,您可以将其添加为 XYZ 图 block 图层。

街道

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']
});

请注意 URL 中“lyrs”参数的差异:

Hybrid: s,h;
Satellite: s;
Streets: m;
Terrain: p;

关于google-maps-api-3 - 带有 Google 卫星图层的 Leaflet Map API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9394190/

相关文章:

javascript - 从 SQLite PHP 转换数据

javascript - 如何执行更新 json 源的函数

javascript - 我的 map 上没有获取 infoWindow

javascript - Google Maps API V3 中的 API key 有什么用?

php - TSP(旅行商问题)求解器使用 GoogleMap

python - 嗨,我正在使用 Python 为 GOES16 Air Mass 产品制作 RGB 图像,我像这样提取感兴趣范围的信息

android - 从 Location 对象获取卫星数量

python - 在Python中将XYZ坐标转换为经度/纬度

ios - Google Map nearby API 在 ios 中不工作

r - 在 r 中更好地控制传单弹出窗口