Of Countries and their Cities [closed]
Asked Answered
I

10

77

I need a database of Countries and their Cities.

Any idea where I can get such a list?

Icebound answered 2/10, 2010 at 8:46 Comment(0)
T
53

There are quite a few available.

The following has database for 2,401,039 cities

http://www.geodatasource.com/world-cities-database/free

Thurber answered 2/10, 2010 at 8:54 Comment(5)
thanks a lot :D its not an over kill :DIcebound
Is there anyway to know the state/province related to the city with this?Stempien
Actually there is not only cities but it was very helpful, thanks.Thrashing
Here is the updated linkAddams
If you are looking for just the SQL for Country table and all the countries this would help: infomazing.net/blog/…Petuntse
W
40

From all my searching around, I strongly say that the most practical, accurate and free data source is provided by GeoNames.

You can access their data in 2 ways:

  1. The easy way through their free web services.
  2. Import their free text files into Database tables and use the data in any way you wish. This method offers much greater flexibility and have found that this method is better.
Wallache answered 22/8, 2012 at 5:50 Comment(7)
Only problem with them is that their country list is 2 characters long for each country. Not really optimal unfortunatelyGastrotomy
If you are looking for list of Country table with insert for all the countries there is a single sql script here :infomazing.net/blog/…Petuntse
Interesting database, but postal codes are not up to date for Italy (actually they are many years old)Dorsal
@Dorsal Which one (GeoNames or informazing) contains errors in Italia ?Swihart
@Swihart in some cities C.A.P. (codice avviamento postale) has changed many years ago, as an example 47522 was 47020, but old 47020 still works: geonames.org/postalcode-search.html?q=47020&country=IT while new 47521 doesn't.Dorsal
Thanks I didn't know which one contains errors. In their defense, even Wikipedia shows the old post code. it.wikipedia.org/wiki/Longiano I also check a shipping provider and 47020 gives Longiano as result ...Swihart
I have checked the Spanish cities, and it has a lot of mistakes and cities repeated...Ataliah
F
19

Go through this link http://www.maxmind.com/en/worldcities

It Includes the following fields:

  1. Country Code
  2. ASCII City Name
  3. City Name
  4. Region
  5. Population
  6. Latitude (The latitude and longitude are near the center of the most granular location value returned: postal code, city, region, or country)
  7. Longitude
Foredoom answered 22/10, 2013 at 11:49 Comment(3)
Is there an information about what the Region codes mean. These are mainly numbers, but sometimes they are not. (Perhaps they are Country abbreviation of the USA.)Arbor
Is there a mapping what county in a Country a number means?Arbor
Some modifications / cleanup to this data: github.com/JoshSmith/worldwide-city-databaseGeraldgeralda
L
10

Check this out:

Cities of the world database donated by MaxMind.com

The company MaxMind.com1 has agreed to release their cities of the world database under the GPL. The database contains locations by country, city, latitude and longitude. There are over 3,047,000 records in the database. For those of you who have tried the location.module with the zipcodes database from CivicSpace, you will recognize how cool it is and how well this fits with that project and therefore Drupal.

Here's another free one that might help you get started.

Creating and maintaining such a database is quite a bit of work - so anyone who's done it is likely keeping it to themselves, or offering it for a fee.

Lessor answered 2/10, 2010 at 8:51 Comment(3)
thats neat. only problem is how to get around getting the country names into that. they just have abrev :(Icebound
Well, it's free and thus could be a starting point. Based on the abbrev., you should have no trouble finding the country names for those 200 countries or so and add them to your database table...Lessor
This project has cleaned up some of the issues with this data: github.com/JoshSmith/worldwide-city-databaseGeraldgeralda
P
9

http://cldr.unicode.org/ - common standard multi-language database, includes country list and other localizable data.

Painty answered 8/2, 2011 at 9:49 Comment(1)
Question about cities with global permanent ID and localized names is open :( I can't find solution. I plan maintain own application codelist with user contribution.Painty
W
4

https://code.google.com/p/worlddb/downloads/list

Open World Database alpha

This database has multi languages country names, region names, city names and they's latitude and longitude number and country's alpha2 code .

Waldos answered 26/7, 2013 at 9:19 Comment(2)
i ended up using this one it is not an overkill like others with 3 million rowsDuplessismornay
Unable to find a lot of cities in Spain...Ataliah
A
3

United Nations list of locations in mdb, csv or txt:

Welcome: http://www.unece.org/cefact/locode/welcome.html

Choose the downloads link from the above link or just click here.

Action answered 12/5, 2015 at 10:43 Comment(0)
D
1

You can use database from here -

http://myip.ms/info/cities_sql_database/

CREATE TABLE `cities` (
  `cityID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `cityName` varchar(50) NOT NULL,
  `stateID` smallint(5) unsigned NOT NULL DEFAULT '0',
  `countryID` varchar(3) NOT NULL DEFAULT '',
  `language` varchar(10) NOT NULL DEFAULT '',
  `latitude` double NOT NULL DEFAULT '0',
  `longitude` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`cityID`),
  UNIQUE KEY `unq` (`countryID`,`stateID`,`cityID`),
  KEY `cityName` (`cityName`),
  KEY `stateID` (`stateID`),
  KEY `countryID` (`countryID`),
  KEY `latitude` (`latitude`),
  KEY `longitude` (`longitude`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
Discreet answered 6/4, 2013 at 22:43 Comment(0)
P
1

I was comparing worldcitiesdatabae.info with www.worldcitiesdatabase.com and it appears the latter one to be more resourceful. However, maxmind has a free database so then why buy a cities database. Just get the free one and there is lot of help available on internet about maxmind db. If you put in extra efforts then you can save those few bucks :)

Partner answered 3/7, 2013 at 3:17 Comment(0)
P
0

This service returns Countries (name,code) and cities for any country as REST, SErvice. You can also download database and sample REST service

http://tecorange.com/content/world-countries-and-cities-restjson-service-12-months-subscription

Parang answered 28/6, 2015 at 14:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.