A RubyGem for reading United States Census TIGER/Line Shapefiles.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec/concensus
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
concensus.gemspec

README.md

Concensus

Concensus is a gem for reading the United States Census Bureau's TIGER/Line Shapefiles.

It uses the georuby gem to convert the shapefiles, which leaves you with access to all of the methods in the georuby API.

Install

gem 'concensus'

Use

Concensus::Place.find("CA", "Berkeley")
	=> #<Concensus::Place>
	
Concensus::Place.find_all("CA")
	=> [#<Concensus::Place>, #<Concensus::Place>, etc...]
		
Concensus::configuration.year = 2011
	=> all subsequent requests will be for 2011
	
Concensus::Place.find("NY", "New York")
	=> 2011 Boundaries for New York City
	
Concensus::configuration.year = 2010

california = Concensus::State.find("CA")

california.geometry
	=> #<GeoRuby::SimpleFeatures::MultiPolygon>

california.geometry.to_array
	=> [[[-119.000932, 33.535895], [-119.000932, 33.535823], [-118.997845, 33.534199], [-118.994453, 33.532711], [-118.992796, 33.531849], [-118.990046, 33.530288999999996], [-118.986199, 33.527425], ...], ...]
	
california.geometry.to_array[0]
	=> [[-119.000932, 33.535895], [-119.000932, 33.535823], ... ] 

List of Resources

<tr>
	<th>Concensus::County</th>
	<td></td>
	<td>✓</td>
</tr>
<tr>
    <th>Concensus::Place</th>
    <td>✓</td>
    <td>✓</td>
</tr>
<tr>
	<th>Concensus::School::Elementary</th>
	<td>✓</td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::School::Secondary</th>
	<td>✓</td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::School::Unified</th>
	<td>✓</td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::State</th>
	<td></td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::StateLegislative::Upper</th>
	<td>✓</td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::StateLegislative::Lower</th>
	<td>✓</td>
	<td>✓</td>
</tr>
<tr>
	<th>Concensus::Zipcode</th>
	<td></td>
	<td>✓</td>
</tr>
2011 2010
Concensus::Congressional

Full Documentation

http://rubydoc.info/github/adamjacobbecker/concensus/

Notes

Some of the .zip files downloaded are quite large, so this gem requires temporary storage to unzip and cache the downloaded files. By default, we store these in ~/.concensus/tmp/.

If you're using Rails, you'll probably want to create an initializer with Concensus.configure { |c| c.tmp_dir = "#{Rails.root}/tmp/concensus/" }. This way, you can use Concensus with the (very temporary) writable storage on Heroku.

Todo

  • Add more geographic areas, we only have a small bit of what's available.
  • Add support for storing downloaded and uncompressed .zips on S3. (Heroku has no persistent writable file storage.)

Support development by sending links to siiick house mixes: @AdamJacobBecker