I've set up a Leaflet map using the fabulous Proj4Leaflet plugin. Within my map I'm using a custom reference system (EPSG:28533). The map tiles (WMTSCapabilities) are fetched and rendered. But I have encountered that the tiles are transformed to the wrong location. The offset is approximately +9° lat and +7° lng. I expect, that I've set the wrong origin
within the definition of the reference system (fiddle).
var rs25832 = new L.Proj.CRS(
'EPSG:25832',
'+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs', {
origin: [
// I suppose the error is here!
265948.8191,
7288831.7014
],
resolutions: [
// TileMatrixScaleDenominator * OGC_PixelWidth
17471320.7509 * 0.00028,
8735660.37545 * 0.00028,
4367830.18772 * 0.00028,
2183915.09386 * 0.00028,
1091957.54693 * 0.00028,
545978.773466 * 0.00028,
272989.386733 * 0.00028,
136494.693366 * 0.00028,
68247.3466832 * 0.00028,
34123.6733416 * 0.00028,
17061.8366708 * 0.00028,
8530.9183354 * 0.00028,
4265.4591677 * 0.00028,
2132.72958385 * 0.00028
]
}
);
var url = 'http://sg.geodatenzentrum.de/wmts_webatlasde/tile/1.0.0/webatlasde/default/DE_EPSG_25832_ADV/{z}/{y}/{x}.png';
var layer = L.tileLayer(url, {
maxZoom: rs25832.options.resolutions.length,
continuousWorld: true
}
);
var map = L.map('map', {
crs: rs25832,
center: [ 50.5881112, 7.2676084 ],
zoom: 0,
maxZoom: rs25832.options.resolutions.length,
layers: [ layer ]
});
map.on('click', function(e) {
alert('lat: ' + e.latlng.lat + ' lng: ' + e.latlng.lng)
});
As far as I understood the origin
setting it defines the upper left corner of the projected bounds of the refernce system. According to the spatialreference.org definition the bounds of this specific reference system are:
265948.8191, 6421521.2254, 677786.3629, 7288831.7014
Am I using the wrong approach to determine the CRS origin
?
NOACCESS_METHOD GetTile
error, which means we cannot see your codepen properly.