单张图像映射到景观视口的边界视图 [英] Bounding view of a Leaflet image map to a landscape viewport
本文介绍了单张图像映射到景观视口的边界视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个方形图像16384x16384,该图像已使用MapTiler切成小块,以在Leaflet中创建6级缩放.
I have a square image 16384x16384 that has been sliced into tiles using MapTiler to create 6 levels of zoom in Leaflet.
我已经在Leaflet中设置了图像,如下所示:
I have set up the image in Leaflet as follows:
var map = L.map('map', {
maxZoom: 6,
minZoom: 0,
}).setView([0, 0],1);
var tilesURL = "_server/tiles/{z}/{x}/{y}.jpg";
L.tileLayer(tilesURL, {
maxZoom: 6,
continuousWorld: 'false',
tms: true
}).addTo(map);
我怎么会
- 将这个大正方形图像的视图限制在中间(横向矩形)区域吗?
- 生成一组非正方形的矩形图块吗?
另外,Leaflet可以将边界区域自动调整到Map容器吗?
Additionally, can Leaflet auto-fit the bounded area to the Map container?
推荐答案
- 是的.使用 maxBounds选项.
- 不知道,但是为什么要这么做呢?
- 是:方法 fitBounds 可以做到.
- Yes. Use the maxBounds option.
- No idea, but why do you want to do such a thing?
- Yes: the method fitBounds does that.
这篇关于单张图像映射到景观视口的边界视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文