joscmw95 / geo_firestore Goto Github PK
View Code? Open in Web Editor NEWGeoFirestore for Flutter to do location based queries with Firestore
License: MIT License
GeoFirestore for Flutter to do location based queries with Firestore
License: MIT License
See the results of flutter pub upgrade
:
Because every version of geo_firestore depends on cloud_firestore ^0.12.2 and your app depends on cloud_firestore ^0.13.4+2, geo_firestore is forbidden.
So, because nothing_new depends on geo_firestore ^0.0.1, version solving failed.
pub upgrade failed (1; So, because nothing_new depends on geo_firestore ^0.0.1, version solving failed.)
Looking at examples, the collection is being queried by location criteria alone.
Is it possible to query near by geopoint along with some other criteria on another field?
My goal is to have a map that shows filtered markers from geo firestore, and the same filtered results in listview tiles below the map. I've gotten the markers on the map working perfectly.
populateClients() async {
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
final queryLocation = GeoPoint(position.latitude, position.longitude);
List documents = await geoFirestore.getAtLocation(queryLocation, 10.0);
documents.forEach((document) {
print(document.data);
});
The second part "listview" is what I'm having trouble with. Here is what i've tried:
Here is my submit code:
() async {
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
await geoFirestore.setLocation((roomnameController.text), GeoPoint(position.latitude, position.longitude));
My next step is to try an inheritable widget but I feel like i'm going to have the same issues, but they will be available everywhere.
Am I approaching this wrong? Did I use geofirestore correctly? Any help is appreciated.
The documentation says that removeLocation() only needs a 'documentID' parameter. However, the actual code requires a second parameter of 'location'. Looking at the code, it doesn't appear the 'location' parameter is being used. Could it be removed to match the documentation?
I've tried the following code, but it's failing to retrieve any snapshots. Using the node.js library works fine with the same center coordinates and same Firestore collection.
Working (node.js):
export const getNear = async (center: number[], radius: number) => {
const geofirestore: GeoFirestore = new GeoFirestore(firestore);
const geocollection: GeoCollectionReference = geofirestore.collection(
"businesses"
);
const query: GeoQuery = geocollection.near({
center: new admin.firestore.GeoPoint(center[0], center[1]),
radius
});
const queryResults = await query.get();
console.log(queryResults.docs);
return queryResults.docs.map(doc => doc.data());
};
const getNearResponse = await business.getNear(
[-1.7970149, -80.757148],
1000
);
Not working (Dart):
_populateBusinesses() async {
final GeoFirestore geocollection =
GeoFirestore(firestore.collection('businesses'));
final queryLocation = GeoPoint(-1.7970149, -80.757148);
List<DocumentSnapshot> snapshots =
await geocollection.getAtLocation(queryLocation, 1000);
// snapshots is always an empty List
final documents = snapshots.map((doc) {
return doc.data;
}).toList();
setState(() {
_documents = documents;
});
}
I managed to trace the calls into this lib, and it seems the issue is occurring in queriesAtLocation()
. Specifically in this series of calls:
queries.add(queryForGeoHash(geoHash, queryBits)); // queries.single: GeoHashQuery
queries.add(queryForGeoHash(geoHashE, queryBits)); // queries.single: GeoHashQuery
queries.add(queryForGeoHash(geoHashW, queryBits)); // queries.single: GeoHashQuery
queries.add(queryForGeoHash(geoHashN, queryBits)); // queries.single: Unhandled exception: Bad state: Too many elements
// After this things seem broken
queries.add(queryForGeoHash(geoHashNE, queryBits));
queries.add(queryForGeoHash(geoHashNW, queryBits));
queries.add(queryForGeoHash(geoHashS, queryBits));
queries.add(queryForGeoHash(geoHashSE, queryBits));
queries.add(queryForGeoHash(geoHashSW, queryBits));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.