简体   繁体   中英

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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM