0

Is it possible in leaflet to drop marker with 3857 projection on map?

I found a solution where i first translate a point to 4326 using proj4js and than drop it on a map.

var source = new Proj4js.Proj('EPSG:3857');
    var dest = new Proj4js.Proj('EPSG:4326');
    var p = new Proj4js.Point(-12307.601047734, 6711475.1283642);
    Proj4js.transform(source, dest, p);

new L.Marker([p.y, p.x], {bounceOnAdd: true}).addTo(map);

Is there any other way in core leaflet or leaflet plugin to drop marker without using proj4js library?

1

There is a Proj4 Leaflet plugin (built on top of Proj4js) that you could try - https://github.com/kartena/Proj4Leaflet

Although the author of that plugin has stated that it is not possible to have multiple projections on the same leaflet map - suggesting you might want your entire leaflet map (and all markers/layers) to be in 3857...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.