0

I use MapCache of Mapserver to generate tiles of a tif.

Given a tile (located on disk as z/y/x structure), how can I calculate it's geo-position?

Example: 8/50/100.png -> ( 46.11, 11.05 ) (in wgs84)

1

At end, it was simple.

  1. go to your mapcache server to obtain the list of layers:

    http://mapcacheserverurl/mapcache/tms/1.0.0/

  2. get information about layer:

    http://mapcacheserverurl/mapcache/tms/1.0.0/LAYERNAME

  3. here you see the size of the tile in X and Y:

    <TileFormat width="256" height="256" mime-type="image/unknown" extension="xxx"/>

    the origin of the tiles:

    <Origin x="43.000000" y="11.000000"/>

  4. get the units per pixel at a given zoom level:

    <TileSet href="http://.../8" units-per-pixel="0.06" order="8"/>

  5. now, I can calculate the position of a given tile in this path: 8/100/86.xxx (in my mapcache.xml configuration it's in the format z/x/y):

    x = Origin_x + x * units-per-pixel (43 + 100 * 0.06)

    y = Origin_y + y * units-per-pixel (11 + 86 * 0.06)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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