firebase / geofire-js

GeoFire for JavaScript - Realtime location queries with Firebase
MIT License
1.44k stars 345 forks source link

Limit locations number on query #154

Closed roiamiel1 closed 3 years ago

roiamiel1 commented 7 years ago

How can I limit the number of locations I get in the query?

puf commented 3 years ago

This isn't really possible right now: a query will always fire events for all keys in range.

Most common reason for this request is to get the N keys closest to a point, which isn't possible with geohashes. If you need this, you'll either have to post-filter the results to get the closest keys, or you can do repeated queries with a progressively larger radius.