Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort by nearest without any radius #25

Closed
sagark1510 opened this issue Aug 7, 2018 · 1 comment
Closed

Sort by nearest without any radius #25

sagark1510 opened this issue Aug 7, 2018 · 1 comment

Comments

@sagark1510
Copy link

Great library, my objective is to list out the records based on the nearest to farthest based on the current location and I don't want it to limit with any radius.

how can I achieve this?

@MichaelSolati
Copy link
Owner

@sagark1510 unfortunately the purpose of this package is to query locations near a center point. A filter is kinda the point. Otherwise for what you're trying to do I'd say do the following:

  1. Use regular Firestore to query all locations
  2. Add a distance field to the returning docs (I have a package called geokit which you can install on NPM, it has a static function called distance, see it in use here)
  3. Just apply a sort to the array of objects, like here

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants