I have a Leaflet map that is customized by an end-user by panning and zooming to an area of interest.

I'd like to then take all of the relevant parameters (projection, zoom level, bounds, etc) and submit them to a backend service that needs to project lat/long coordinates onto the screen coordinates (X, Y) of the Leaflet map.

(I do understand I could just ask Leaflet to project these points on the client-side, but this is not my goal. I do want to get the same answer as if I had done the projection on the client.)

Probably on the backend I will use something like pyproj. How can I generate a PROJ string or similar from the Leaflet map that conveys what the backend needs to do the projection?

  • I think you just want to reinvent WMS? I suggest you set up a WMS server (able to provide images in EPSG:3857) and try adding a L.TileLayer.WMS to your map. – IvanSanchez Dec 14 '20 at 9:17
  • You cannot get detailed projection parameters from Leaflet, the most you can get is projection EPSG code. – TomazicM Dec 14 '20 at 9:21

Your Answer

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

Browse other questions tagged or ask your own question.