3

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?

2 Answers 2

1

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.

1
  • Thanks. I was thinking to keep Webmercator inside Leaflet. Just I was wondering if there is a way to transform directly from UTM to Webmercator without the LatLng detour.
    – Yojimbo
    Oct 27, 2014 at 13:28
0

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?

1
  • Transforming it from 32633 to 4326 to 3857 is straight forward. 4326 to 3857 is done internally by leaflet. Almost every web map uses 3857 internally. The question was if I could transform directly from 32633 to 3857 in order to achieve better performance
    – Yojimbo
    Aug 22, 2015 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.