0
osfレイヤーの上に静的イメージを追加するために、openlayersブックからexampleを続けました。それは動作しますが、私の画像(256x256)は長方形として表示されます。私は、投影の座標の周りしようと、ここでの他の記事をチェックアウトしますが、画像は、正方形として表示されていない、なぜ私はそれのまわりで私の頭を取得することはできません。osfレイヤーの上の静的イメージレイヤーにイメージが正しく表示されない
// Create map
var map = new ol.Map({
target: 'map', // The DOM element that will contains the map
renderer: 'canvas', // Force the renderer to be used
layers: [
// Add a new Tile layer getting tiles from OpenStreetMap source
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
// Create a view centered on the specified location and zoom level
view: new ol.View({
center: ol.proj.transform([16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
// Create an image layer
var imageLayer = new ol.layer.Image({
opacity: 0.75,
source: new ol.source.ImageStatic({
attributions: [
new ol.Attribution({
html: ''
})
],
url: 'https://placebear.com/256/256',
imageSize: [256, 256],
projection: map.getView().getProjection(),
imageExtent: ol.extent.applyTransform(
[0, 0, 16.3725, 48.208889], ol.proj.getTransform("EPSG:4326", "EPSG:3857"))
})
});
map.addLayer(imageLayer);
わかりましたが、実際はオーバーレイ画像(例:上部に戦略マップなど)を表示します。画像投影に関しては、ピクセルからの緯度/経度座標の計算方法が混乱していました。私は出発点から緯度/経度を計算し、単純に言うと、南のxメートルに行く方法がありますか?(ピクセルが1メートルだと言ったら)? –
私はこれを予想外のことを行うオーバーレイとして追加しました。だから私の質問は時代遅れです。 –