一、创建地图实例
// 地图
var map = new AMap.Map('js_map', {
zoom: 16,
center: [116.969942, 31.986335],
features: ['bg']
});
二、加载google地图切片层
new AMap.TileLayer({
map: map,
tileUrl: 'https://mt.google.cn/vt/lyrs=y@142&hl=en&gl=cn&x=[x]&y=[y]&z=[z]&s=Galil', // s=Galil不加也能渲染
zIndex: 2 // 在默认层级之上
});
注意:google卫星图服务2021年开始就不能用了
可以换成ArcGis瓦片图,修改如下:
new AMap.TileLayer({
map: map,
tileUrl: 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunityENG/MapServer/tile/[z]/[y]/[x]', // 英文
// tileUrl: 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/tile/[z]/[y]/[x]', // 中文
zIndex: 2 // 在默认层级之上
});
限界符:高德识别的是
[]
,leaflet是{}
高德地图API:https://lbs.amap.com/api/javascript-api/reference/map
各参数说明:
1、地址可使用的有
- https://mt{1,2,3,0}.google.cn {x,y,z,s}
- https://mt.google.cn
- https://mt1.google.cn
- https://mt2.google.cn
- https://mt3.google.cn
2、lyrs图层类型
- m:路线图
- t:地形图
- p:带标签的地形图
- s:卫星图
- y:带标签的卫星图
- h:标签层(路名、地名等)
3、h1语言可选参数
- zh-CN:中文
- en:中英
三、其他图层
{
'Google': {
'影像': 'https://mt{0,1,2,3}.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
'街道': 'https://mt{0,1,2,3}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
'影像带标注': 'https://mt{0,1,2,3}.google.cn/vt/lyrs=y&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}',
'地形带标注': 'https://mt{0,1,2,3}.google.cn/vt/lyrs=p&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}'
},
'高德': {
'影像': 'https://webst0{1,2,3,4}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'街道': 'https://webst0{1,2,3,4}.is.autonavi.com/appmaptile?style=7&x={x}&y={y}&z={z}',
},
'GeoQ': {
'基础': 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}',
'魅蓝': 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}',
'暖色': 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}',
'灰色': 'https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetGray/MapServer/tile/{z}/{y}/{x}'
},
'OSM': {
'街道': 'https://{a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}
}
高德新规则:https://www.cnblogs.com/nodegis/p/11206642.html
参考链接: