0

在我尝试为我的地图设置最大边界之前,我的带有自定义图块的传单地图工作正常。

var SWCorner = new L.LatLng(-312, -180);
var NECorner = new L.LatLng(180, 312);
var MaxBounds = new L.LatLngBounds(southWest, northEast);

var map = L.map('map', { crs: L.CRS.EPSG4326, draggable: true }).setView([-63, 65], 1);
map.setMaxBounds(MaxBounds);

 L.tileLayer('http://localhost:9000/CustomIcons/tile_{z}_{x}-{y}.png', {
                boxZoom: false,
                minZoom: 1,
                maxZoom: 5,
                tms: true,
                noMoveStart: true,
                keyboardPanOffset: 10,
                noWrap: true,
                tileSize: 350
            }).addTo(map);

我尝试过的事情是:

var SOMmap = L.map('SOMmap', { crs: L.CRS.EPSG4326 maxBounds: new L.LatLngBounds([-312,-180],[180,312]}).setView([-63, 65], 1);

var SOMmap = L.map('SOMmap', { crs: L.CRS.EPSG4326, draggable: true, maxBounds: MaxBounds }).setView([-63, 65], 1);


var SOMmap = L.map('SOMmap', { crs: L.CRS.EPSG4326,
                               draggable: true
                              }).setView([-63, 65], 1).setMaxBounds(MaxBounds);

每当我尝试设置最大界限时,瓷砖总是消失。如何调用 setMaxBounds?

4

1 回答 1

0

来自http://spatialreference.org/ref/epsg/4326/

EPSG:4326

WGS 84 

WGS84 Bounds: -180.0000, -90.0000, 180.0000, 90.0000
Projected Bounds: -180.0000, -90.0000, 180.0000, 90.0000
Scope: Horizontal component of 3D system. Used by the GPS satellite navigation system and for NATO military geodetic surveying.
Last Revised: Aug. 27, 2007
Area: World

因此,您的 LatLngBounds 值在此投影中无效 lat 应介于 -180 和 180 之间, lng 介于 -90 和 90 之间

于 2013-10-16T14:09:58.460 回答