如何使用 OpenLayers 設定 Extent
程式碼如下
...
// 定義 Extent 範圍須自行定義
var extent = new OpenLayers.Bounds(119.281,21.8901,122.001,25.3033); ...
function init(){
// 將 Extent 設定為 options
var options = {
restrictedExtent: extent
}
...
// 指定 OpenLayers Div 時將 options 帶入
map = new OpenLayers.Map( 'map', options );
...
// Zoom 至自定義的 Extent
map.zoomToExtent(extent);
}
如此便可在載入時 Zoom in 至自定義的 Extent
文章標籤
全站熱搜
