我有我的根函数,绘制地图瓦片如下,有没有一种方法,我可以设置初始缩放基于窗口大小,中心地图在某些位置和限制地图范围?
const renderMap = () => {
window.map = new Microsoft.Maps.Map('#map', {
showDashboard: false,
enableClickableLogo: false,
showScalebar: false,
showTermsLink: false,
mapTypeId: Microsoft.Maps.MapTypeId.grayscale
});
}发布于 2018-12-05 22:30:32
const renderMap = () => {
let windowHeight = window.innerHeight;
let meterToPixRatio = 850000 / windowHeight;
let scale = Math.floor(-1.4430 * Math.log(meterToPixRatio / 156434));
let x =
let y =
let xextent =
let yextent =
window.map = new Microsoft.Maps.Map('#map', {
...
zoom: scale,
center: centerLocation = new Microsoft.Maps.Location(x, y),
maxBounds: new Microsoft.Maps.LocationRect(centerLocation, xextent, yextent),
});
}https://stackoverflow.com/questions/53634561
复制相似问题