Calculate, visualize, and analyze the geography of urban greenspace.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
.gitignore
Drakefile
README.md
area.sql
area_raster.sql
color-relief.txt
distances.sql
distances_max.sql
distances_raster.sql
mask_raster.sql
mv_osm.sql
park_distances.sql
park_distances_raster.sql
parks.sql
points.sql
relief.py
relief.xml
roads.sql
water.sql

README.md

Higher Ground

The code in this repository processes Open Street Map data to calculate, for each location in a specified region:

  • d_road, the distance from that location to the nearest road, and
  • d_park, the distance from that location to the nearest park.

The results are used for both visualization and analysis.

Visualization

We visualize the data using techniques that are traditionally employed for rendering topography. First we define for any point p a height z by:

z(p) = d_road(p) - d_park(p)

where d_road(p), d_park(p) are the distances from p to the nearest road and park, respectively.

We then plug this z(p) heightmap and process it with digital elevation map tool (see technical details below) to generate a map like this:

The hillshaded relief layer.

Next we take a typical roadmap:

A typical roadmap.

And composite the two into our final map:

The final map.

Analysis

By analyzing d_road we identify the parks in a city which are farthest from roads. These are typically large parks but can also be smaller parks bordered by industrial sites or water.

Similarly, we use d_park to find the urban points which are farthest from a park.

Technical Details

The data is loaded from OpenStreetmap (OSM) into a database (PostgreSQL with the PostGIS extension) using the the osm2pgsql program. The OSM extracts from Mapzen or Geofabrik are useful for this. Distances are calculated with respect to a rasterized grid of a specified resolution using nearest neighbor search with spatial indexing. The gdaldem program is used for processing the raw distance data into separate hillshade, slopeshade, and color relief layers. The final maps are rendered using Mapbox.