coordinates – Understanding WMTS ScaleDenominator and Its Use Cases

coordinatesscalewmts

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?

Best Answer

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.

Related Question