views:

271

answers:

4

I need a list of all the countries in the world, with one lat/long coordinate for the country.

I had a look at GeoNames, but all I can seem to find are lists that have the countries as well as cities in the same list. I guess I can just parse it and filter out the countries, but I was hoping to avoid that.

Basically, what I need;

Country name - Lat/long coordinate (some sort of center of the country)

It doesn't need to say anything about continent, but I wouldn't mind if it did.

_L

A: 

The concept of the center of a country is not very well defined. Would the co-ordinates of the capital cities do? If so you might be able to extract them from somewhere like Wikipedia relatively straightforwardly. There are only 200 or so, after all. That said, I note that the CIA World Factbook (available online) gives approximate co-ordinates for the geographical centers of countries.

crazyscot
It's actually not that important whether it's the nations capitol or somewhat in the center, as long as it is consistent. Thanks for the tip
ptrn
+2  A: 

The US government has a standardized place name database which you can query. It includes a lat/long coordinate, among other things. They offer downloadable sets of some of their data too.

mtrw
+3  A: 

Well, you could download this GIS layer and run a point-on-polygon on it.

Edit: maybe this list would do.

Andrew McGregor
Ah, perfect! I've actually used it before, I guess I'd just forgotten it. Thanks a bunch :-)
ptrn
+4  A: 

Two web services that may be of interest to you to build this data:

You could call http://ws.geonames.org/countryInfo to get the full list of country codes and country names, and then call http://ws.geonames.org/search?country=<code>&name=<name>&maxRows=1 on each to get what appears to be the lat/long of the center-point of the country. (ex. http://ws.geonames.org/search?country=US&name=United%20States&maxRows=1 )

Nate
Neat solution. I've already solved it using Andrew McGregor's way, but this very clever. Thanks
ptrn
Actually, this turned out to be the best solution. The one from CIA's factbook had coordinates to the nations capitol.
ptrn