1

I'm using Proj4Leaflet to use tile layers with a different CRS (EPSG:25832) in my leaflet project.

Now I am somehow lost in finding the correct values for the bounds and origin of the tiles I want to use (https://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/EU_EPSG_25832_TOPPLUS/{z}/{y}/{x}.png). I've constructed this tile request by inspecting the capabilities of this WMTS (here is a link to the metadata of the service).

Thanks to this post, I've already figured out how to calculate the values for the resolution.

var epsg25832 = new L.Proj.CRS(
  'EPSG:25832',
  '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', {
    origin: ? ? ? ,
    bounds: ? ? ? ,
    resolutions: [
      4891.969810252,
      2445.984905126,
      1222.9924525616,
      611.4962262808,
      305.7481131404,
      152.87405657048,
      76.43702828524,
      38.21851414248,
      19.109257071296,
      9.554628535648,
      4.777314267824,
      2.388657133912,
      1.194328566956,
      0.597164283478
    ],
  }
);

But I have no clue how to find the right values for bounds and origin. I can only find <ows:WGS84BoundingBox> in the capabilities of the WMTS. Does anyone know how to get the right values?

3

An excerpt from your webservice tilematrix EU_EPSG_25832_TOPPLUS in https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml

 <TileMatrixSet>
      <ows:Identifier>EU_EPSG_25832_TOPPLUS</ows:Identifier>
      <ows:SupportedCRS>EPSG:25832</ows:SupportedCRS>
      <TileMatrix>
        <ows:Identifier>00</ows:Identifier>
        <ScaleDenominator>17471320.7509</ScaleDenominator>
        <TopLeftCorner>-3803165.98427 8805908.08285</TopLeftCorner>
        <TileWidth>256</TileWidth>
        <TileHeight>256</TileHeight>
        <MatrixWidth>6</MatrixWidth>
        <MatrixHeight>5</MatrixHeight>
      </TileMatrix>
      ....

0.00028 = 0.00028m = 0.28mm => explanation at https://enonline.supermap.com/iServer9D/Appendix/scale.htm (if you know better docs, comments welcome)

pixelsize = resolution = 0.00028 * scaledenominator

The origin should be

TopLeftCorner x and y values in an Javascript array, e.g [-3803165.98427, 8805908.08285]

To calculate the bounds, you may look at:

Formula for bottom right corner X

TopLeftCorner X + MatrixWidth * TileWidth * ScaleDenominator * 0.00028 = 3710899.64428

and

Formula for bottom right corner Y

TopLeftCorner Y - MatrixHeight * TileWidth * ScaleDenominator * 0.00028 = 2544186.72573

You now have the values to make the bounds as coordinates for top left corner and bottom right corner can help you deduce xmin, xmax, ymin, ymax

According to Proj4Leaflet, bounds should be an L.bounds

Althought it was a bit annoying to sort out my calculations, I've confirmed them using WMTS with your web service within QGIS and also using QGIS Network Logger (need QGIS 3.5 or more and it rocks to learn OGC by inspecting network calls although you need to be aware of cache)

| improve this answer | |
  • nice tip about the plugin, I always use (perhaps used) something like Fiddler as a proxy and configure the network settings accordingly – nmtoken Feb 28 at 11:51
  • Me too in the old days but not on Windows anymore so this plugin is welcome, for me, at least – ThomasG77 Feb 28 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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