查找最接近的值(坐标) [英] Find closest value (coordinate)
本文介绍了查找最接近的值(坐标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个gps项目。
我有一个大约有70 000个坐标的数据库。我需要找到与我实际位置最接近的坐标。
这必须每1秒更新一次。有什么建议怎么做?
我尝试过:
现在我将数据库加载到Datagridview。
考虑计算到每个点的距离并按距离对它们进行排序。但我认为这将减慢我必须每秒更新。
I'm working on a gps-project.
I have a database with about 70 000 coordinates. I need to find the closest coordinate to my actual position.
This has to update every 1 sec. Any suggestions how to do this?
What I have tried:
Right now i load the database to a Datagridview.
Thinking about caluculating the distance to every point and sorting them by distance. But i think this will be to slow couse i have to update every second.
推荐答案
您需要坐标的纬度和经度的数据库索引。现在进行数据库查询以获取当前纬度/经度的小增量内的坐标。然后过滤最近的位置。
You need database indices on latitude and longitude of your coordinates. Now do database query to get coordinates within a small delta for your current latitude/longitude. Then filter for the closest position.
这篇关于查找最接近的值(坐标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文