Git Product home page Git Product logo

Comments (13)

kareldebedts avatar kareldebedts commented on May 27, 2024 2

+1 same issue

from geoflutterfire.

poomchan avatar poomchan commented on May 27, 2024 1

Well I found this article written by Tod. It's like the prerequisites when you want to do the collection group query. This might be the reason why Firestore does not fetch you any results back while the GeoFlutterFire package did not show the error either.

https://firebase.googleblog.com/2019/06/understanding-collection-group-queries.html

I have not tried this solution because after reading the article, I decided to go with another top-level collection for my data =)

from geoflutterfire.

webertim avatar webertim commented on May 27, 2024 1

For me this is working perfectly fine. If you have questions you can contact me :)

EDIT:
I can give some general advise here:

  • Did you try to listen to the stream of your collectionGroup? Maybe there are issues there
  • Did you setup the right Firestore rules for your collection group already? f.e. if you have a collection group named places you should have a rule like match /{path=**}/places/{place}
  • Did you write the GeoHash inside the object you want to query and do you pass the function the right name for the object?

from geoflutterfire.

spiderion avatar spiderion commented on May 27, 2024

Any news on this issue?

from geoflutterfire.

poomchan avatar poomchan commented on May 27, 2024

same here
I tried both Firestore.instance.collectionGroup('collectionName') and Firestore.instance.collectionGroup('collectionName').reference() but neither of them worked

from geoflutterfire.

ramunasjurgilas avatar ramunasjurgilas commented on May 27, 2024

@webertim Could you please post example how your collectionGroup query looks using GeoFlutterFire?

from geoflutterfire.

webertim avatar webertim commented on May 27, 2024

@ramunasjurgilas Because this is a private project, I changed some of the variable names. Still should be fine for you to check out the logic behind it.

class FirestoreManager {
  Firestore _firestore = Firestore.instance;
  Geoflutterfire geoflutterfire = Geoflutterfire();

  Stream<List<DocumentSnapshot>> getPositionsInRange(double latitude, double longitude) {

    GeoFirePoint centerGeoPoint = geoflutterfire.point(latitude: latitude, longitude: longitude);

    Query collectionRef = _firestore.collectionGroup("places");
    double radius = 10;
    String field = "geoInfo";

    return geoflutterfire.collection(collectionRef: collectionRef).within(center: centerGeoPoint, radius: radius, field: field);

  }
}

There is no real magic going on here. I am still thinking there are problems with your Firestore configuration.

from geoflutterfire.

ramunasjurgilas avatar ramunasjurgilas commented on May 27, 2024

@webertim Thanks for the snippet. For me it is still not working.
I have intention, that something is wrong with my structure and field I am passing.
For me geo info located in: address.g
structure

from geoflutterfire.

webertim avatar webertim commented on May 27, 2024

@ramunasjurgilas Ok so I guess you are trying a collectionGroup-Query on playrooms right?

The first thing I notice is your structure. I am not 100% sure but I think your playground documents need a seperate field for the geo information. So i recommend not to put the 'g' field inside the 'address' map.

Another thing I see is, that your 'field' looks kind of wrong. Again I am not sure, but I think the 'g' field should be a map with a field 'geohash' (type String) and a field 'geopoint' (type Geopoint).

Same problem again... This is a private project so I cannot share a screenshot of the whole document/collection. But still here is a screenshot of the geoInfo map (in your case this would be the 'g' field), which is a top-level field.

image

If you change your Firestore stuff your code should look like this:

class FirestoreManager {
  Firestore _firestore = Firestore.instance;
  Geoflutterfire geoflutterfire = Geoflutterfire();

  Stream<List<DocumentSnapshot>> getPositionsInRange(double latitude, double longitude) {

    GeoFirePoint centerGeoPoint = geoflutterfire.point(latitude: latitude, longitude: longitude);

    Query collectionRef = _firestore.collectionGroup("playrooms");
    double radius = 10;
    String field = "g";

    return geoflutterfire.collection(collectionRef: collectionRef).within(center: centerGeoPoint, radius: radius, field: field);

  }
}

from geoflutterfire.

ramunasjurgilas avatar ramunasjurgilas commented on May 27, 2024

@webertim Thanks for your help.
You was right I needed to set these, geohas and geopoint. But I did it inside address structure.

from geoflutterfire.

webertim avatar webertim commented on May 27, 2024

@ramunasjurgilas Happy to hear that :)

But I did it inside address structure.
Interesting, I was not sure about that. But thanks for the information!

from geoflutterfire.

davemg3 avatar davemg3 commented on May 27, 2024

@webertim thank you for your feedback...
Just to add after struggling a couple of hours, that you need to build an index for your subcollection : there will be no error message with index automatic generation link. This need to be manually generated in Firestore console...

from geoflutterfire.

AndresCarden avatar AndresCarden commented on May 27, 2024

@webertimgracias por sus comentarios... Solo para agregar después de luchar un par de horas, que necesita crear un índice para su subcolección: no habrá ningún mensaje de error con el enlace de generación automática de índice. Esto debe generarse manualmente en la consola de Firestore...

how to add the index

from geoflutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.