Closed renegadeandy closed 7 years ago
This was actually user error - the code shown here works entirely. Apologies for wasting any time. This question ties up to : https://stackoverflow.com/questions/44535413/calculating-the-distance-between-2-latitude-and-longitude-locations-in-a-rails-p/44610235#44610235
I have a Leg object - which contains both 1 origin object and 1 destination object.
Origin looks like this :
The destination model looks like this:
Then I call this line in my Leg object, to get a distance between an origin and destination. Both the origin and destination records exist - with valid latitude and longitude values in the DB.
The distance returned is always 0.0, despite using valid origin / destination objects which have appropriate values in the latitude and longitude columns.
Am I using this wrong? Can anybody help?