kartena / Proj4Leaflet

Smooth Proj4js integration with Leaflet.
http://kartena.github.io/Proj4Leaflet/
BSD 2-Clause "Simplified" License
589 stars 173 forks source link

Problems using EPSG:31466 with WMS layer - A cry for help #111

Closed cg-fd closed 8 years ago

cg-fd commented 8 years ago

Hey,

I've been struggling with Leaflet and the Proj4Leaflet plugin. I want to create a Leaflet map using the EPSG:31466 projection. 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:

Expected result

The tiles are requested, but they do not contain the information of the expected extent. This can be seen in the provided (fiddle). I've already opened a question on stackoverflow and set a bounty, but so far nobody could help me to find a satisfying answer. If I use the EPSG:25833 projection the tiles are fetched and rendered exactly in the expected manner (fiddle).

semone commented 8 years ago

Hi!

I saw that you got an answer to this in the stackoverflow question you mentioned above!

The problems you are having is related to this issue https://github.com/Leaflet/Leaflet/issues/4253

Thanks @IvanSanchez :smiley:

cg-fd commented 8 years ago

Yes, I guess the issue can be marked as resolved.

IvanSanchez commented 8 years ago

Hah, I wasn't aware this was asked here.

May I use this opportunity to remind everybody that bug trackers are not the right place for support requests. The "main" Leaflet team has a policy of sending this kind of things to stackoverflow/stackexchange.

cg-fd commented 8 years ago

Sry for the noise.