See an example at whatsmydistrict.org.
- Ruby 1.9.3
- postgresql --
brew install postgres
- postgis --
brew install postgis
-
bundle
-
puma
to start the server at localhost:9292. -
For a new postgresql install in OS X:
mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/postgresql/9.2.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist initdb /usr/local/var/postgres -E utf8 pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
See also Postgres.app.
-
Create the database:
createdb -p 5432 -h localhost blake
-
Add necessary postgis functions to the database:
psql -p 5432 -h localhost -d blake -f /usr/local/share/postgis/postgis.sql
andpsql -p 5432 -h localhost -d blake -f /usr/local/share/postgis/spatial_ref_sys.sql
-- thanks to PostGres - PostGIS on OS X Lion.
-
Download the new shape file from data.lexingtonky.gov -- for example, under Community, Board of Elections - Voting Precincts.
-
Run
shp2pgsql -c -D -s 4269 -I shapefile.shp tablename > filename.sql
. For example:$ shp2pgsql -c -D -s 4269 -I VotingPrecinct.shp voting > VotingPrecinct.sql Shapefile type: Polygon Postgis type: MULTIPOLYGON[2]
-
In psql, drop the table you will be updating.
-
Run
psql -d database -f file.sql
, for examplepsql -p 5432 -h localhost -d blake -f VotingPrecinct.sql
.