[mapserver-users] mapcache WMTS - TMS one tile offset

thomas bonfort thomas.bonfort at gmail.com
Tue Oct 14 03:13:41 PDT 2014


Markus,

TMS expects tiles starting at the bottom left whereas WMTS expects
them starting top left. Mapcache by default uses bottom-left ordered
grids, and creates a WMTS capabilities document that accounts for that
in the sense that the TopLeftCorner of each TileMatrix is adjusted and
may vary if the combination of your grid extents and resolutions do
not produce a stable topleftcorner for each resolution. You have
multiple ways forward:

- use a combination of grid extents and resolutions that force a
stable topleftcorner whatever the resolution. This is usually done by
using power-of-two resolutions.
- force the grid to be fixed to the top left corner instead of bottom
left. <grid><origin>top-left</origin></grid>. Your tileset will not be
compatible with TMS requests.
- use a wmts client that knows how to parse WMTS capabilities so that
the correct topleftcorner is used for each resolution
- (not sure, but check if openlayers supports overiding the topleft
origin for its grid for WMTS requests)

cheers,
thomas

On 10 October 2014 22:12, mapserver <mapserver at markus-spring.de> wrote:
> Disclaimer: I have asked this question already on openlayers-users, but not
> received any answer
> ---
>
> I have set up a mapserver/mapcache service for tiled background maps, which
> should offer WMTS and TMS services
> in the EPSG:31468 projection.
>
> The TMS tiles I've verified to be correctly placed against a standard wms
> layer, however the WMTS tiles get placed with
> a one tile offset to the south compared to the TMS tiles.
>
> Please see the screenshot:
> http://markus-spring.info/varia/wmts_tms_offset_problem.jpg
>
> The grid definition is as follows:
>
>     <grid name="MUC31468">
>        <metadata>
>           <title>Mapcache Service City of Munich EPSG 31468</title>
>        </metadata>
>        <srs>EPSG:31468</srs>
>        <size>256 256</size>
>        <extent>4440016 5313983 4492016 5359983</extent>
>        <units>m</units>
>        <resolutions>141.11153491115225 70.55561745557612
>                     42.33331047334567 35.27775872778806 26.458319045841048
>                     17.63887936389403 8.819439681947015 3.527775872778806
>                     2.6458319045841043 1.763887936389403 0.8819439681947016
>                     0.35277758727788067 0.17638879363894033</resolutions>
>     </grid>
>
> and the tileset
>
>     <tileset name="karte_2014-1">
>        <source>karte_2014-1</source>
>        <cache>disk</cache>
>        <metadata>
>           <title>karte_2014-1</title>
>           <abstract></abstract>
>        </metadata>
>        <format>PNG</format>
>        <metatile>5 5</metatile>
>        <metabuffer>10</metabuffer>
>        <dimensions>
>          <dimension type="regex" name="MAPFILE"
> default="/path/to/mapfile.map">^[a-zA-Z0-9\./]*\.map$</dimension>
>        </dimensions>
>        <grid>MUC31468</grid>
>     </tileset>
>
>
> while the service definitions (for OpenLayers 2.13) are these:
>
>            var wmts = new OpenLayers.Layer.WMTS({
>                name:        "WMTS basemap",
>                url:         "http://centmap/mapcache/wmts?",
>                layer:       "karte_2014-1",
>                matrixSet:   "MUC31468",
>                format:      "image/png",
>                style:       "default",
>                opacity:     0.7,
>                maxExtent:   maxExtent,
>                isBaseLayer: true
>            });
>
>            var tms = new OpenLayers.Layer.TMS(
>                "TMS basemap",
>                "http://centmap/mapcache/tms/",
>                { layername: "karte_2014-1",
>                  type:      "png" }
>            );
>
> Any help would be greatly appreciated.
>
> ---Markus
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list