Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert point to LatLng on Leaflet

Tags:

leaflet

I'm trying to get the right location of my point on the map as Latlng:

let point = L.point(0,0) // x=0,y=0
let latlng = map.unproject(point)

but the latlng value is not the real location!

what am i missing ?

like image 656
YairTawil Avatar asked Jan 28 '26 04:01

YairTawil


1 Answers

the function: unproject is not correct.

you should use: layerPointToLatLng:

let point = L.point(0,0); // x=0,y=0
let latlng = map.layerPointToLatLng(point);

regards

Rachel

like image 185
Racheli Frish Avatar answered Feb 01 '26 14:02

Racheli Frish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!