Gaël Varoquaux

Wed 31 December 2008

←Home

GPS coordinates for the world’s major cities

This may sound stupid, but I have failed to find on the web a simply-accessible text file giving the GPS coordinates for the world’s major cities. The web site World-gazetteer is helpful, but doesn’t really give what I want. So I wrote a small Python web-scraping script to get the data I needed. BeautifulSoup is really cool, but somehow I feel I could be spending my time in a better way. And on a side note, I still struggle to get good conversion from unicode to ascii (I needed ascii, as this will be fed to software that don’t understand unicode).

I am attaching both the data file produced, and the Python script, in case someone finds them useful.

Update: About 10 minutes after posting, I did a better google search, and found a page that might have been easier to scrape: http://www.bcca.org/misc/qiblih/latlong_oc.html

Go Top