Skip to content

Instantly share code, notes, and snippets.

@eyeseast
Forked from jkeefe/census3nicar14
Last active January 8, 2016 14:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eyeseast/655cd641d7871e69f24d to your computer and use it in GitHub Desktop.
Save eyeseast/655cd641d7871e69f24d to your computer and use it in GitHub Desktop.
CHRIS
Get the data ....
Census Reporter ... GEOJSON or CSV
- For example: Age by Language Spoken at Home for the Population 5 Years and Over
- Download here http://censusreporter.org/data/map/?table=B16007&geo_ids=16000US2507000,05000US25025,31000US14460,04000US25,01000US,160|04000US25&primary_geo_id=16000US2507000#
- Everything is zipped and comes with metadata.json (contains fieldnames and such)
- topojson will make this geojson smaller, but make sure you preserve properties!
US Atlas
- Mike Bostock collected a bunch of GIS resources in one place
- Everything is in the Makefile. Just git clone and make.
- https://github.com/mbostock/us-atlas
Caveat: Node Canvas is a pain to install. If it gives you trouble, comment it out in package.json before you make.
JOHN
Fusion Tables
PROS
- Easy
- Usually free
- You have it already
- Good for fast, quick, low-data maps
http://drive.google.com
CREATE -> Fusion Table
upload the census data
Next you need the shapes
Census Shapefiles
http://www.census.gov/cgi-bin/geo/shapefiles2012/main
But you need them to be in KML for Google
One way is to use CartoDB to upload then Export
http://cartodb.com
Using Export to download
CREATE -> Fusion Table
upload the KML
(I did it already, so it's in my account)
Join the tables together with file -> Merge
Style them with the buttons on the left
Legends
Embed them with SHARE
JOHN
CartoDB
PROS
- Friendly interface
- Free to tinker (otherwise paid)
- Great team / support
- Handles bigger data pretty well
- We like it for internal draft maps for reporters
Show median income with wizard
Life in the Middle story
http://www.wnyc.org/story/life-in-the-middle/
The map Jenny Ye made with aSQL statement:
SELECT * FROM life_in_the_middle_merge WHERE median_income < '52865' AND median_income > '50865'
Show sharing with URL
http://cdb.io/OOUH5u
JOHN
Mapbox / Tilemill
PROS
- Complete style control
- Rendered ahead of time
- Superfast load, even on mobile
- Great for high-data maps
Median income across the US
http://project.wnyc.org/median-income-nation/#5/39.859/-74.751
JOHN
QGIS
PROS
- Can change shapefiles
- Billions of other things
- For that moment when you need to change / blend / reproject
Remove water from census trick outlined here:
http://johnkeefe.net/water-begone
CHRIS
Leaflet
- Start with GeoJSON (or topojson and unpack it). Leaflet knows how to deal with GeoJSON out of the box: http://leafletjs.com/reference.html#geojson
- I use [d3.scale.quantize](https://github.com/mbostock/d3/wiki/Quantitative-Scales#wiki-quantize) and [colorbrewer](https://github.com/mbostock/d3/tree/master/lib/colorbrewer) but you don't have to.
- Example, inequality by county: http://eyeseast.github.io/visible-data/2014/01/28/inequality-in-every-county-in-america/#5/38.942/-98.372
CHRIS
D3 svg
- Start with GeoJSON (or topojson and unpack it)
- Mike Bostock has a [good tutorial here](http://bost.ocks.org/mike/map/) on mapping with D3.
- For choropleth maps, again, use [d3.scale.quantize](https://github.com/mbostock/d3/wiki/Quantitative-Scales#wiki-quantize) and [colorbrewer](https://github.com/mbostock/d3/tree/master/lib/colorbrewer)
- Example, mapping states: http://eyeseast.github.io/visible-data/2013/08/26/responsive-d3/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment