Openlayers 3中有一種方法可以獲取附加到特定html元素的地圖嗎?Openlayers3從元素獲取地圖
是這樣的:
var map = new ol.Map({
view: new ol.View({
center: [0, 0],
zoom: 1
}),
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'osm'})
})
],
target: 'map'
});
//Later on, in a different file
var myMap = $("#map").ol.Map()