beerstorm-net / GeoFlutterFire2

🔥GeoFlutterFire2🔥 is an open-source library that allows you to store and query firestore documents based on their geographic location.
https://pub.dev/packages/geoflutterfire2
MIT License
14 stars 40 forks source link

Empty result when querying "within" on collection #14

Closed WieFel closed 2 years ago

WieFel commented 2 years ago

Hi, reposting this here (previously posted on geoflutterfire issues).

I am always getting empty results when querying my collection for close documents within 1km or whatever other distance I choose. For being sure, I just created a new collection in my firestore called test, with one document which has some hardcoded coordinates. image

In my flutter code, i then query documents in a radius of 1km of that same pair of lat/lon, but I still get an empty result.

Stream<List<DocumentSnapshot>> get closeDocumentsStream {
    var radius = 1.0; // [km]
    var point = GeoFirePoint(36.723594, -4.4227609);
    return geo.collection(collectionRef: firebaseState.test).within(
          center: point,
          radius: radius,
          field: "position",
        );
  }

(where firebaseState.test is defined as get test => _firestore.collection("test");

Running Flutter 3.0.2 and Dart 2.17.3, with package versions geoflutterfire: ^3.0.2 and cloud_firestore: ^3.1.17.

Any hints on what I could be doing wrong?

WieFel commented 2 years ago

Solved by https://github.com/DarshanGowda0/GeoFlutterFire/issues/191#issuecomment-1205148910