5

I followed the guide from https://wiki.openstreetmap.org/wiki/MapProxy to create a locale tile proxy for OpenStreetMap, because I need to access the same tiles over and over again. However, there seem to be some problems with the grid definitions.

As a example if I try to access http://localhost:8080/tms/1.0.0/osm/EPSG900913/6/12/11.png the URL is translated to http://c.tile.openstreetmap.org/7/12/116.png

What has to be changed in the config that mapproxy acts as a purely transparent proxy?

2
  • It looks like it's doing some form of reprojection - I guess that you don't want it to do that. I'm not familiar with MapProxy, but presumably in order for people to help you you'd need to post the config you were using? At the risk of stating the obvious, if you "just want tiles that appear local" you can of course set up a local tile server - how practical that is would depend on the amount of the planet and the detail that you were interested in. Commented Feb 6, 2018 at 15:32
  • Well, I used the exact same configuration as shown in the openstreetmap wiki. And for me it does not look like there is any reprojection defined in the config file. Setting up a local tile server is of course an option, but I thought just using a proxy would be easier.
    – W. Alpha
    Commented Feb 7, 2018 at 8:27

4 Answers 4

2

There a lot of things that can go wrong, especially srs / grid / bbox, as I've found out trying to work this out... So here is full working example for transparent OSM cache, to help next poor soul finding this:

services:
  #sets up how to make the source data available
  demo:
  tms:
    use_grid_names: true
    # origin for /tiles service
    origin: 'nw'
  wms:
    #srs sets the coordinate reference systems as which you want to make your data available. MapProxy reprojects the source data very well to these projections.
    srs: ['EPSG:3857']
    image_formats: ['image/png']
    md:
      # metadata used in capabilities documents
      title: Mapproxy OSM cache
      abstract: This is the MapProxy
      fees: 'None'


layers:
  #sets up which layers you want to make available using the services above. You can add many, but let's stick to osm data here.
  - name: osm_demo      # access in JOSM as TMS: http://localhost:8080/tiles/1.0.0/osm_demo/webmercator/{zoom}/{x}/{y}.png
    title: Open Streetmap Tiles (test)
    sources: [osm_cache]

caches:
  #setup the cache for the open streetmap tiles. This cache is used by the layer above.
  osm_cache:
    sources: [osm_tiles]
    format: image/png
    grids: [webmercator]

sources:
  osm_tiles:
    #the osm_tiles source refers to the openstreetmap.org tiles. These will be downloaded upon request (if not already cached) and served by MapProxy
    type: tile
    url: http://c.tile.openstreetmap.org/%(tms_path)s.%(format)s
    grid: webmercator

grids:
  webmercator:
    base: GLOBAL_WEBMERCATOR

globals:
  #next are some global configuration options for MapProxy. They mostly explain themselves, or can be looked-up in the MapProxy docs.
  cache:
    # where to store the cached images
    base_dir: './cache_data'
    # where to store lockfiles
    lock_dir: './cache_data/locks'

P.S. note that you need to access it as http://localhost:8080/tiles/1.0.0/osm_demo/webmercator/{zoom}/{x}/{y}.png not as default http://localhost:8080/tms/1.0.0/osm_demo/webmercator/{zoom}/{x}/{y}.png shown as setup page, as that will give you dreaded "empty blue" tiles...

1
  • 1
    +1 Works splendidly!
    – nyov
    Commented Mar 22 at 13:51
1

If someone else comes along this Question. The answer to this has been given by Matija Nalis in the P.S. section at the bottom of their answer.

You have to use http://localhost:8080/tiles/... in your URL instead of http://localhost:8080/tms/...

It is also described in the Mapproxy-doc: https://mapproxy.org/docs/latest/services.html#google-maps

The TMS standard counts tiles starting from the lower left corner of the tile grid, while Google Maps and compatible services start at the upper left corner. The /tiles service accepts an origin parameter that flips the y-axis accordingly. You can set it to either sw (south-west), the default, or to nw (north-west), required for Google Maps.

Example: http://localhost:8080/tiles/osm_EPSG900913/1/0/1.png?origin=nw

0
0

The source SRS for OpenStreetMaps is EPSG:3857 (web mercator SRS). You URL is asking for tiles in EPSG:900913 (unofficial SRS from Google).

When you request MapProxy tiles in a different SRS than the source cache is, Mapproxy needs to reproject the tiles into whatever new SRS you are requesting tiles in.

So, I'd recommend you to use only EPSG:3857. Remove all references to EPSG:900913 and try with a direct configuration of the source:

osm_tiles:
    type: tile
    grid: GLOBAL_WEBMERCATOR
    url: http://c.tile.openstreetmap.org/%(z)s/%(x)s/%(y)s.png
1
  • 3
    I have what appears to be almost exactly the same issues as the OP. This approach did not help me, unfortunately.
    – Matti Wens
    Commented Jun 13, 2018 at 13:36
0

Also most TILE SERVERS are XYZ including OSM. MAP PROXY only delivers TMS. make you have cached TMS. otherwise flip Y/ ROW. Lower left versus upper Left as origin. Connect QGIS to your cache folder to test install tile layer plugin add TMS grid

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.