Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have an Excel spreadsheet with the latitude and longitude of the centroid of every county in the U.S. I want to know the shortest distance from each county to any part of Oklahoma (presumably, somewhere along the border). I then want this distance in this Excel spreadsheet as a new column.

Is this possible to do and how? I know next to nothing about GIS

share|improve this question
What tools do you have at hand? There are n ways to skin this cat. Let us know what tools you have, skills (GIS, Programming, etc), and we'll give you a good start. – OptimizePrime May 24 '12 at 19:55
@OptimizePrime Thank you for your quick response! Would that be easier to hash out over a chat forum here? – J G May 24 '12 at 20:06
Have you checked… – underdark May 24 '12 at 20:41
I understand how to do the distance between 2 coordinates. The problem -- as I wrote below -- is that I don't know how to do the distance between a county whose coordinates I know and the boundary of Oklahoma, whose coordinates I do not know. Perhaps it is possible to get those coordinates. – J G May 24 '12 at 20:51

If you know the coordinates of the point in OK, the haversine formula should be pretty easy to implement in Excel. This will give you the approximate as-the-crow-flies distance between the points.

share|improve this answer
My problem is that I do not know how to get the coordinates for the state of Oklahoma. Do you know how to do this? – J G May 24 '12 at 20:49
If you only have a couple points, you can get the coordinates by hand from Google Earth. For example, OK City is 35.467588 and -97.516426. If you have lots of addresses, you can geocode them as a batch. There are some free options if you don't have too many (like – Dimitriy V. Masterov May 24 '12 at 21:00
Could any of this be done through GIS? – J G May 24 '12 at 21:02
This answer seems to miss the thrust of the question, which inquires about a way to compute distances between centroids (points) and a polygon (representing the state of Oklahoma). I'm afraid that will not be resolved only by knowing the Haversine formula. – whuber May 24 '12 at 21:06
@DimitriyV.Masterov I want the shortest distance between the centroid and any point along the OK boundary. – J G May 24 '12 at 21:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.