簡體   English   中英

OL3,基於像素的zoomify與矢量疊加錯誤地偏移

[英]OL3, pixel based zoomify with vector overlay incorrectly offset

GIS上被問到,但沒有結果,希望這里的人可能有想法。 對不起,十字路口。 我正在從OL2更新一個項目,在此我嘗試進行的很好。 Project不是地圖,它是文本文檔的圖像,這些圖像已轉換為縮放圖塊。

添加了一個多邊形矢量層,這些矢量層表示OCR文本中文本的術語/短語坐標。

小提琴顯示了一個頁面,該頁面突出顯示了“得克薩斯”一詞的3個匹配項。 請注意,術語的位置在一個軸上是正確的,但是在屏幕上太高了。 同樣,相同的像素坐標在OL2中也起作用。

小提琴節選:

        var vectorSource = new ol.source.Vector({
          features: (new ol.format.GeoJSON()).readFeatures(geojsonObject)
        });

        var map = new ol.Map({
            layers: [
            new ol.layer.Tile({
              source: source
            }),
            new ol.layer.Vector({
                source: vectorSource,
                style: styleFunction
            })
          ],
          target: 'zoom',
          view: new ol.View({
            projection: proj,
            constrainRotation: 0,
            center: imgCenter,
            zoom: 0,
            // constrain the center: center cannot be set outside
            // this extent
            extent: [0, -imgHeight, imgWidth, 0]
          })
        });

問題似乎與投影,范圍或居中有關。 在這里的任何幫助將不勝感激。

看來您使用的是錯誤的座標。 我做了一個小提琴 ,您可以在文本周圍畫一個方框,然后在頂部看到坐標。

因此,例如,如果將坐標更改為:

var geojsonObject = {
  'type': 'FeatureCollection',
  'features': [
  {
    'type': 'Feature',
    'geometry': {
      'type': 'MultiPolygon',
      'coordinates': [

      [[[1849.90, -2385.40], [1849.90, -2619.07], [2258.83, -2619.07], [2258.83, -2385.40]]]

      ]
    }
  }
  ]
};

多邊形將在您想要的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM