kartena / Proj4Leaflet

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

Trouble with EPSG:2154 #8

Closed kolxo closed 12 years ago

kolxo commented 12 years ago

Hi,

I have troubles using the following code

map = new L.Map('map', {
  crs: L.CRS.proj4js('EPSG:2154'
    ,'+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
    ,new L.Transformation(1, 0, -1, 0))
  });

I just add a Canvas layer such as :

canvasTiles.drawTile = function(canvas, tilePoint, zoom) { var ctx = canvas.getContext('2d'); ctx.rect(0,0, 256,256); ctx.stroke(); ctx.fillText('(' + tilePoint.x + ', ' + tilePoint.y + ')',5,10);

            });

Such layer draw a grid with tile coord on vanilla Leaflet. But with the map on EPSG:2154, nothing happen. I try to play with transformation parameters without success.

Is there something wrong with my map declaration ?

Thanks in advance for your support

gallien-lbr commented 12 years ago

Hey, I am having the same problem. (using Kartena's proj4leaflet lib) I have tried different parameters with transformation ..

Have you figured out how to add EPSG 2154 to LeafLet ?

kolxo commented 12 years ago

Hi,

No I'm sorry, Currently I'm not able to add EPSG 2154 with proj4Leaflet. I use directly proj4j before displaying data. It's tedious and I don't know why it doesn't worK.

2012/7/4 gallab < reply@reply.github.com

Hey, I am having the same problem. (using Kartena's proj4leaflet lib) I have tried different parameters with transformation ..

Have you figured out how to add EPSG 2154 to LeafLet ?


Reply to this email directly or view it on GitHub: https://github.com/kartena/Proj4Leaflet/issues/8#issuecomment-6760597

sylvainbeo commented 12 years ago

Hi,

Same problem for me. I managed to set my map in 2154 projection, and display some WMS layers. But no success with Tile Layers. I've tried a lots of transformation matrix, and one time i managed to display the tiles on a specific zoom. But the matrix was only correct for that zoom level...

leplatrem commented 12 years ago

Do you know if is really related to 2154 or to any local projection ?

leplatrem commented 12 years ago

It works well with Leaflet 0.3.1, check out the following code : http://blog.mathieu-leplatre.info/leaflet-tiles-in-lambert-93-projection-2154.html

However the map is blank with Leaflet 0.4.2... tilepoints look out of bounds (unprojected?)

leplatrem commented 12 years ago

Took me a while to figure out that Leaflet 0.4 now expects a scale() method in CRS classes.

Could fix easily setting scale attribute to the resulting crs object.

ghost commented 12 years ago

Yep there was a breaking change between Leaflet 0.3 and 0.4. You now need to set the scale function on the crs object instead of on the map object like @leplatrem says. Closing, but feel free to comment if this didn't solve the issue.