简体   繁体   English

如何从给定点(经度,纬度)计算给定半径内的所有点(经度,纬度)?

[英]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... 代码后面可能会有一些聪明的人会做这样的事情...

  1. Get the users current location 获取用户当前位置
  2. Find the suburb (or failing that, find the city) that the current location exists in. Also find all the surrounding suburbs adjacent to this one. 查找当前位置所在的郊区(或者失败,找到城市)。还要查找与此位置相邻的所有周围郊区。
  3. Find all the places within those suburbs, and calculate how far they are away from the current user location 查找这些郊区中的所有地点,并计算距当前用户位置的距离

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.

相关问题 根据GPS的地理位置,如何找到给定x米半径内的纬度和经度 - Given the geo location from the GPS, how to find the latitude and longitude within a given x meter radius 从给定的纬度,经度和半径值中查找java中的最小和最大纬度和经度 - Find min and max latitude and longitude in java from given latitude , longitude and radius values 给定点与点之间的距离,如何从给定点查找其纬度和经度? - How to find the latitude and longitude of a point from a given point, given the distance between the two? 根据距离计算经纬度的点 - Calculate a point from latitude and longitude with a distance 如何在美国将给定纬度经度映射到州际 - How to map given latitude longitude to interstate in USA 查找距给定 Lat Lng 位置一定距离内的所有纬度经度位置 - find all Latitude Longitude locations within a certain distance from a given Lat Lng location 获得给定半径(米)和位置的最大经度和经度 - Get the max latitude and longitude given radius (meters) and position 给定纬度和经度点,找到边缘点和多边形区域 - given latitude and longitude points, find edge points and polygon area 给定经度和纬度的两个点的中点 - Mid point of two point where latitude and longitude given 给定纬度和经度,使用谷歌地图计算距离 - Calculate distance using google map given a latitude and longitude
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM