[英]Using longitude and latitude, best method for identifying which points from one list are the closest to each point on another list
I have a list which has the latitude and longitude of points on a map. 我有一个列表,其中包含地图上点的纬度和经度。 I want to identify census tracts whose center is ten miles away or more from all points in the list (basically identifying rural census tracts).
我想确定中心距列表中所有点十英里或更远的人口普查区(基本上是确定农村人口普查区)。 I also have a list of all census tracts and the latitude and longitude of their center.
我还列出了所有人口普查区域及其中心的经度和纬度。 How can I cross reference each census tract with each point in the list and identify the distance from their center to each point and create a list of census tracts who have no points within ten miles of their center?
如何将每个人口普查区与列表中的每个点交叉引用,并确定从其中心到每个点的距离,并创建一个在其中心十英里内没有点的人口普查区列表?
So, what you could do is simply create 2 lists, a list of all census tracts, and then a list of rural census tracts. 因此,您可以做的就是简单地创建2个列表,所有普查区的列表,然后是农村普查区的列表。 The rural list should start out empty, and then as you add tracts to it you will have to compare the new track against all the other tracts in the list to make sure the great circle distance is more than ten miles.
乡村列表应该从空开始,然后在您添加路段时,您必须将新轨道与列表中的所有其他路段进行比较,以确保大圆距超过十英里。 If so you add it to the list, and if not remove the entity from the rural list, and keep iterating through your list to compare the new tract against all the remaining tracts in your rural list to make sure no more tracts are also in range.
如果是这样,则将其添加到列表中,如果未将其从乡村列表中删除,则继续遍历列表以将新区域与乡村列表中的所有其余区域进行比较,以确保没有更多区域在范围内。 If so delete those rural tracts as well.
如果是这样,请删除那些农村地区。
The real challenge with this problem is the complexity of it. 这个问题的真正挑战是它的复杂性。 If you are dealing with a large amount of CTs, iterating through a growing list to compare against some new value is going to be very costly.
如果您要处理大量的CT,那么遍历不断增长的列表以与某些新值进行比较将非常昂贵。 There is likely a way to optimize this using a map and only comparing the new tract against other tracts in a ten mile square around it, but this would be more of a math problem I think than a software one.
可能有一种方法可以使用地图进行优化,并且仅将新区域与周围10平方英里内的其他区域进行比较,但是我认为这更多的是数学问题,而不是软件问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.