[MapProxy] Antwort: Re: problems with mbtiles via mapproxy

Paul Norman penorman at mac.com
Mon Sep 17 03:18:28 PDT 2012


> From: mapproxy-bounces at lists.osgeo.org [mailto:mapproxy-
> bounces at lists.osgeo.org] On Behalf Of Oliver Tonnhofer
> Subject: Re: [MapProxy] Antwort: Re: problems with mbtiles via mapproxy
> 
> 
> On 14.09.2012, at 10:48, Erik.Heinen at dlr.rlp.de wrote:
> > coordinates aren't similar in the files. But I'm not quite sure what
> grid definition would be expect.
> > I used EPSG:3857 in my MapProxy-Configuration, thought this is the
> right one for MBtiles.
> > Am I wrong?
> 
> OSM uses a different origin for the tile coordinates, so you need to
> change that at least.
> 
> Here is an untested grid:
> 
> grids:
>   osm:
>     base: GLOBAL_MERCATOR
>     srs: EPSG:3857
>     origin: 'nw'

That grid works. I use the following definition for my config to get tiles
stored in the Google/OSM tile layout as well as to retrieve from remote
servers that serve tiles in that layout

grids:
  # TMS numbering is off by one from num_levels
  z16:
    # About 1.6m/px in Vancouver
    base: GLOBAL_MERCATOR
    origin: ul
    num_levels: 17
  z17:
    # About 800mm/px in Vancouver
    base: GLOBAL_MERCATOR
    origin: ul
    num_levels: 18
  z18:
    # About 400mm/px in Vancouver
    base: GLOBAL_MERCATOR
    origin: ul
    num_levels: 19
  z19:
    # About 200mm/px in Vancouver
    base: GLOBAL_MERCATOR
    origin: ul
    num_levels: 20
  z20:
    # About 100mm/px in Vancouver
    base: GLOBAL_MERCATOR
    origin: ul
    num_levels: 21

If you intend to use mapproxy to serve tiles to consumers expecting the
Google/OSM layout you need to use /tiles/ instead of /tms/ and call with
?origin=nw.

I strongly suggest using mod_rewrite with apache to make the URLs easier to
handle. Your users will thank you for sane URLs.

I use something like

Alias /tiles /path/to/tiles
<Directory /path/to/tiles>
        Options Indexes FollowSymLinks
        RewriteEngine on
        RewriteBase /tiles
        RewriteRule
^([^/]+)/([^/]+)/([^/]+)/([^/]+)\.(png|jpeg|jpg|tif|tiff)$
/my_mapproxy/tiles/1.0.0/$1_EPSG900913/$2/$3/$4.$5?origin=nw [L]
</Directory>

WSGIScriptAlias /my_mapproxy /path/to/mapproxy/config/config.py

And then I have some other tile-related files served up from /path/to/tiles/



More information about the MapProxy mailing list