【问题标题】:Openlayers - ArcGIS Vector tiles - OFFSETOpenlayers - ArcGIS 矢量切片 - 偏移
【发布时间】:2021-10-13 04:07:15
【问题描述】:

我们使用 Openlayers 创建了一个 Web 应用程序 - 主要使用 ImageArcGISRest 源显示 ArcGIS REST 数据。

我们希望能够同时显示一些矢量切片数据 - 但切片方案和/或范围存在一些问题。 在 ArcGIS Pro 中创建的矢量切片是 EPSG:25832 - 与 ImageArcGISRest 源相同的投影。

在同一 Openlayers 地图中查看矢量切片和 ImageArcGISRest 时 - 矢量切片水平偏移 10.000 米。

有人知道为什么会这样吗?

我创建了一个简单的小提琴来显示代码和问题:https://jsfiddle.net/larssoe/0vyw2Lg5/150/

proj4.defs('EPSG:25832', "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs");
    ol.proj.proj4.register(proj4);

var myProjection = ol.proj.get('EPSG:25832');
myProjection.setExtent([130000, 5661139.2, 1378291.2, 6500000]);  
var resturl = 'https://bragdev3.gis.dk/arcgis/rest/services/Plandistrikter2/MapServer';

const mousePositionControl = new ol.control.MousePosition({
  coordinateFormat: ol.coordinate.createStringXY(4),
  projection: 'EPSG:25832',
  className: 'custom-mouse-position',
  target: document.getElementById('mouse-position'),
});

var map = new ol.Map({
  controls: ol.control.defaults().extend([mousePositionControl]),
  target: 'map',
  view: new ol.View({
    center: [0, 0],
    zoom: 10,
        projection: myProjection
    //projection: 'EPSG:25832',
  }),
  layers: [
    
    new ol.layer.VectorTile({
    source: new ol.source.VectorTile({
      format: new ol.format.MVT(),
      //tilegrid: myTileGrid,
      projection: 'EPSG:25832',
      minZoom: 0,
      maxZoom: 15,
      maxResolution: 1638.4,
      wrapX: false,
      url: 'https://bragdev3.gis.dk/arcgis/rest/services/Hosted/Plandistrikter2/VectorTileServer/tile/{z}/{y}/{x}.pbf'
      }),
      tileSize: 512,
      //tilegrid: myTileGrid2
    }),
  new ol.layer.Tile({
        title:'ArcGISRest',
        source: new ol.source.TileArcGISRest({
            url: resturl,
            params: {
                FORMAT: "png32",
                LAYERS: "show:0",
                DPI: 96
            },
            projection: ol.proj.get("EPSG:25832"),
      //tilegrid: myTileGrid
        })
    })
  ],
});

map.on('moveend', move);

function move(event) {
    var info = document.getElementById('info');
  const extent = map.getView().calculateExtent(map.getSize());
  const resolution = map.getView().getResolution();
  const zoom = map.getView().getZoom();
  info.innerText = 'zoom: ' + zoom + ' resolution: ' + resolution + ' extent:' + extent;
  info.style.opacity = 1;}

var info = document.getElementById('info');
function showInfo(event) {
  var features = map.getFeaturesAtPixel(event.pixel);
  if (features.length == 0) {
    info.innerText = '';
    info.style.opacity = 0;
    return;
  }
  var properties = features[0].getProperties();
  info.innerText = JSON.stringify(properties, null, 2);
  info.style.opacity = 1;
}

var center = [706000,6216062];
map.getView().setCenter(center);
map.getView().setZoom(6);

任何帮助将不胜感激。谢谢!

【问题讨论】:

  • bragdev3.gis.dk/arcgis/rest/services/Hosted/Plandistrikter2/… 中显示的矢量切片的原点是 X: 120000.0 Y: 6500000.0,因此基于投影范围的切片网格太东了。如果您更正范围,两个图层都可以正常工作,因为 TileArcGISRest 可以在任何范围内工作。
  • 非常感谢您指出:-)

标签: openlayers arcgis vector-tiles


【解决方案1】:

对于其他有矢量图块偏移问题的人: 通过设置属性 ma​​xResolution 解决了初始偏移问题(水平和垂直)。在我的情况下到 1638.4

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-17
    • 2021-11-06
    • 2021-08-17
    • 2012-09-18
    • 1970-01-01
    • 1970-01-01
    • 2019-11-30
    • 1970-01-01
    相关资源
    最近更新 更多