Hexagon Geospatial


Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Occasional Contributor
Posts: 13
Registered: ‎06-07-2016
Accepted Solution

How do you calculate the filename of a WMTS tile?

Hi All,


We have a WMTS of many millions of png tiles and every now and then we need to update a particular one.  The easiest way is to delete the offending tile and get the Cache Filler to regenerate it, but the question is... what is the path and filename of the tile.  Given the tile matrix number, row and column does anyone know how the path and file name in the WMTS Cache is calculated from the parameters give in TileLocationCfg & CacheConfiguration xmls?



New Contributor
Posts: 5
Registered: ‎08-04-2016

Re: How do you calculate the filename of a WMTS tile?

Hi, i just had to find out how to do it and right then i read your question Smiley Happy my solution is not that practical, but it works.

1. Change your log4net level value to "DEBUG" in web.config of your wmts

2. open your wmts in map window and navigate to the field with that particular tile

3. check your Network activity (in chrome Ctrl+Shift+I and then Network) find your particular tile and open it in new web browser window.

4. check the last log in log file and there is a path and filename of that tile


It is of course not a fast solution, but it works.

Posts: 294
Registered: ‎11-05-2015

Re: How do you calculate the filename of a WMTS tile?


The algorithm is quite complex, as it needs to take into account the mapping between the WMTS coords (which grow right/east and down/south) and actual CRS coords (which may grow up/north and left/west) and how they are sliced into tiles. On top of that there is the "uniform filesystem distribution" hashing mechanism which tries to place the files so that no given folder is more full than the other.

I'm not sure whether I can disclose the specifics or I'm able to even describe them without actually pasting code Smiley Wink



What you might not know (because it's not documented for whatever reason), the Cache Filler Service has a built in Cache invalidator endpoint which you could use to quickly remove a set of tiles on all levels according to a bounding box. In the default configuration this is exposed as http://localhost:8000/CacheFillerService/invalidator/get and accepts a query in the format of: request=InvalidateBBox&productCode={productCode}&minx={minx}&miny={miny}&maxx={maxx}&maxy={maxy}&crs={crs}

So if I would enter the following URL in my browser: http://localhost:8000/CacheFillerService/invalidator/get/?request=InvalidateBBox&productCode=USA_SAMPLE&minx=-80&maxx=80&miny=-170&maxy=170&crs=EPSG:4326 this would effectively kill my cache and make it start generating tiles all over again.


Maybe it would be sufficient for your needs, even though it doesn't allow to delete individual tiles nor specify the level you want to be processed.

Occasional Contributor
Posts: 13
Registered: ‎06-07-2016

Re: How do you calculate the filename of a WMTS tile?

Now that is an extremely helpful suggestion.  I think it might just do.



Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.