相关疑难解决方法(0)

有没有办法将GeoFire与Firestore一起使用?

GeoFire与实时数据库紧密耦合,而地理查询是许多希望迁移到Firestore的应用程序的常见功能依赖.有没有办法在Firestore环境中复制散列/检索位置?

firebase geofire firebase-realtime-database google-cloud-firestore

51
推荐指数
4
解决办法
1万
查看次数

如何在Firebase Cloud Firestore中查询集合中最近的GeoPoints?

新的Firestore DB允许我存储GeoPoints.有没有办法根据它们进行查询?

因此,例如,如果我的每个集合文档都有一个location类型的字段geopoint.如何将最近的10个文档放到任意坐标?

文档似乎没有涵盖这一点.我试过这样的东西:

someRef.where('location', '>', geopoint).limit(10).get();
Run Code Online (Sandbox Code Playgroud)

显然这没有多大意义,但我只是在尝试一些东西

firebase google-cloud-firestore

29
推荐指数
2
解决办法
9867
查看次数

如何在 Flutter 中查询 Firebase Firestore 中 Geopoint 类型的字段?

我正在查询 firestore 集合以查找纬度和经度范围内的文档。由于看来您无法使用给定两个不同字段(“lat”、“lon”)的参数进行查询,因此我已将 Geopoint 类型分配给具有经度和纬度的单个字段“coords”。如何将 .where() 与地理点一起使用?下面是我想要使用的一般查询,其中 _latMin、_latMax 等是链接到地图边界框的变量。

_getDocs() async {
  print('getdocs');
  final QuerySnapshot snapshot = await FirebaseFirestore.instance
      .collection('collectionName')
      .where(
        'coords',
        isGreaterThan: _latMin,
        isLessThan: _latMax,
      )
      .where(
        'coords',
        isGreaterThan: _lonMin,
        isLessThan: _lonMax,
      )
      .get();
  snapshot.docs.forEach((DocumentSnapshot doc) {
    print(doc.data());
  });
}
Run Code Online (Sandbox Code Playgroud)

如何引用坐标内的纬度和经度?

在此输入图像描述

在此输入图像描述

firebase flutter google-cloud-firestore

0
推荐指数
1
解决办法
3790
查看次数