This repl allows you to create some interesting maps about population density. It is similar to the other repl but with smaller cells and the ability to slice the map into regions.
Go to the index.html page and adjust the settings. The Max Pop function estimates the smallest circle around each point containing the given number of people. The COG Radius function finds the direction to the population center of the circle of given radius and also computes the average distance to a person within that circle.
The script.js file does all of the computing and the bigGrids.js file contains the population data for each cell within the grid. This repl was copied from the other repl with a smaller grid so some info may not be accurate or make sense for this grid.
The citiesTable.js file does nothing but is included in case you want to use it.
The functions can likely be improved and can certainly be moved to workers. There are plenty of other improvements possible as well.
Read this blog post about computing populations for a train game, visit onemorestation.com to express your support for that project and signup for updates, and/or check out more of my projects at triplelog.com.