Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
/ concensus Public archive
forked from Epictetus/concensus

A RubyGem for reading United States Census TIGER/Line Shapefiles.

License

Notifications You must be signed in to change notification settings

hodinkee/concensus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A RubyGem for reading United States Census TIGER/Line Shapefiles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%