【问题标题】:WMS Layer of new internal tile coordinates and custom tilegrid in ol 6ol 6中新的内部瓦片坐标和自定义瓦片网格的WMS层
【发布时间】:2020-01-08 01:48:55
【问题描述】:

我的默认地图在 EPSG:5179 坐标系中,我正在使用 tileurlfunction 重新定义。

视图投影也设置为 5179。

将 Geoserver WMS 图层投影到 EPSG:4326 或 EPSG:3857 根据要求,它将覆盖在我的底图上。

但是如果我修改投影为EPSG:5179并覆盖tilegrid值,tileurlfunction,就不能正常覆盖了。

如果你看一下ol v6.0.0.md,

新的内部瓷砖坐标,

好像是部分修改了tileUrlFunction导致的问题。

如果 tilegrid 不使用 Top-Left 并应用 Bottom-Left,如果您能告诉我如何进行 WMS 图层服务,将不胜感激。

  • 我的baselayer&tileurl函数
tilegrid
    origin: bottom-left,
    resolutions,
    extent

tileurlfunction
    return (
          (tileCoord) => {
            if (!tileCoord) {
              return undefined;
            } else {
              return template..replace(zRegEx, tileCoord[0].toString())
                .replace(xRegEx, tileCoord[1].toString())
                .replace(yRegEx, (-tileCoord[2] - 1).toString());
            }
          }
    );
  • 地理服务器 wmslayer
    const tileGrid = new TileGrid({
        origin: [extent[0], extent[1]],
        resolutions,
      extent
    })

    const wmsSource = new TileWMS({
        url: 'http://domain/geoserver/wms',
        params: { LAYERS: 'test:ecl_sw_p', TILED: true },
        projection: 'EPSG:5179'
        tileGrid
      })

【问题讨论】:

    标签: geoserver openlayers-6


    【解决方案1】:

    我解决了。

    proj4js EPSG:5181
    +轴=en
    =>
    +axis=neu

    用上面的方法改变左上角。

    // ol/source/TileWMS.js
    if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') {
          let tmp;
          tmp = tileExtent[0];
          bbox[0] = tileExtent[1];
          bbox[1] = tmp;
          tmp = tileExtent[2];
          bbox[2] = tileExtent[3];
          bbox[3] = tmp;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 2019-11-03
      • 1970-01-01
      相关资源
      最近更新 更多