GithubHelp home page GithubHelp logo

geo_firestore's People

Contributors

joscmw95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

geo_firestore's Issues

Can't upgrade firebase packages with geo_firestore

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.)

How to combine with firestore query

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?

List view - dynamic is not a subtype of string

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:

  • streambuilder - populates listview with snapshot unfiltered data, does not work with .for each
  • .tolist - does not contruct data in proper format for a list view
  • create listview from clients or markers - only shows the first geoHash, many times (.length)
  • only able to list geoHash, not title

Here is my submit code:

() async {
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
await geoFirestore.setLocation((roomnameController.text), GeoPoint(position.latitude, position.longitude));

  • only two fields are passed, geoHash, and location(lat,lng)
    • it seems additional fields (from a form) cannot be passed using setLocation.

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.

goal1

removeLocation() has too many arguments

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?

getAtLocation returning an empty list

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));

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.