I am looking for a tool that can split the Earth's surface into rectangles of similar population.
That means oceans would get a few huge rectangles, as almost nobody live there, and cities would get a lot of small rectangles. I am not super strict about all rectangles having exactly the same population, but it must be the same order of magnitude. It is OK if a few rectangles have zero population, but no rectangle must have way more population than the median.
- Must give the list of rectangles with MinLongitude/MinLatitude/MaxLongitude/MaxLatitude for each.
- Ideally I should be able to specify how many humans per rectangle, or how many rectangles I want the world to be divided into. But providing a rough choices (for instance 10k humans per rectangle or 100k humans per rectangle etc) is acceptable.
- A rectangle can not cross the 180th meridian.
- Gratis, ideally open source.
- Preferably working offline on either Linux/Windows/Mac, but websites/webapps are OK as well, and libraries for any reasonably common programming language are OK too.
- The population data it relies on must be newer than 1990.
My script calls an API that gives information for a zone specified with a MinLongitude/MinLatitude to MaxLongitude/MaxLatitude "rectangle".
Problem: The API fails if the query asks for an area that contains too many inhabitants.
I can ask for a very large rectangle in Antarctica, but in Paris the rectangle must be tiny (maximum: 1 longitude degree * 1 latitude degree).
So, I modified my script to perform tiny requests (1 degree increments of both latitude and longitude). But that leads to another problem: With 360*180=64800 rectangles, it is taking days, as each request has a large overhead, and most requests return empty results as nobody lives there. So I need something more clever.