DEV Community

chovy
chovy

Posted on Originally published at dev.profullstack.com

Population data from the world down to the ZIP code

nichedb.dev now has a population collection, and you can walk it from the whole world down to a single ZIP code: https://nichedb.dev/population

Pick a country and you get its states. Pick a state and you get its cities and ZIP codes. Every level is sorted by how many people live there, and every row links one level further down.

What is in it

  • Every country (249), from the World Bank: population and its yearly series since 1990, growth, density, how many people live in cities, the age structure, births, deaths, children per woman, life expectancy, net migration, GDP per person and the Gini index.
  • Every US state, city and ZIP code (about 66,000 areas), from the Census Bureau's American Community Survey: median age, households, household and per-person income, home value, rent, home ownership, poverty, college degrees, unemployment, race and Hispanic origin.
  • The cities of every other country (about 30,000), filed under their state, province or region, from GeoNames.

All of it is free data, and none of it needs a key.

One thing we found on the way

The Census Bureau's data API stopped answering without a key. Every request now redirects to a "missing key" page. The same numbers are still published as flat files with no key at all (the ACS Summary File), so that is what nichedb reads: thirteen tables, about half a gigabyte, parsed in around twenty seconds and read again only when the Census publishes a new year.

The files have a few traps. A value of -666666666 means "no estimate", not a very poor town. A median household income of 250001 means "$250,000 or more". Both are handled, and a top-coded figure shows as "$250,000+" rather than as an exact number.

Four ways in

Listings, housing and crime records in nichedb also pick up the population profile of their ZIP, city or state on their own now, so a house for sale or a police report arrives with who lives around it.

Top comments (0)