How Can I Use A GeoQuery To Sort By Both Location And Certain Value? (Android)
Solution 1:
Geofire already does something seemingly impossible on Firestore: it performs a range query on two values (lat and lon). It does this by creating a geohash value, which combines the latitude and longitude into a single value, that can be used to select a range of documents that are close to each other.
To allow additionally select on the range of another field, you'd have to find a way to combine the value of that other field into the Geohash value. It essentially means you have to find a way to express the importance of fame (your additional property) as a function of location (the distance), and compute a single field value based on that. While this may technically possible, I doubt anyone has every done it.
To learn how filtering on location works (and why adding an extra field is not as simple as it may seem), have a look at:
- the video of my talk on geofiltering on Firestore
- Jeff's much more concise Realtime GeoQueries With Firestore video and article
- Firebase/GeoFire - Most popular item at location
Post a Comment for "How Can I Use A GeoQuery To Sort By Both Location And Certain Value? (Android)"