kartena/Proj4Leaflet — Issue #6: Marker position / map center when using Proj4Leaflet (EPSG:3946)
Author: fnicollet
Created: 2012-01-03 17:04:02+00:00
State: open

Hello,
Thanks for this contribution to Leaflet, very useful.
I am using a TMS with this service description:
http://carto3.lyon.fr/cgi-bin/tms/tilemap.pl?SERVICE=TMS&PORT=1300&SERVICE_NAME=vdl
Here is my integration script:
```
var res = [156543.033928, 78271.516964, 39135.758482, 19567.879241, 9783.939621, 4891.96981, 2445.984905, 1222.992453, 611.496226, 305.748113, 152.874057, 76.437028, 38.218514, 19.109257, 9.554629, 4.777314, 2.388657, 1.194329, 0.5971645, 0.29858225];
var start = new L.LatLng(45.8, 5);
var crs = L.CRS.proj4js('EPSG:3946'
,'+proj=lcc +lat_1=45.25 +lat_2=46.75 +lat_0=46 +lon_0=3 +x_0=1700000 +y_0=5200000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
,new L.Transformation(1, 0, -1, 0));
var map = new L.Map('map', {
crs: crs,
scale: function(zoom) {
return 1 / res[zoom];
}
,continuousWorld: true
});
var mapUrl = 'http://carto3.lyon.fr/tms/1300/vdl/{z}/{x}/{y}.png';
var attrib = 'Aigle map';
var tilelayer = new L.TileLayer(mapUrl, {
scheme: 'tms'
,maxZoom: 19
,minZoom: 0
,continuousWorld: true
,attribution: attrib
});
map.addLayer(tilelayer);
map.setView(start, 6);
var marker = new L.Marker(start);
map.addLayer(marker);
```
When I open the map, it is completly offset, the map is actually down south, easier to reach if you unzoom a few times. When I add a Marker, it is also completly off.
That's surely because I pass a L.LatLng object to the map and to the marker with unprojected coordinates but I don't know how to do it another way.
Could you give me a hand please?

Thanks a lot,
Fabien