【发布时间】:2020-02-19 04:21:54
【问题描述】:
我试图在地图上定位图像,但无法弄清楚位置值的含义,这让我很难找到图像的正确位置。
以下是我正在使用的代码。
const imageExtent: any = [10, 10, 10, 10];
this.map = new Map({
target: 'map',
interactions: defaultInteractions().extend([new DragRotateAndZoom()]),
layers: [
new TileLayer({
source: new OSM()
}),
new ImageLayer({
source: new Static({
url: 'https://www.petmd.com/sites/default/files/small-kitten-walking-towards_127900829_0.jpg',
crossOrigin: '',
projection: 'EPSG:4326',
imageExtent
})
})
],
view: new View({
center: fromLonLat([15, 50]),
zoom: 16
})
});
图片当前正在显示,但位置错误。 我们希望使用与 Google 地图相同的坐标标准。
【问题讨论】:
-
如果您想模仿 Google,这里有一个地面覆盖示例 renenyffenegger.ch/notes/tools/Google-Earth/kml/index 转载于 OpenLayers codepen.io/anon/pen/LomLYe