手绘图过大,瓦片处理

l
Tuzki 2 years ago
parent 09d6a53501
commit 0574f71649
  1. 34
      src/main/webapp/html/back/ybsjMap/ybsjMap.html

@ -151,6 +151,16 @@
new AMap.LngLat(swlonlat.lng, swlonlat.lat), new AMap.LngLat(nelonlat.lng, nelonlat.lat)),
zooms : [ min_maplevel, max_maplevel ]
});
var tilerLayer = new AMap.TileLayer({
zIndex:10,
// getTileUrl:'tiles/[z]/tile-[x]_[y].png',
getTileUrl: function(x,y,z){
console.log('https://www.lbgjtoa.com/appImg/tiles/' + z + '/tile-' + x +'_' + y + '.png')
return 'https://www.lbgjtoa.com/appImg/tiles/' + z + '/' + x +'_' + y + '.png'
}
});
map = new AMap.Map("myMap", {
//resizeEnable: true, //是否监控地图容器尺寸变化
center : [ slonslat.lng, slonslat.lat ], //初始地图中心点
@ -158,7 +168,8 @@
//zoomEnable:false
layers : [
new AMap.TileLayer(),
imageLayer
// imageLayer
tilerLayer
]
});
map.plugin('AMap.Geolocation', function () {
@ -183,12 +194,31 @@
});
foundMarker(data);
map.setZoom(start_maplevel)
map.set(imageLayer)
// map.set(imageLayer)
}
});
}
function lockMapBounds(){
var bounds = map.getBounds();
map.setLimitBounds(bounds);
logMapInfo();
};
function logMapInfo() {
var limitBounds = map.getLimitBounds();
if (limitBounds) {
document.querySelector("#ne").innerText = limitBounds.northeast.toString();
document.querySelector("#sw").innerText = limitBounds.southwest.toString();
} else {
document.querySelector("#ne").innerText = document.querySelector("#sw").innerText = "未限定";
}
};
//启用地图范围限定
lockMapBounds();
logMapInfo();
//初始化类型
function spotType() {

Loading…
Cancel
Save