leaflet.measure
leaflet.measure copied to clipboard
General suggestions
I really like this plugin - it's much cleaner than the other measure tool that's floating around. You should submit it to the full Leaflet plugins page.
There are two things I'd change (have changed actually in my implementation). Firstly, it would be nice if it was more easily configurable for different units - even if it just meant passing the calculation as a formula to the library when loaded. Secondly, the icon isn't too intuitive - I've shared the one I'm using below...
Thanks!
I totaly agree adding to the Leaflet Plugin list would be really practical.
I agree that there should be an option for setting units. You can add "options" to the extended Polyline class of leaflet.measurecontrol.js but this is just a hack.
L.Polyline.Measure = L.Draw.Polyline.extend({
options: {
metric: false
},
....
It would be nice to set these options when adding the control to the map (i.e. L.Control.measureControl({metric:false}).addTo(map)).
I'll try to come back to this when I have more time.
Great plugin, I'm using it at work. I've added map events to start/stop measuring in my fork, https://github.com/jonathandarrer/leaflet.measure which my company is now using. If you want to pull this change into your repository, then feel free to. What do you think?
_startMeasuring: function() {
...
this._map.fire('measure:measurestart', { layerType: this.type });
...
}
_stopMeasuring: function() {
...
this._map.fire('measure:measurestop', { layerType: this.type });
...
}