openlayer拖動範圍設定
阿新 • • 發佈:2019-02-12
var mapOptions = { projection : new OpenLayers.Projection('EPSG:4326'), maxExtent : new OpenLayers.Bounds(121.95669802850942,37.302124678674154,122.73295650645256,37.63564806886632), // maxExtent : new OpenLayers.Bounds(-180, -90, 180, 90), restrictedExtent:new OpenLayers.Bounds(121.95669802850942,37.302124678674154,122.73295650645256,37.63564806886632), units : "degrees",// 單位度 controls : [] // 清空控制元件 }; map = new OpenLayers.Map('map',mapOptions);
問題:在使用openlayer2 圖片地圖的時候,圖片拖動後背景會有空白
解決:
restrictedExtent與maxExtent範圍一直就解決了