Re-projecting the geography of a city by travel time
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Re-projecting the geography of a city by travel time.

Inspired by Gradient Metrics' analysis New York City in Timespace.

This works for any set of US counties, but it can be extended to use other shapes available from the US census.


How To Use

  1. You'll need these libraries if you don't already have them:
    • numpy, pandas, and matplotlib
    • scikit-learn
    • pyshp
    • json
  2. Download the shapefiles from (I used the 500k ones). Unzip the contents into the same directory as this script. County shapefiles are HERE, but the analysis would work with any shapefiles, such as urban area, zip code, or even state or nation. Those can be found HERE.
  3. Get a Bing Maps API key by following these instructions.
  4. Look up the GEOID of areas you want to show from HERE. Enter them in as strings in the "settings" section of the code:
countyGEOIDs = ['29510','29189'] #st. louis city and county

How it Works

  1. Generate evenly-spaced coordinates within the boundaries of the outlines of the US counties you want.
  2. Connect to Bing Maps API and pull down travel distances between all the points.
  3. Use Multidimensional Scaling (aka Principal Coordinate Analysis) to turn the distance matrix into coordinates in time-space.
  4. Align the distance-space coordinates and the time-space coordinates using regular PCA
  5. Plot the coordinates using Matplotlib