使用GeoFirestore,我可以查询一个位置(lat/lon),以查看我的集合/数据库中的任何位置是否在某个半径范围内:
val collectionRef = FirebaseFirestore.getInstance().collection("locations")
val geoFirestore = GeoFirestore(collectionRef)
val location1 = GeoPoint(37.7832, -122.4056)
val location2 = GeoPoint(37.3832, -121.4056)
val geoQuery = geoFirestore.queryAtLocation(location1, 0.6)但是,我想查询location1和location2之间的第三个位置。
例如,假设location1是墨尔本中心,location2是公园上的咒语--我可以查询矩形内的位置吗?

发布于 2019-07-05 23:16:19
GeoFirestore从基于GeoHash的文档查询开始。这导致了一个大致矩形的形状,GeoFirestore然后在内存中缩小到检查每个文档与中心的实际距离所要求的范围。
虽然GeoFirestore不支持以矩形形状返回所有文档,但是修改库以不进行距离过滤应该是相当容易的。
https://stackoverflow.com/questions/56909820
复制相似问题