Take the 2-minute tour ×
Open Data Stack Exchange is a question and answer site for developers and researchers interested in open data. It's 100% free, no registration required.

Wikipedia has pages for containing a list of towns and cities with 100,000 or more inhabitants. I'd like this same data in machine readable format, with country and city names.

share|improve this question

5 Answers 5

Geonames have a tsv with data of the cities with more than 15k inhabitants. You only need to filter the ones you are interested in. The tsv have a column with the population (the 15th one) so it should be quite easy to get them.

You can download it here

share|improve this answer

Freebase will have this data.

https://www.freebase.com/query?lang=%2Flang%2Fen&q=%5B%7B%22type%22%3A%22%2Flocation%2Fcitytown%22%2C%22limit%22%3A2%2C%22name%22%3Anull%2C%22%2Flocation%2Fstatistical_region%2Fpopulation%22%3A%5B%7B%22number%22%3Anull%2C%22number%3E%22%3A100000%7D%5D%2C%22%2Flocation%2Flocation%2Fgeolocation%22%3A%5B%7B%22latitude%22%3Anull%2C%22longitude%22%3Anull%7D%5D%7D%5D

is an example query that looks like this:

[{
  "type": "/location/citytown",
  "limit": 2,
  "name": null,
  "/location/statistical_region/population": [{
    "number": null,
    "number>": 100000
  }],
  "/location/location/geolocation": [{
    "latitude": null,
    "longitude": null
  }]
}]

I'm limiting it to 2 here, you can change that to get more results.

In this case I'm also pulling in longitude and latitude, just to show that you can get a lot of stuff from freebase!

The population data is annoyingly broken down by year, so this is actually getting every city that has ever had more than 100k people living there, rather than ones that do now.

I'm not sure how to deal with that.

Clicking on the link button on the top right gives you an option for an MQLRead Link - that is the endpoint you'd query normally.

This is the extend of my knowledge - hopefully it's enough to pique your interest though - Freebase looks like it could be absolutely incredible once you've got your head round how to query it.

share|improve this answer
    
By the way, if anyone knows how to improve this query, feel free to edit it. I'd also be very interested in having a quick informal chat with anyone who is very familiar with querying Freebase. –  Rich Bradshaw Mar 11 at 16:44

Your own link includes a reference to the UN-stats office (population density and urbanization). The link was dead but I was able to remove the final extension and then re-find it.

  • Overview of data

  • Population of capital cities and cities of 100 000 or more inhabitants: latest available year, 1993-2012 (Excel link)

share|improve this answer

I have a compiled list of all the cities of the world which I collated from the USGS GNIS database (US) and the NGA GNS Server (other countries) into CSV file. I've made the list available FREE as a public domain dataset.

Metadata

Column 1: ISO 3166-1 alpha-2 country code.
Column 2: US FIPS 5-2 1st level administrative division code (e.g., state/province).
Column 3: NGA GNS Feature Description (DSG) code.
Column 4: NGA GNS Unique Feature Identifier (UFI).
Column 5: ISO 639-1 alpha-2/3 code for language corresponding to the feature name.
Column 6: Language script (e.g., latin, arabic, chinese, etc) corresponding to the feature name.
Column 7: Feature name.
Column 8: Latitude coordinate of the area centroid.
Column 9: Longitude coordinate of the area centroid.

http://www.opengeocode.org/download.php#cities

share|improve this answer

I put together a quick SPARQL query to query DBpedia:

select *
where {
?place <http://dbpedia.org/ontology/populationTotal> ?population;
  <http://dbpedia.org/property/name> ?name;
  <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat;
  <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long.
}
order by DESC(?population)
limit 20
offset 0

Alas, the data in DBpedia is dodgy. I've reported the issue to DBpedia.

If the data wasn't broken, you could use this SPARQL query against the DBpedia endpoint to retrieve data (modifying the limit and offset as you would to page through SQL results).

Wikidata may have this data in the near future. It'd be nice if there were also a public SPARQL endpoint...

share|improve this answer

Your Answer

 
discard

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.