[英]Filter a database of locations due to user's current location with radius
Hey guys i'm developing a specific android app which has a BigData of locations all over a country,i want to filter those locations due to user's current location with a radius. 大家好,我正在开发一个特定的android应用,该应用在一个国家/地区具有BigData位置信息,我想根据用户当前所在的半径来过滤这些位置信息。
To clarify my purpose my user is a car driver that chooses a random road on Google Map by specifying the start and the end point using Markers then i draw a road between those points using Google API 为了说明我的目的,我的用户是一位汽车驾驶员,他通过使用Markers指定起点和终点在Google Map上选择了一条随机道路,然后我使用Google API在这些点之间绘制了一条道路
What i want to do is getting the locations from my database that lies on the selected road only so i thought of filtering my database locations due to user's current location and give it a radius which is the distance on the road(the distance between the two Markers chosen by the user) and start showing them on the map. 我想做的是从我的数据库中获取仅位于所选道路上的位置,因此我想到了根据用户的当前位置过滤数据库位置,并为其指定半径作为道路上的距离(两者之间的距离)用户选择的标记),然后开始在地图上显示它们。
Note:I thought of comparing the locations in my database with the user's current location, If it is shorter than the radius(the distance between the two Markers) then i will add it to my filtration result 注意:我考虑过将数据库中的位置与用户的当前位置进行比较,如果它比半径(两个标记之间的距离)短,那么我会将其添加到过滤结果中
but i think it's a mess i have a BigData and it would take too much time to compare. 但我认为拥有BigData实在是一团糟,比较起来需要太多时间。
Is there any algorithm or API that Google Maps Provides for this problem that i can use to filter? Google Maps是否提供可用于过滤此问题的算法或API? even if it's written in a web programming language i can create a web service to handle it and send it to my application.
即使它是用Web编程语言编写的,我也可以创建一个Web服务来处理它并将其发送到我的应用程序。
Use KD-tree K nearst neighbours, to filter the points that are away from the car. 使用附近的KD树K过滤远离汽车的点。 and that's log N time complexity.
这就是N倍的时间复杂度。 but inserting into the tree is N*log N
但是插入树是N * log N
I have find a solution for my problem 我找到了解决我问题的方法
In my application i'm using Firebase as cloudbacked and fortunately it has a library that performs GeoQueries called GeoFire it's documentation is here 在我的应用程序中,我使用Firebase作为云备份,幸运的是,它具有一个执行GeoQueries的库,称为GeoFire,其文档在此处
It can create a query of all saved locations in Firebase due to a specific location by a radius in milliseconds which is what i really need 由于特定的位置(以毫秒为单位的半径),它可以创建Firebase中所有保存位置的查询,这正是我真正需要的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.