分配新的 ol.View.Extent 坐标点
Assign new ol.View.Extent with coordnation points
我是 GIS 概念的新手,所以这可能是一个菜鸟问题。我正在使用 OpenLayers 3 制作地图。我想将平移限制在特定区域。
我遇到的代码应该可以做到,但我不知道要分配给 minx、miny、maxx 和 maxy 变量的值。
var view = new ol.View({
center: new ol.proj.transform([-116.284636, 43.619528], 'EPSG:4326', 'EPSG:3857'),
zoom: 11,
extent: [minx, miny, maxx, maxy]
});
我已经从点击 evt.coordinate 变量中获得了坐标,但我不知道它们与范围参数有何关联。
left top
'0' => "-12972739.566503541"
'1' => "5427487.630417225"
right top
'0' => "-12913118.684441104"
'1' => "5426723.260134374"
bottom right
'0' => "-12908838.210857134"
'1' => "5364962.141279951"
bottom left
'0' => "-12983440.750463465"
'1' => "5367713.874298218"
谁能解释一下如何获取坐标并创建新范围?
谢谢
minx = bottomleft[0]
miny = bottomleft[1]
maxx = topright[0]
maxy = topright[1]
我是 GIS 概念的新手,所以这可能是一个菜鸟问题。我正在使用 OpenLayers 3 制作地图。我想将平移限制在特定区域。
我遇到的代码应该可以做到,但我不知道要分配给 minx、miny、maxx 和 maxy 变量的值。
var view = new ol.View({
center: new ol.proj.transform([-116.284636, 43.619528], 'EPSG:4326', 'EPSG:3857'),
zoom: 11,
extent: [minx, miny, maxx, maxy]
});
我已经从点击 evt.coordinate 变量中获得了坐标,但我不知道它们与范围参数有何关联。
left top
'0' => "-12972739.566503541"
'1' => "5427487.630417225"
right top
'0' => "-12913118.684441104"
'1' => "5426723.260134374"
bottom right
'0' => "-12908838.210857134"
'1' => "5364962.141279951"
bottom left
'0' => "-12983440.750463465"
'1' => "5367713.874298218"
谁能解释一下如何获取坐标并创建新范围?
谢谢
minx = bottomleft[0]
miny = bottomleft[1]
maxx = topright[0]
maxy = topright[1]