Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

NYC.rb Legislative Lookup


Published on

Benjamin Stein's presentation at the NYC.rb Ruby Meetup about Mobile Commons's open-source legislative lookup tool

Published in: Technology
  • Be the first to comment

NYC.rb Legislative Lookup

  1. 1. M OBILE C OMMONS Benjamin Stein Legislative Lookup NYC.rb January 13, 2009
  2. 2. <ul><li>Non-Profits & Activism </li></ul><ul><li>Politics & Government </li></ul><ul><li>Cultural Institutions </li></ul><ul><li>Healthcare </li></ul><ul><li>Donations </li></ul>Mobile Tools for Civic Engagement
  3. 3. <ul><li>Legislative lookup for advocacy call-in campaigns </li></ul><ul><li>Built into mConnect </li></ul><ul><li>Auto-route constituents to their legislators </li></ul>Motivation
  4. 4. Congressional Primer “ It’s just like the Galactic Senate, but on Earth” --Mobile Commons CEO explaining the United States government to the engineers
  5. 5. Requirements <ul><li>Lookup federal and state legislators by lat/lng </li></ul><ul><li>Need the office’s phone number </li></ul><ul><li>Geocoding out of scope </li></ul>
  6. 6. DEMO
  7. 7. Build vs Buy <ul><li>Commercial services </li></ul><ul><li>Sunlight Foundation </li></ul><ul><li>Other free APIs </li></ul>
  8. 8. Rails 2.2 with Geo Plugins Spatial Adaptor for AR PostGIS Extensions ActiveRecord Postgres Database GeoRuby Models, Views, Controllers YM4R/GM
  9. 9. Database <ul><li>Postgres </li></ul><ul><ul><li>Why not MySQL? </li></ul></ul><ul><ul><li>“ Bug #24659: GIS contains() uses MBR” </li></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><li>PostGIS </li></ul><ul><li>District Shapefiles </li></ul><ul><li>Shp2sql.rb </li></ul><ul><li> </li></ul>
  10. 10. PostGIS <ul><li>Adds spatial objects to psql </li></ul><ul><li>Other important extensions: </li></ul><ul><ul><li>Proj4: reprojection library </li></ul></ul><ul><ul><li>GEOS: support for topological tests, e.g. touches() and contains() </li></ul></ul><ul><li>Make your database GIS aware </li></ul><ul><ul><li>`psql -f lwgeom/lwpostgis.sql -d <your_database>` </li></ul></ul>
  11. 11. Give it Up For Open Source! <ul><li>Spatial Adapter </li></ul><ul><ul><li>Extend ActiveRecord to work with geometric columns </li></ul></ul><ul><li>GeoRuby </li></ul><ul><ul><li>classes that map to data types from spatial adaptor </li></ul></ul><ul><li>YM4R/GM </li></ul><ul><ul><li>Ruby interface for Google maps </li></ul></ul>
  12. 12. CODE
  13. 13. M OBILE C OMMONS