How can I display a UTM Grid as a layer with Leaflet?
Search a way to embed a OpenStreetMap map with Leaflet in a website.
Particularity. I want to display a UTM Grid as a Layer.
In addition, lower right UTM coordinate where the mouse is.
Example with UTM grid and UTM Number:
http://geo.dianacht.de/bayluftbilder/utm.php
Solution?
https://github.com/kartena/Proj4Leaflet
Does anyone an example?
Best Answer
I can tell you the answer for the second question: How to show UTM-coordinates in the lower right corner.
In leaflet the internal coordinate system is always longitude/latitude as far as I know, and you have to transform every time you need to work with your data.
First make sure you have installed proj4.js and proj4leaflet.js. To show your coordinates you can use the plugin: https://github.com/ardhi/Leaflet.MousePosition .
Then define your coordinate system and use when you define your map object:
The function _onMouseMove() should be modified to something like this:
You will then get your mouse position in UTM. For more information see the documentation for proj4leaflet and leaflet.mouseposition.