I have a leaflet map created from an image using imageOverlay for indoor map rendering purposes, I'm wondering given the leaflet latitudes and longitudes how to get the x,y pixels of the image.
2 Answers
The simplest conversion for setting and getting pixel coordinates from Lat/Lng system is to use:
- Project: to convert from lat/lng to pixels
project(<LatLng> latlng, <Number> zoom)
- Unproject: to convert from pixels to lat/lng
unproject(<Point> point, <Number> zoom)
Always you can refer to Leaflet reference
P.S: consider the Map CRS is set to Simple
Check Non-geographical maps tutorial for using CRS Simple coordinate reference system. This way you can use lat-long concepts like x-y offset on images.