Using UTM in leaflet efficiently?
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?
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.
What are you actually doing?
If you get your coordinates in to 4326 using Proj4, then you can add those points straight to the map, or form geojson points and add them.
I'm suspicious you're overthinking it though! Check out the top example here: http://leafletjs.com/examples/geojson.html - it should be obvious from there how to go from lat/lon (WGS, EPSG:4326) into a dot on a Leaflet map. And you already know how to convert from 32633 to 4326, right?