import { Map, View } from 'ol'
import Tile from 'ol/layer/Tile'
import { OSM, BingMaps } from 'ol/source'
import 'ol/ol.css'
const map = ref(null)
const source = reactive({
osm: new OSM(),
bing: new BingMaps({
key: 'AiZrfxUNMRpOOlCpcMkBPxMUSKOEzqGeJTcVKUrXBsUdQDXutUBFN3-GnMNSlso-',
imagerySet: 'Aerial'
})
})
const layer = new Tile()
function initMap () {
map.value = new Map({
target: 'map',
layers: [layer],
view: new View({
projection: "EPSG:4326",
center: [114.064839, 22.548857],
minZoom:10,
zoom: 12
})
})
layer.setSource(source.osm)
}
function setSource(data) {
layer.setSource(source[data])
}