29

I am looking for an open source flat file (comma separated values for example) of the major cities in this world, together with their latitude longitudes and timezone. The first 1000 or more is fine. Is such a resource available?

Eventually, a combination of two flats files (lat/long & timezone) is fine too.

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453

7 Answers7

21

You can take a look at this

http://www.partow.net/miscellaneous/airportdatabase/#Download

tells you the lat-long info of all major cities with airports

parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
  • 7
    The following command converts the database to "City, Country:LatDecimal:LonDecimal" format. `cat GlobalAirportDatabase.txt | grep -v "00:00:00" | awk -F':' '{print $4", "$5":"$9""($6+$7/60+$8/3600)":"$13""($10+$11/60+$12/3600)}' | sed 's/:S/:-/' | sed 's/:U/:-/' | sed 's/:N/:/' | sed 's/:E/:/' > WorldCities` – Richard Sep 16 '14 at 23:32
  • Nice! Despite the name, it contains not the airport coordinates. There are 7322 cities in that CSV right now. The coordinates, however, seem rather arbitrary to me. For Augsburg (Germany), for example, it is definitily not an important part of the city where the coordinates point to. – Martin Thoma Mar 19 '18 at 11:15
10

Have a look at: http://www.maxmind.com/app/worldcities

here is also a free version: http://www.maxmind.com/app/geolitecity

stewe
  • 41,820
  • 13
  • 79
  • 75
  • This one has a lot of duplicate entries in it, which are different by one letter and etc. – saganas Jun 16 '16 at 16:33
  • Have a look at `pt,Porto` entries (yes, there are duplicates for the same city) to estimate the quality of that dataset. – Martin Thoma Mar 19 '18 at 10:19
  • The worldcities link doesn't work anymore, and "GeoLite Legacy databases were discontinued on January 2, 2019" – Nico May 16 '19 at 14:13
1

Building on Parapura's answer (+1 for the great idea of using airport lists):

Here is another much more complete airport database (46325 airports as of today and apparently actively maintained).

To hopefully save other's time, here are the few command lines I used to get it all:

wget ourairports.com/data/airports.csv
wget ourairports.com/data/airport-frequencies.csv
wget ourairports.com/data/runways.csv
wget ourairports.com/data/navaids.csv
wget ourairports.com/data/countries.csv
wget ourairports.com/data/regions.csv

To get major cities, I would use the airports qualified as "large_airport".

Community
  • 1
  • 1
Pierre D
  • 24,012
  • 7
  • 60
  • 96
1

I had this problem - I needed it to place markers on a map. Here is the procedure that I followed:

https://gist.github.com/rolfen/cdaf1895b44659c1c4d2b90970af443e

The data is provided by Wikipedia:
https://en.wikipedia.org/w/index.php?title=List_of_cities_by_longitude&printable=yes

I do some processing on that using the browser debugging console.

The output is a JSON object. If you can work with JavaScript, it should be easy to tweak.

Rolf
  • 5,550
  • 5
  • 41
  • 61
1

I've found one that's still on the web and kept reasonably up-to-date: https://simplemaps.com/data/world-cities

The Basic version (approx. 41 thousand locations) is available free under Creative Commons licensing in CSV or Excel formats. Lat, long, and population are all included. I've just downloaded it, so no quality testing yet.

0

This one ships as CSV files http://www.geobytes.com/geoworldmap/ and contians latitude longitudes and timezones.

herzo
  • 11
  • 1
0

I would recommend NaturalEarth where you can download files with major cities including their names in different languages and their population. Country borders and time zones are provided as well. The download formats include SHP, SQLite and GeoPackage; no CSV though, but all are easy to read in QGIS (where you can convert them to CSV) or e.g. Python.

If you need smaller cities as well have a look at https://www.geonames.org/ - at that site CSV downloads of cities are provided (with coordinates, names and other properties).

phispi
  • 604
  • 7
  • 15