Reputation: 597
I want to create a Leaflet map using the EPSG:31466 projection. I've included the proj4
library as well as the proj4leaflet
plugin. I'm planing to include this WMS service using the fp_plan
layer.
I've tried to to set up my map using the following approach (fiddle).
// Define CRS (EPSG:31466)
var rs31466 = new L.Proj.CRS(
'EPSG:31466',
'+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs',
{
origin: [
2490547.1867,
5958700.0208
],
resolutions: [
10000000 * 0.00028, //GroundResolutionInMeter * OGC_PixelWidth
5000000 * 0.00028,
2500000 * 0.00028,
1000000 * 0.00028,
500000 * 0.00028,
250000 * 0.00028,
100000 * 0.00028,
50000 * 0.00028
]
}
);
// Create the WMS layer
var wmsLayer = L.tileLayer.wms('http://xplanung.lkee.de/xplan-wms-neu/services/wms', {
version: '1.3.0',
crs: rs31466,
layers: 'fp_plan',
format: 'image/png',
transparent: false,
// The `continuousWorld` property should be set to make sure Leaflet doesn't
// try to wrap or cut off the tiles on Spherical Mercator's bounds.
continuousWorld: true
});
// Define the map
var map = L.map('map', {
crs: rs31466,
center:[51.310, 13.393],
zoom: 1,
layers: [
wmsLayer
]
});
I would have expected to see something like this:
The tiles are requested but the section does not contain the expected layer information. If I use the EPSG:25833 projection the tiles are fetched and rendered exactly in the expected manner (fiddle).
Upvotes: 4
Views: 1326
Reputation: 19069
I've whipped out an example changing the origin of the tile coordinates and adding a rectangle to check the general geographical coordinates.
It does request tiles, and it seems to me like the coordinates of the BBOXes of the requests are fine, but I can only see white tiles.
Maybe that example can help you see what's wrong?
[edit]
It seemed that Leaflet doesn't respect the coordinate order (northing-easting or easting-northing) for WMS 1.3 request on custom CRSs. I think this is a leaflet bug.
In the meantime, I updated the example with a hacked L.TileLayer.WMS.getTileUrl
function - and now it seems to load OK.
Upvotes: 1