Skip to content

Tools for determining geographic distance between pairs of zip codes, cities, or county or state population centers using US Census data.

Notifications You must be signed in to change notification settings

hlongmore/popcenter-distance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


popcenter-distance

The US Census computes population centers based on census data. This data is available by state as well as by county, and a few other options that probably only make sense to census workers. This project is to make it easy to compute the geographic distance between population centers. The US Census data lists population centers in lat/long coordinates.

There are many algorithms for converting (several of which can be read about at Movable Type Scripts). Some treat the earth as flat, which, over small distances is decently accurate and fast. Some treat the earth as a true sphere, which is more accurate than flat over long distances (e.g. Haversine). Some adjust for the fact that the earth is an oblate spheroid, using an approximation for the radius at the equator as well as the poles (as described in this SO answer). While it is my aim to implement several algorithms, the only one implemented so far is the oblate spheroid one, which I am attributing to Keerthana Gopalakrishnan, as did the poster of this SO answer to the question Calculate distance between two latitude-longitude points? (Haversine formula)

Other resources for possible algorithms to implement:

Data Sources:

Other Future Work

  • With the census data only changing once every 10 years, the distances could be computed into a lookup table, and that table made available in projects.
  • Smart switching could be implemented, based on whether speed or accuracy is desired, or if the distance is determined to be long, and thus a more accurate model would be desired.
  • Auto-download data from US Census website (i.e. with requests package).

Code Coverage

As of 2024-12-03, code coverage for popcenter directory is: 100% files, 90% lines covered.

About

Tools for determining geographic distance between pairs of zip codes, cities, or county or state population centers using US Census data.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages