Comments (13)
+1 same issue
from geoflutterfire.
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.
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.
Any news on this issue?
from geoflutterfire.
same here
I tried both Firestore.instance.collectionGroup('collectionName')
and Firestore.instance.collectionGroup('collectionName').reference()
but neither of them worked
from geoflutterfire.
@webertim Could you please post example how your collectionGroup query looks using GeoFlutterFire?
from geoflutterfire.
@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.
@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
from geoflutterfire.
@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.
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.
@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.
@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.
@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.
@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)
- Poorly worded/located documentation for using a where statement HOT 1
- Stream doesn't update properly HOT 1
- GoogleMapController Initialization
- in the fact this package get all docs in Firstore , either it meat radius or not !! horrible read me list , not true HOT 1
- near places not meet redious
- How to sort in order of closest? HOT 2
- How to apply geoCollection.within for polygons
- Update dependency to: flutter_lints ^2.0.1 HOT 4
- Not compiling after 3.0.0 when receiving query
- geoflutterfire stopped working with Google IO Firebase plugin updates in pubspec.yaml HOT 1
- Centered on same set of data locations, Query result succeeds or fails depending of the radius
- Getting error on calling GeoFirePoint.data HOT 1
- Empty result when querying "within" on collection HOT 6
- It simple stop working
- Additional Maintainers HOT 4
- Please update flutter_lints pakage to new version or remove from geoflutterfire HOT 4
- cloud_firestore: ^4.0.2 - compatibility HOT 7
- Cloud Call Error when querying documents through GeoFlutterFire
- Example: Could we replace BehaviorSubject with Dart StreamController?
- geoflutterfire >=3.0.2 depends on cloud_firestore ^3.1.6, but I have cloud_firestore ^4.4.4. I have to downgrade to make it work? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoflutterfire.