arjunmehta / node-georedis

Super fast geo queries.
MIT License
192 stars 33 forks source link

withDistances doesn't respect `units` parameter #3

Closed jesseditson closed 8 years ago

jesseditson commented 8 years ago

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.

arjunmehta commented 8 years ago

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.

jesseditson commented 8 years ago

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!

arjunmehta commented 8 years ago

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

arjunmehta commented 8 years ago

Published! Give it a try.

jesseditson commented 8 years ago

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

jesseditson commented 8 years ago

This looks good on my end! Seems to be fixed by https://github.com/arjunmehta/node-georedis/commit/2a564c333c0f129c15e90fec05a30e9fe34435cc. Thanks a bunch!

arjunmehta commented 8 years ago

Awesome. Thanks for reporting the bug!