Closed brendan33 closed 4 years ago
The issue is that Leaflet accepts coordinates in [latitude, longitude]
form, while Cheap Ruler assumes [longitude, latitude]
. If you swap the order, the calculation is correct.
Well that's embarrassing! Thanks!
I've implemented
along
into a project and noticed some strange results (returned points being either too far along the line, or not far enough). I just found this Codepen via Google and it is seems to be giving incorrect results too. The green circle should be 250m from the top blue circle, but measuring the distance on Google Maps puts it not even close, at ~208mInterestingly,
ruler.distance
puts the total line length at 852m, but Google Maps says it's 739m.Am I missing something here?
PS. the codepen example is using an older version, but changing to v3.0.1, and after a few tweaks to get it running, the results are basically the same.