I am trying to change the CRS of a web mapping service in Norway. The projection is EPSG:25832.
Here is the WMTS service: https://kartkatalog.geonorge.no/metadata/norge-i-bilder/norge-i-bilder-wmts-euref89-utm32/61ed45e1-2ef3-4f94-873c-e9dcb6be4aa6
Here is the example from Proj4Leaflet Documentation:
var crs = new L.Proj.CRS('EPSG:2400',
'+lon_0=15.808277777799999 +lat_0=0.0 +k=1.0 +x_0=1500000.0 ' +
'+y_0=0.0 +proj=tmerc +ellps=bessel +units=m ' +
'+towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0 +no_defs',
{
resolutions: [8192, 4096, 2048] // 3 example zoom level resolutions
}
);
The WMS loads using the code below when the CRS information is not being used. The map centers on northern Norway but it should be centering near Oslo.
There is something wrong with the CRS information then or how I am using proj4.js?
var crs = new L.Proj.CRS('EPSG:25832', '+proj=utm +zone=32 +ellps=GRS80
+towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
{
resolutions: [
131073, 65537, 32769, 16385, 8193, 4097, 2049, 1025, 513, 257,
129,
65, 33, 17, 9, 5, 3, 2
],
origin: [-2000000.0, 9045984.0],
bounds: L.bounds( [-2000000.0, 3500000.0], [3545984.0, 9045984.0])
})
var key ='****************'
var map = L.map('mapid',{
zoomControl: false,
zoomSnap: 0.1,
// crs: crs,
continuousWorld: true,
worldCopyJump: false
}).setView([59.877812, 8.590628], 5);
var gkt = '***************';
var url =
'http://gatekeeper{s}.geonorge.no/BaatGatekeeper/gk/gk.nib_utm32_wmts_v2?&gkt='
+ gkt
+'&layer=Nibcache_UTM32_EUREF89&style=default&tilematrixset=default028mm&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={z}&TileCol={x}&TileRow={y}';
var wms = new L.TileLayer(url, {
subdomains: ['1', '2', '3'],
maxZoom: 16,
minZoom: 0,
attribution: ''
}).addTo(map)