rails app to look at flood info for where you are in miami-dade
Ruby JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Latest commit 5ac4a5f Jun 2, 2013 @bkerley Maps!
Failed to load latest commit information.
app Maps! Jun 2, 2013
bin initial Jun 1, 2013
config show zone data Jun 1, 2013
db initial Jun 1, 2013
lib initial Jun 1, 2013
log initial Jun 1, 2013
public initial Jun 1, 2013
test start of flood controller Jun 1, 2013
vendor precipitation data for yesterday Jun 2, 2013
.gitignore ignore raw geodata files Jun 2, 2013
Gemfile haml and postgis Jun 1, 2013
Gemfile.lock haml and postgis Jun 1, 2013
README.markdown oops Jun 2, 2013
Rakefile initial Jun 1, 2013
config.ru initial Jun 1, 2013


Is it Flooding?

"Is it Flooding" is a bit of a janky, demo-ready mess right now, and doesn't pass for a normal Rails app either. All queries are hand-rolled SQL, ActiveRecord isn't touched, and loading data in is a bit insane.


  • Ruby 2.0
  • Rails 4.0
  • PostgreSQL 9.2
  • PostGIS 2.0
  • GDAL

Postgres Configuration on Mac

This application was developed on Mac OS X, using the homebrew package manager.

brew install gdal --with-postgres
# do the normal postgres setup here
brew install postgis

Data Import

The data we use is compressed in vendor/data.

  • county_data.tar.bz2 is Miami-Dade County-provided data about FEMA Flood Zone designation (as "MultiPolygonZ") and elevation contours (as "MultiLineStringZ"). Right now, only the FEMA data is used because converting lines into polygons isn't trivial if you don't know GIS. These data are SQL ready to be loaded into PostGIS.

  • orig_kml.tar.bz2 is the KML files the above is converted from.

  • nws_precip_1day_observed_shape_20130601.tar.gz is NWS rainfall observations for the entire US. It can be loaded in with GDAL's ogr2ogr tool:

    ogr2ogr -f PostgreSQL PG:dbname=flood-dev nws_precip_1day_observed_20130601

    It should also be indexed to provide a hilariously huge speedup:

    CREATE INDEX ON nws_precip_1day_observed_20130601 (lat, lon);


The rainfall data is ready for use anywhere in the US.

The FEMA flood zone data, however, is not. The application expects it to be provided as polygon data in the femafloodzone_lyr table, and queryable as such:

SELECT ogc_fid, name
FROM femafloodzone_lyr
      'POINT(-122.0312186 37.33233141)', 4326),

This query lives in app/models/flood_zone.rb, should you need to alter it.

What's Next?

There's lots of improvements that can be made. See the issues list on GitHub for a comprehensive list.



Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.