arjunmehta/node-georedis

withDistances doesn't respect `units` parameter

Closed this issue · 7 comments

Hey! I noticed that when doing a query like:

geo.nearby(location, 0.5, { withDistances: true, units: 'mi' }, function(err, locations) {
    // locations contain a distance key, but the distance is in meters
})

Not a big deal (I can do the conversion on my side), but I figured it might be nice to have the units be consistent if it's an easy change.

Hey there @jesseditson

Thanks so much for reporting this.
Can you confirm a few things?

Are you using the nativeGeo mode? (ie. do you have redis 3.1.199 or higher?)
If not, were you using the accurate option? I found a bug in the code where I forgot to convert units, but only when using the accurate option in emulated mode.

Hey! I'm using accurate, and I'm not using native yet - currently on v2.8.19, so it sounds like I'm experiencing the exact bug you mentioned!

Oh perfect. I'll fix and publish in a sec.

Published! Give it a try.

Awesome! I'll bump my version and test it out!

This looks good on my end! Seems to be fixed by 2a564c3. Thanks a bunch!

Awesome. Thanks for reporting the bug!