7

I am trying to write a program which will render tiles from EPSG2180-based WMTS server. Given coordinates of a point (WSG84 or EPSG2180, I can convert from one to another) I want to render a tile containing it.

Each TileMatrix has info about TileWidth/Height, MatrixWidth/Height, TopLeftCorner and I understand what they mean. However, they don't seem sufficient to translate lat/lon to row/column. Apart from those each TileMatrix has mysterious ScaleDenominator value.

What is ScaleDenominator and what is the relationship between it and other values describing TileMatrix? How can I use it to translate lat/lon to tile's row/column?

3
  • 3
    The standard portal.opengeospatial.org/files/?artifact_id=35326 tries to give an answer to both of your questions. Please quote the parts that remains unclear for you.
    – user30184
    Commented Mar 18, 2019 at 19:54
  • 1
    Everything is clear now, thank you very much! As an amateur I didn't even think of googling "wmts standard", I didn't expect such doc to be so human-friendly. Thanks again!
    – hugo
    Commented Mar 18, 2019 at 20:54
  • 2
    @hugo please add and accept an answer to help out future users who have the sam equestion
    – Ian Turton
    Commented Mar 19, 2019 at 8:34

1 Answer 1

13

Standard linked by @user30184 (portal.opengeospatial.org/files/?artifact_id=35326) explicitly and precisely defines ScaleDenominator in section 6.1 "Tile matrix set – the geometry of the tiled space":

The scale denominator is defined with respect to a "standardized rendering pixel size" of 0.28 mm × 0.28 mm (millimeters).

Scale of tiled map is 1:ScaleDenominator. Each pixel is assumed to be 0.28mm, which allows to calculate span of each tile in meters by multiplying TileWidth (or TileHeight) by ScaleDenominator * 0.00028.

Knowing real-world size of each tile in meters (and knowing that the CRS used is EPSG 2180, which uses meter as its base unit), I was finally able to determine size of the whole matrix and choose appropriate tile for given coordinates.

1
  • For those of us using EPSG:27700 (British National Grid): to get the row take the TopLeftCorner[1] and subtract the Northings before floor dividing (//) by TileHeight*ScaleDenominator*0.00028. To get the column take the Eastings and subtract the TopLeftCorner[0] before floor dividing by TileWidth*ScaleDenominator*0.00028. Commented Mar 18, 2022 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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