maptiler/tileserver-php

TMS should identify map by path or file name

kjkrum opened this issue · 1 comments

TMS responses seem to select the map by title rather than path or file name. I think this is a bug.

What I did:

In my first test installation, I happened to use two .mbtiles files that had the same title (L286) but different file names (L286.mbtiles and L286-2.mbtiles). The URL http://localhost/maps2/tms produces this response, which I think is correct:

<?xml version="1.0" encoding="UTF-8"?>
<TileMapService version="1.0.0">
   <TileMaps>
      <TileMap title="L286" srs="EPSG:3857" type="InvertedTMS" profile="global-mercator" href="http://localhost/maps2/tms/L286-2" />
      <TileMap title="L286" srs="EPSG:3857" type="InvertedTMS" profile="global-mercator" href="http://localhost/maps2/tms/L286" />
   </TileMaps>
</TileMapService>

However, the URLs for both TileMap elements produce this response:

<?xml version="1.0" encoding="UTF-8"?>
<TileMap version="1.0.0" tilemapservice="http://localhost/maps2/L286-2" type="InvertedTMS">
   <Title>L286</Title>
   <Abstract />
   <SRS>EPSG:3857</SRS>
   <BoundingBox minx="-20037508.34" miny="-20037508.34" maxx="20037508.34" maxy="20037508.34" />
   <Origin x="-20037508.34" y="-20037508.34" />
   <TileFormat width="256" height="256" mime-type="image/png" extension="png" />
   <TileSets profile="global-mercator">
      <TileSet href="http://localhost/maps2/L286-2/12" units-per-pixel="38.218514142588" order="12" />
      <TileSet href="http://localhost/maps2/L286-2/13" units-per-pixel="19.109257071294" order="13" />
      <TileSet href="http://localhost/maps2/L286-2/14" units-per-pixel="9.554628535647" order="14" />
      <TileSet href="http://localhost/maps2/L286-2/15" units-per-pixel="4.7773142678235" order="15" />
      <TileSet href="http://localhost/maps2/L286-2/16" units-per-pixel="2.3886571339118" order="16" />
   </TileSets>
</TileMap>

Note that the tilemapservice attribute refers to L286-2 in both cases. I think that when the tileserver handles a request for http://localhost/maps2/tms/L286, it's looking for the first map with a title that matches L286, and returning a response for the file L286-2 because it just happens to be first one with a matching title. It should be treating L286 as a path or file name, not a title.

I noticed that it does the same thing with TileJson responses. Requesting http://localhost/maps2/L286.json produces the following. Note the incorrect basename and URLs.

{
   "name":"L286",
   "description":"",
   "legend":"",
   "attribution":"",
   "type":"overlay",
   "version":"1",
   "format":"png",
   "format_arguments":"-f png8a ",
   "minzoom":12,
   "maxzoom":16,
   "bounds":[
      -111.030459,
      32.158406,
      -110.949883,
      32.226733
   ],
   "scale":"1.000000",
   "profile":"mercator",
   "scheme":"xyz",
   "generator":"MapTiler Free 7.2-5b8af5a",
   "basename":"L286-2",
   "tiles":[
      "http://localhost/maps2/L286-2/{z}/{x}/{y}.png"
   ],
   "tilejson":"2.0.0",
   "grids":[
      "http://localhost/maps2/L286-2/{z}/{x}/{y}.grid.json"
   ]
}