美文网首页
leaflet加载google.cn底图

leaflet加载google.cn底图

作者: 路上行人__ | 来源:发表于2017-07-10 10:31 被阅读0次

非常简单 只需要在生成图层的时候拼上参数就行

直接上代码:


//重点就是tileLayer的第一个参数设置
var layer = L.tileLayer('http://mt0.google.cn/vt/lyrs=m@160000000&hl=zh-CN&gl=CN&src=app&y={y}&x={x}&z={z}&s=Ga', {
    attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
});

var map = L.map('allmap',{
  minZoom: 4,
  maxZoom: 13
}).setView([48.505, 3.09], 13);

L.control.scale({'position':'bottomleft','metric':true,'imperial':false}).addTo(map);

map.addLayer(layer);

效果如下图

这里写图片描述

相关文章

网友评论

      本文标题:leaflet加载google.cn底图

      本文链接:https://www.haomeiwen.com/subject/ejaxqxtx.html