[英]how to calculate all points(longitude,latitude) within a given radius from given point (longitude,latitude)?
我有一个给定的点(经度,纬度),我想获得所有的点范围,比如说给定点的半径为5英里?
I'm just guessing here, but I think you'll need to find a different approach. 我只是在这里猜测,但我认为您需要找到其他方法。 If you're trying to do something like Foursquare, Google Maps, etc where it finds places within a 5-mile radius of your current location, I think you'll find that these services don't calculate all the points in that radius and then match them up to places at those points.
如果您尝试执行Foursquare,Google Maps之类的操作以在您当前位置的5英里半径范围内找到地点,我想您会发现这些服务不会计算该半径范围内的所有点,然后将它们匹配到这些位置。
There would probably be some smarts behind the code that do something like this... 代码后面可能会有一些聪明的人会做这样的事情...
This kind of process is one potential method that could be employed by these services. 这种过程是这些服务可以采用的一种潜在方法。 This deals with small subset of place comparisons, which is relatively quick to perform.
这处理的是位置比较的一小部分,执行起来相对较快。 Also, places on a map usually have a suburb/city associated with them anyway, so database lookups for places would be rather quick, as there would be an index that involves the suburb.
同样,地图上的地点通常无论如何都具有与其相关联的郊区/城市,因此针对地点的数据库查找会相当快,因为会有涉及该郊区的索引。
If you're aim is to do something like this, I would try to figure out a different way to compare points rather than simply trying to calculate everything in your radius. 如果您的目标是做这样的事情,我会尝试找出一种比较点的方法,而不是简单地尝试计算半径中的所有值。
And of course, there would also be plenty of specific algorithms for calculating this better, but that's not my area of expertise, and would be better suited to another forum. 当然,还有很多特定的算法可以更好地进行计算,但这不是我的专长,因此更适合其他论坛。 I'm not trying to say that this is the best way to do it, but there's plenty of other ways to do it that rely on known location data which would be quicker and smarter than your suggested requirement.
我并不是要说这是最好的方法,但是还有很多其他方法可以依靠已知的位置数据来完成,这比您建议的要求更快,更智能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.