2

is it possible to display markers with UTM coordinates (zone 32) with leaflet and OSM? How can I do this? If I use UTM Coordinates like latlng, the position is totally wrong:

        L.marker([5698015.694, 312400.093]).addTo(map)
        .bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();

Did I have to translate them first, or is it possible to display UTM coordinates directly with leaflet?

2

Leaflet does not do coordinate translation (except the implicit one between LatLon and Web mercator).

Check out https://github.com/kartena/Proj4Leaflet, this should enable you to work with UTM coordnates (WGS84 UTM Zone 32 is EPSG:32632, proj4js def here: http://spatialreference.org/ref/epsg/32632/proj4js/)

1

Now (released in July 2017) you can use this plugin https://github.com/jjimenezshaw/Leaflet.UTM, much simpler than Proj4Leaflet if you just want to convert to and from UTM coordinates. It works for any zone.

Your Answer

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

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