I have a production app and this doesn't seem to be working as expected, need help ASAP! I am trying to find objects in range of 4 kms, so I am using this example in docs:
Now, the above venue should not be listed, as it is not in range of 4 km from origin, but actually it is listed. I've tried to narrow the distance to see at what point this venue will not be listed, and I got to:
I have a production app and this doesn't seem to be working as expected, need help ASAP! I am trying to find objects in range of 4 kms, so I am using this example in docs:
Location.within(5, :units => :kms, :origin => @somewhere)
it will get the records within 5 kilometers instead of 5 miles
in my case it will be:
venues = Venue.within(4, units: :kms, origin: [44.1133355, -79.376071])
Also, to make sure it shows proper results, I am using this route as reference: https://www.google.com/maps/dir/44.088102,-79.3346276/19619+McCowan+Rd,+Mount+Albert,+ON+L0G+1M0,+Canada/@44.1132739,-79.3760709,13z/data=!3m1!4b1!4m8!4m7!1m0!1m5!1m1!1s0x89d534903b40df85:0x3a15c399937141ab!2m2!1d-79.3473307!2d44.1384912 it shows 5.7 km from origin to destination.
Now, the above venue should not be listed, as it is not in range of 4 km from origin, but actually it is listed. I've tried to narrow the distance to see at what point this venue will not be listed, and I got to:
Now, 3.6 miles to kms = 5.79364... and venue is not listed. This makes me think that within method ignores the units option and uses miles as units.
My setup:
Thank you.