3

This question already has an answer here:

I'm attempting to set up a script to (roughly) evenly slice apart a map of the world by city population. Basically, the largest city in the world is added as a point on a Voronoi graph, and all nearby cities receive an effective malus to their population based on how close they are. Then, the next largest city is added and induces a malus on nearby cities. After N cities are chosen, the script ends. Basically, it's designed to prevent very crowded areas from getting covered in Voronoi dots while the Sahara desert is one giant cell.

Preferably the dataset won't be too huge: anything smaller than 10k people is probably not worth inclusion. Also, it doesn't have to be CSV, but CSV happens to be extremely easy to parse in Ruby.

The problem is that I need a good data set for this. I've found a couple, but most suffer at least one of these problems:

  • Does not include position (latitude/longitude), such as the UN Demographic Yearbook
  • Does not include current population, such as OpenGeocode
  • Contains inaccuracies, such as MaxMind
  • Not formatted as a CSV or similarly-easy-to-parse format, such as GeoNames

Is there a good data set for this, or am I going to have to splice a few databases together? I recognize that these are something of a demanding requirements.

EDIT: the possible duplicate didn't really meet the requirements, but I solved the problem anyway by parsing line-by-line the GeoNames database.

marked as duplicate by jknappen - Reinstate Monica, philshem, albert, Joe Mar 1 '16 at 15:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @TristanBomb regarding the edit: so that solution worked? mind closing the question and/or creating that as an answer and accepting it? – albert Feb 29 '16 at 19:46