You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all: i created two docs as a test, every doc has difference position with some meters as distance between them.
Gere is set data to Firestore:
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best);
final geo = Geoflutterfire();
GeoFirePoint myLocation = geo.point(latitude: position.latitude, longitude:
position.longitude);
FirebaseFirestore.instance.collection( "location").doc('testUser1').update({
'position': myLocation.data,
'latitude':myLocation.latitude,
'longitude': myLocation.longitude,
});
Note: i also created doc for testuser2.
Here i need to see results:
Future getNearDistanceForTest()async{
final geo = Geoflutterfire();
//this my lati-longi as a test user1
GeoFirePoint? center = geo.point(latitude: currentUser.latitude!, longitude:
currentUser.latitude!);
var collectionReference = FirebaseFirestore.instance.collection('location');
double radius = 20; // here i am trying to get only 20km as a distance even though the distance is not more then 10 meters between test user1 and 2
String field = 'position';
await geo.collection(collectionRef: collectionReference)
.within(center: center, radius: radius, field: field, strictMode: true).forEach((element) {
print(element.length); // output 0
});
}
As shown in example the output is 0, but when i increase the radius to a high for example to 500.
So finally the output is 1 , even though the distance is closer than that mush of radius.
i think it needs fixing
The text was updated successfully, but these errors were encountered:
jack84156
changed the title
near places no meet redious
near places not meet redious
Feb 28, 2022
First of all: i created two docs as a test, every doc has difference position with some meters as distance between them.
As shown in example the output is 0, but when i increase the radius to a high for example to 500.
So finally the output is 1 , even though the distance is closer than that mush of radius.
i think it needs fixing
The text was updated successfully, but these errors were encountered: