kartena/Proj4Leaflet — Issue #9: Sweref and WMS problems..
Author: fredriklindmark
Created: 2012-02-14 09:35:08+00:00
State: open

Hi,

I have som problem getting a wms up and running with leaflet/proj4leaflet using sweref99..

This is my code, any ideas on how to get this running whould be much appreciated:

var map;
Proj4js.defs["EPSG:3006"] = "+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";
var res = [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5];

var topo = new L.TileLayer.WMS("http://localhost:8080/wms", {
layers: 'topo',
format: 'image/jpg',
continuousWorld: true
});

map = new L.Map('map', {
crs: L.CRS.proj4js('EPSG:3006', '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
new L.Transformation(1, -200000, -1, 6100000)),
center: new L.LatLng(60,15),
zoom: 5,
layers: [topo],
continuousWorld: true,
scale: function(zoom) {
return 1 / res[zoom];
}
});

This works nicely using WGS84:

var topo = new L.TileLayer.WMS("http://localhost:8080/wms", {
layers: 'topo',
format: 'image/png',
transparent: true
});

map = new L.Map('map', {
crs: L.CRS.EPSG4326,
center: new L.LatLng(60, 15),
zoom: 5,
layers: [topo],
zoomControl: true
});