[GIS] Using UTM in leaflet efficiently

leafletprojutm

Our server is using UTM internally. We then send a large number of UTM Coordinates to display them in a custom made leaflet layer.

First we transform (unproject) them into "normal" geographical coordinates using Proj4Leaflet . Then we use leaflets latLngToLayerPoint() function in order to project them for our custom layer.

The latLngToLayerPoint() function is projecting the geographic coordinates back into point coordinates.

Is there a way to transform our UTM coordinates directly into points without making the detour by geographical coordinates? I see that there is a transform() function which is used by Leaflet internally to project "normal" latlng coordinates.

How can I get the necessary parameters to perform a transformation from EPSG 32633 to the internal 3857 projection?

Best Answer

You can use the transform set up in proj4leaflet. I expect that you have already crated a CRS in your map.options.

var my_crs = map.options.crs; // get the CRS
var my_proj = my_crs.projection; // get the projection
// transform the lat lon Point to a utm point
var my_utm_point = my_proj.project(point_in_latlng); 

If you want to set the internal coordinate system to UTM in leaflet I think you have to do a lot of recoding or use openLayers instead.