maptiler/tileserver-php

WMTS / TileJSON for remote tiles

klokan opened this issue · 8 comments

Some users requested a need to run their own WMTS for tiles stored in Amazon S3 or on a different location then their WMTS endpoint.

In this moment we use the http://wmts.maptiler.com/ service to generate the WMTS and TileJSON dynamic endpoints for remotely stored tiles with metadata.json file.

In fact TileServer-php could also generate the capabilities documents for remote tiles.

Probably easiest would be to create empty directory for each remote dataset which should be exposed by WMTS and save in this directory the /metadata.json generate by MapTiler, but add the "tiles" field with correct URL.

This way users of MapTiler could have their own WMTS endpoint on their own server with PHP - while hosting their tiles on a different location as well. They would keep control of their WMTS and list of exposed layers - it it could run on their own domain.

Or is there another, more straightforward or easier way for the users to do this then the directory with metadata.json and tiles url inside?

Finally it required few fixes in order of metadata checking. So Tileserver could work only as a WMTS generator. It requires to add to folder a metadata.json and name it as remote layer. For example for folder layer named europe stored in labs.klokantech.com/tileserver/europe/ you need to create folder /europe/ in your local/remote server and put following metadata:

{
  "name": "europe",
  "version": "1.0.0",
  "description": "",
  "type": "overlay",
  "format": "png",
  "minzoom": "0",
  "maxzoom": "6",
  "bounds": [-36.96352111, 27.97971067, 81.09315622, 71.56346432],
  "tiles": [
    "http://labs.klokantech.com/tileserver/europe/{z}/{x}/{y}.png"
  ],
  "scale": "1"
}

So into "standard" metadata file from MapTiler is added only variable "tiles": ["http://labs.klokantech.com/tileserver/europe/{z}/{x}/{y}.png"] with right url.

Really cool!

It will work ONLY if you will put your data in this directories:
/wmts///
(tilematrixset is in this case always GoogleMapsCompatible if you are using mercator tiles)
This could work now.

I will fix it in tileserver but I don't know actually how. Possibility is to construct url without /wmts and {tilematrxset} if base url is on different domain, but there could be a problem when tileserver will have urls set in config file. (this short url is used in wmts.maptiler and it works).

Second is to create metadata field something like "wmtstiles" with url to remote tiles.

But both this solutions might start problems in future. I don't like it.

<ResourceURL template="..."> should link directly to static files or XYZ.

In 6b4fb0f provides url like:

<ResourceURL format="image/png" resourceType="tile" template="http://labs.klokantech.com/tileserver/europe/{TileMatrix}/{TileCol}/{TileRow}.png"/>

Could you let know the person on MapTiler user group, please?

Will this same approach work if wanting to serve MBTILES hosted elsewhere?

MBTiles cannot be read remotely.
You need the tiles.

Details of the setup:

https://www.maptiler.com/support/community/?place=msg%2Fmaptiler%2FmuBxif20eOI%2FS0THCflWAwAJ