Permalink
Browse files

Fix README

Add section for postgresql 9.1 and postgis 1.5.3
  • Loading branch information...
1 parent 1be6ede commit 357e8904b7ab9efc43e303d3f99d5c1f264c48db @chezka chezka committed Nov 17, 2011
Showing with 69 additions and 46 deletions.
  1. +69 −46 README.md
View
115 README.md
@@ -5,9 +5,12 @@ A (simple) Rails example app using PostGIS
## Migrations
There are three intersting points in the migrations:
-* How you just t.<choose-one-geom> :name
-* SRID 4326, more info ![here](http://en.wikipedia.org/wiki/World_Geodetic_System)
-* `:spatial => true` on an add_index
+
+ * How you just `t.<choose-one-geom> :name`
+
+ * SRID 4326, more info [here](http://en.wikipedia.org/wiki/World_Geodetic_System)
+
+ * `:spatial => true` on an add\_index
## Models
@@ -23,61 +26,75 @@ In other words, an array of points..
### Region (Polygon)
-Put it simple, an array of points but a[0] should eql a[-1]
-(careful with rings)
+Put it simple, an array of points but a\[0\] should eql a\[-1\] (careful with rings)
## PostgreSQL
Creating an UTF8 database (optional, you might have one)
- export PGROOT="/var/lib/postgres"
- mkdir -p $PGROOT/data && chown postgres.postgres $PGROOT/data
- su - postgres -c "/usr/bin/initdb -E utf8 --locale=en_US.UTF-8 $PGROOT/data"
+ # export PGROOT="/var/lib/postgres"
+ # mkdir -p $PGROOT/data && chown postgres.postgres $PGROOT/data
+ # su - postgres -c "/usr/bin/initdb -E utf8 --locale=en_US.UTF-8 $PGROOT/data"
## PostGIS
Installing PostGIS is simple:
- su postgres
- psql template1
+ # su - postgres
+ $ psql template1
- create database template_postgis with template = template1;
- UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';
- \c template_postgis
- CREATE LANGUAGE plpgsql;
+ template1=# create database template_postgis with template = template1;
+ template1=# UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';
+ template1=# \c template_postgis
+ template_postgis=# CREATE LANGUAGE plpgsql;
Now just find the right path for your OS, some that I know:
-arch
- \i /usr/share/postgresql/contrib/postgis.sql;
- \i /usr/share/postgresql/contrib/spatial_ref_sys.sql;
+* Linux Arch
+
+ template_postgis=# \i /usr/share/postgresql/contrib/postgis.sql;
+ template_postgis=# \i /usr/share/postgresql/contrib/spatial_ref_sys.sql;
+
+* Centos x86\_64
+
+ template_postgis=# \i /usr/share/pgsql/contrib/lwpostgis-64.sql;
+ template_postgis=# \i /usr/share/pgsql/contrib/spatial_ref_sys.sql;
+
+* Debian
+
+ template_postgis=# \i /usr/share/postgresql-8.3-postgis/lwpostgis.sql;
+ template_postgis=# \i /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql;
-centos x86_64
- \i /usr/share/pgsql/contrib/lwpostgis-64.sql;
- \i /usr/share/pgsql/contrib/spatial_ref_sys.sql;
+* Ubuntu (10.4) with postgresql 8.4
-debian
- \i /usr/share/postgresql-8.3-postgis/lwpostgis.sql;
- \i /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql;
+ template_postgis=# \i /usr/share/postgresql/8.4/contrib/postgis.sql;
+ template_postgis=# \i /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql;
-ubuntu (10.4) with postgresql 8.4
- \i /usr/share/postgresql/8.4/contrib/postgis.sql;
- \i /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql;
+* Ubuntu (10.10) with postgresql 8.4
-ubuntu (10.10) with postgresql 8.4
- \i /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql;
- \i /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql;
+ template_postgis=# \i /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql;
+ template_postgis=# \i /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql;
-osx
- \i /opt/local/postgis/lwpostgis.sql;
- \i /opt/local/postgis/spatial_ref_sys.sql;
+* Mac OS X
+
+ template_postgis=# \i /opt/local/postgis/lwpostgis.sql;
+ template_postgis=# \i /opt/local/postgis/spatial_ref_sys.sql;
+
+* Mac OS X with postgresql 9+ and postgist installed via homebrew
+
+ postgis 1.5.2:
+
+ template_postgis=# \i /usr/local/Cellar/postgis/1.5.2/share/postgis/postgis.sql;
+ template_postgis=# \i /usr/local/Cellar/postgis/1.5.2/share/postgis/spatial_ref_sys.sql;
+
+ postgis 1.5.3:
+
+ template_postgis=# \i /usr/local/Cellar/postgis/1.5.3/share/postgis/postgis.sql;
+ template_postgis=# \i /usr/local/Cellar/postgis/1.5.3/share/postgis/spatial_ref_sys.sql;
-os x (10.6) with postgresql 9.0.3 and postgis 1.5.2 installed via homebrew
- \i /usr/local/Cellar/postgis/1.5.2/share/postgis/postgis.sql;
- \i /usr/local/Cellar/postgis/1.5.2/share/postgis/spatial_ref_sys.sql;
Now to finish:
@@ -88,26 +105,32 @@ Now to finish:
## FAQ
-### I can`t find postgis.sql / spatial_ref_sys.sql location. What should i do?
+### I can\`t find postgis.sql / spatial\_ref\_sys.sql location. What should i do?
+
+Well, it's depend on your system.
+
+* Debian / Ubuntu
- Well, it's depend on your system.
+ $ dpkg -L postgresql-VERSION-postgis | egrep "(spatial_ref_sys|postgis).sql"
- * Debian / Ubuntu
+* Arch Linux (not tested, but should work)
- dpkg -L postgresql-VERSION-postgis | egrep "(spatial_ref_sys|postgis).sql"
+ $ pacman -Ql postgis | egrep "(spatial_ref_sys|postgis).sql"
- * ArchLinux (not tested, but should work)
+* CentOS / Fedora / Redhat / where installed yum ;) (not tested, but should work)
- pacman -Ql postgis | egrep "(spatial_ref_sys|postgis).sql"
+ Install _yum-utils_ which contains _repoquery_, then:
- * CentOS / Fedora / Redhat / where installed yum ;) (not tested, but should work)
+ $ repoquery --list PACKAGE | egrep "(spatial_ref_sys|postgis).sql"
- Install _yum-utils_ which contains _repoquery_, then:
+* Mac OS X (homebrew)
- repoquery --list PACKAGE | egrep "(spatial_ref_sys|postgis).sql"
+ $ brew list postgis | egrep "(spatial_ref_sys|postgis).sql"
- * MacOS X (homebrew)
- brew list postgis | egrep "(spatial_ref_sys|postgis).sql"
+### I upgrade postgresql via homebrew on Mac OS X and something going wrong.
+Reinstall postgis:
+ $ brew uninstall postgis
+ $ brew install postgis

0 comments on commit 357e890

Please sign in to comment.