Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

百度地图自定义瓦片图超出加载一些没有的图片

我用baidumaptileCutter制作了一张自定义的瓦片图,然而我的图比较小,打开的时候加载了一些没有的瓦片图,都是报404错的;
我想问下超出之后怎么让他加载指定的一张图片?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

可以自定义你的tileLayer.getTilesUrl

var tileLayer = new BMap.TileLayer();
tileLayer.getTilesUrl = function(tileCoord, zoom) {
    var x = tileCoord.x;
    var y = tileCoord.y;
    var url = 'youTilesUrl/' + zoom + '/' + x + '/' + y + '.png';     //根据当前坐标,选取合适的瓦片图
    return url;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...