makinacorpus / Leaflet.MeasureControl

Leaflet control to mesure distances on the map
https://makinacorpus.github.io/Leaflet.MeasureControl
BSD 3-Clause "New" or "Revised" License
82 stars 48 forks source link

Allow imperial mesaurement system #8

Open robbiet480 opened 10 years ago

robbiet480 commented 10 years ago

I know, we citizens of the United States are horrible because we don't use metric, but such is life.

If you could add a metric boolean option like Leaflet.Draw has on polyline, that would be great!

leplatrem commented 10 years ago

I understand don't worry :)

However I won't have time to invest in the next days. But if you contribute it, I would be glad to merge your code :) Thanks for reporting !

robbiet480 commented 10 years ago

I already looked at your code to try to determine if I can easily add in metric support, but it's not that easy because you are directly calling private functions of Leaflet.draw, which don't take metric true/false into account. I'd have to modify and pull request for both Leaflet.MeasureControl and Leaflet.Draw.

I already wrote the code, but I need to clean it up a bit first.

leplatrem commented 10 years ago

Great ! Thanks !

Wiscmapper commented 9 years ago

Has anyone been inspired to add imperial measurements? I could definitely take advantage.

robbiet480 commented 9 years ago

@Wiscmapper FYI, don't wait around for me as we stopped using the control quite a while ago and I don't think I even have the code anymore :(

jekuno commented 9 years ago

For anyone who needs this: Leaflet.MeasureControl finally calls the readableDistance function from L.GeometryUtil of leaflet.draw which already supports an isMetric flag to be true/false.

robertleeplummerjr commented 8 years ago

This achieves imperial, though it would be nice if it was smaller. I bet at least a couple of these could be removed.

L.Draw.Polyline.prototype.options.metric = false;
L.Draw.Polyline.prototype.options.imperial = true;
L.Control.Scale.prototype.options.metric = false;
L.Control.Scale.prototype.options.imperial = true;
boesiii commented 8 years ago

@robertleeplummerjr

I added

L.Draw.Polyline.prototype.options.metric = false;
L.Draw.Polyline.prototype.options.imperial = true
```;

and I am getting yards not feet.  Is there anyway to be able to get feet and or miles.
mblais29 commented 8 years ago

Has this been implemented yet? The ability to make it measure imperial not metric?

abelduran1 commented 7 years ago

Has this been implemented yet? The ability to make it measure imperial not metric?