Rank 2: Process
I am encountering an issue while retrieving documents based on their location data within an Appwrite collection. I'm following the guidance provided in the forum thread (https://appwrite.io/threads/1132861274062082058 and https://levelup.gitconnected.com/building-a-location-based-app-with-appwrite-48a2e2b6d4c2#8e5c) but I'm not getting the expected results.
Current Situation:
I have two documents in my collection with attributes named lat and lang containing the following latitude and longitude values:
Document 1: lat - 13.030373668739, long - 77.750823773725
Document 2: lat - 14.030373668739, doc - 78.750823773725
I'm calculating bounds using the Bounds.getBounds function with a center point (Point(lng: 14.030373668738747, lat: 78.75082377372495)) and a specific distance (2 in this case).
The constructed query uses these bounds to filter documents based on latitude and longitude:
_appwriteService.databases.listDocuments(
databaseId: 'databaseID',
collectionId:'collectionID',
queries: [
Query.greaterThan('lat', location.south.lat),
Query.lessThan('lat', location.north.lat),
Query.greaterThan('long', location.west.lng),
Query.lessThan('long', location.north.lng),
]);
Problem:
Despite the documents having location data within the calculated bounds, the query isn't returning any results.
I would appreciate your assistance in identifying the reason why the documents aren't being retrieved.
Is there a potential issue with the query construction or the bounds calculation? Any suggestions or troubleshooting steps would be greatly helpful.