【问题标题】:When a tile is 404, openlayers zoom in the previous tile image instead of hide it当 tile 为 404 时,openlayers 会放大前一个 tile 图像而不是隐藏它
【发布时间】:2021-11-29 05:24:40
【问题描述】:

我将 OpenLayers 与 OSM 和 Geoporttail 一起使用。我在底部显示 OSM,在顶部显示 Geoporttail。

在法国我没有问题,但在其他国家 Geoporttail 没有用于大缩放的图块。在这种情况下,Geoporttail 返回 404,openLayers 保留之前的图块/图像并在内部放大:/

我希望在 Geoporttail 磁贴不存在时隐藏它,这样我会看到 OSM 磁贴。

知道怎么做吗?

我添加两个图层的代码:

layers: [
        new OlTile({
            'title': 'OSM',
            source: new OlOSM()
        }),
        new OlTile({
            source : new WMTS({
                          url: 'https://wxs.ign.fr/pratique/geoportail/wmts',
                          layer: 'ORTHOIMAGERY.ORTHOPHOTOS',
                          matrixSet: 'PM',
                          format: 'image/jpeg',
                          projection: 'EPSG:3857',
                          tileGrid: new WMTSTileGrid({
                              origin: [-20037508, 20037508],
                              resolutions: resolutions,
                              matrixIds: matrixIds,
                            }),
                          style: 'normal'
                        })
        })
],

谢谢

【问题讨论】:

标签: http-status-code-404 openlayers layer


【解决方案1】:

正如 Mike 在他的评论中所说:使用“useInterimTilesOnError: false”解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-03
    相关资源
    最近更新 更多