Python 使用MapProxy TMS缓存OSM

Python 使用MapProxy TMS缓存OSM,python,gis,openlayers,openstreetmap,Python,Gis,Openlayers,Openstreetmap,出于开发目的,我想在ESPG:25832中使用MapProxy缓存OSM磁贴,并将其作为代理TMS服务提供 WMS/WMTS服务在QGIS中看起来不错,但在QGIS和OpenLayers中,TMS调整不正确 我有一个配置mapproxy.yaml文件,如下所示: services: demo: tms: wmts: wms: srs: ['EPSG:25832', 'EPSG:900913', 'EPSG:2154','EPSG:3857'] layers: - n

出于开发目的,我想在ESPG:25832中使用MapProxy缓存OSM磁贴,并将其作为代理TMS服务提供

WMS/WMTS服务在QGIS中看起来不错,但在QGIS和OpenLayers中,TMS调整不正确

我有一个配置mapproxy.yaml文件,如下所示:

services:
  demo:
  tms:
  wmts:
  wms:
    srs: ['EPSG:25832', 'EPSG:900913', 'EPSG:2154','EPSG:3857']

layers:
  - name: osm
    title: Open Streetmap Tiles EPSG:25832
    sources: [osm_cache]

caches:
  osm_cache:
    grids: [osm_grid]
    meta_size: [4, 4]
    sources: [osm_cache_in]
    format: image/jpeg

  osm_cache_in:
    grids: [GLOBAL_WEBMERCATOR]
    disable_storage: true
    sources: [osm_source]

sources:
  osm_source:
    type: tile
    grid: GLOBAL_WEBMERCATOR
    url: http://a.tile.openstreetmap.org/%(z)s/%(x)s/%(y)s.png

grids:
  osm_grid:
    srs: 'EPSG:25832'
    bbox: [388309.92,5265326.14,609798.17,5515636.81]
    bbox_srs: 'EPSG:25832'
    origin: 'nw'
    tile_size: [256, 256]

globals:
  cache:
    # where to store the cached images
    base_dir: '/mapproxy/cache_data'
    # where to store lockfiles
    lock_dir: '/mapproxy/cache_data'
我将层作为TMS添加到QGIS中的示例url是{z}/{x}/{-y}.jpeg

QGIS和OpenLayers强制将该层重新投影到EPSG:3857,并调整其几何体,使其远离应该的位置-不知道为什么。

EPSG:25832建议您使用一个自定义的平铺网格,在这种情况下,url中的
{-y}
在OpenLayers中不会像预期的那样工作,您应该使用tileUrlFunction。请参阅相关内容:有许多可能的问题,请参阅使用TMS到TMS mapproxy缓存,该缓存不会移动任何东西