Leaflet – Creating CRS Scales and Resolution from WMTS getCapabilities ScaleDenominator with Proj4Leaflet

leafletwmts

I trying to set up the CRS scales/resolution for a map accordingly to the provided information of an WMTS getCapabilities request. At the moment I'm playing with the following service.

The service provides me with the following TileMatrix information:

<TileMatrix>
  <ows:Identifier>00</ows:Identifier>
  <ScaleDenominator>1889880.95238</ScaleDenominator>
  <TopLeftCorner>200000.0 6075000.0</TopLeftCorner>
  <TileWidth>256</TileWidth>
  <TileHeight>256</TileHeight>
  <MatrixWidth>3</MatrixWidth>
  <MatrixHeight>2</MatrixHeight>
</TileMatrix>
...

Based on an OpenLayers example from this source the resolutions should be:

[
   529.166666667,
   ...
]

I've created a fiddle that uses the resolutions specified in the example. Using these informations the map displays as expected. But how do I calculate the resolution based on the provided ScaleDenominator?

Best Answer

I've managed to calculate the resolutions using the following equation:

resolution = ScaleDenominator * PixelWidth

529.166666667 = 1889880.95238 * 0.00028