EPSG:4326的开放街道地图服务器

3

我希望在我的leaflet应用程序中使用EPSG:4326 CRS,因为我有很多WMS图层只能以EPSG:4326格式提供。

所以,我正在寻找一个EPSG:4326的瓦片服务。但是,我发现所有的X/Y/Z链接都是以EPSG:3857格式提供的。


1
我找不到一个带有EPSG:4326投影的OSM服务器瓦片,但是只要花点功夫,你可以渲染自己喜欢的任何投影方式的瓦片。虽然这可能不是你期望的答案。 - scai
4个回答

2

这是最终的解决方案。"不相信"不能成为一个解决方案。 - Magno C

0

目前我不相信OSM有一个以EPSG:4326格式提供瓦片的服务器


2
三年过去了?有什么新的进展吗? - konzo

0

您必须使用MapProxy:

创建一个“sources.yaml”文件:

sources:
  openstreetmap_source:
    type: tile
    grid: GLOBAL_WEBMERCATOR
    url: http://{s}.tile.openstreetmap.org/%(z)s/%(x)s/%(y)s.png
    transparent: false
    request_format: image/png
    concurrent_requests: 5
    http:
      client_timeout: 600

创建一个 "caches.yaml" 文件。这将会产生魔力:
caches:
  osm_cache:
    grids: [geodetic]
    meta_size: [4, 4]
    sources: [osm_cache_in]
    request_format: image/png
    link_single_color_images: true
    concurrent_tile_creators: 4
    format: image/png
  osm_cache_in:
    sources: [openstreetmap_source]
    disable_storage: true
    grids: [GLOBAL_WEBMERCATOR]
    request_format: image/png
    link_single_color_images: true
    concurrent_tile_creators: 4
    format: image/png

创建一个 "layer.yaml" 文件。
layers:
  - name: openstreetmap
    title: OpenStreetMap
    sources: [osm_cache]

...以及当然是"mapproxy.yaml":

base: [layers.yaml, caches.yaml, sources.yaml]

services:
  demo:
  wms:
    srs: ['EPSG:4326','EPSG:3857']
    md:
      title: MapProxy WMS Proxy

grids:
  webmercator:
    base: GLOBAL_WEBMERCATOR
  geodetic:
    base: GLOBAL_GEODETIC
  smaps_grid:
    base: GLOBAL_MERCATOR
    srs: 'EPSG:4326'

globals:
  image:
    resampling_method: bicubic # nearest/bilinear
    paletted: false
    formats:
      image/png:
        mode: RGBA
        transparent: true    
      image/jpeg:
        encoding_options:
          # jpeg quality [0-100]
          jpeg_quality: 60

现在您可以将OSM作为WMS访问:

http://<YOUR_MAPPROXY>/mapproxy/service?LAYERS=openstreetmap&FORMAT=image%2Fjpeg ...

enter image description here


-1
Leaflet同样支持EPSG:4326。请参考文档。你可以尝试以下代码:
L.map("id", {crs: L.CRS.EPSG4326});

1
当然,这就是我正在做的事情。你所忽略的是leaflet不会重新投影图像瓦片。在这种情况下,来自http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png的OSM处于EPSG:3857中。这意味着如果你在leaflet中设置EPSG:4326并开始放置点,那么点将在EPSG:4326中(leaflet工作),但你的地图在EPSG:3857中。试试在阿拉斯加放置一个点。 - lostintranslation
哦,我之前没理解清楚你的问题。但是正如scai所指出的,你可能需要在EPSG:4326中渲染自己的瓦片。 - tyr

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接