Difference between revisions of "Setting up postGIS"

From University of Washington - Ubicomp Research Page
Jump to: navigation, search
m
 
m
Line 22: Line 22:
 
sudo make install
 
sudo make install
 
</pre>
 
</pre>
 +
<li> Install postGIS for Ubuntu from synaptic
 +
<li> Create a DB in postgreSQL, and install postGIS
 +
<pre>
 +
su postgres
 +
psql -h ubi.cs.washington.edu -W -d jobDB -U jobAdmin
 +
    CREATE DATABASE "postgis"
 +
      WITH OWNER = "jobAdmin"
 +
            ENCODING = 'UTF8';
 +
psql -d postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
 +
</pre>
 +
<li> Add shape files to DB
 +
<pre>
 +
cd /projects/ubicomp99/postgis/bus/data
 +
# shp2pgsql -D myshape.shp mytable mytestdb | psql mytestdb
 +
# shp2pgdwl -s [washington coordinate plane] [shape file] [tablename] | psql -d [dbname]
 +
shp2pgsql -s 2926 Busstop busstop | psql -d postgis
 +
shp2pgsql -s 2926 routes busroute | psql -d postgis
 +
shp2pgsql -s 2926 moving_stops moving_stops | psql -d postgis
  
 
+
</pre>
 
</ul>
 
</ul>

Revision as of 20:40, 2 October 2008

  • Download postGIS source code from http://postgis.refractions.net/download/
  • Extract and build
    ./configure
    make
    sudo make install
    
  • Install the proj projection library from | http://download.osgeo.org/proj/proj-4.6.1.tar.gz
  • Extract and build
    ./configure
    make
    sudo make install
    
  • Install the GOES gemoetry engine from | http://trac.osgeo.org/geos/
  • Extract and build
    [extract bzip2 -d filename]
    ./configure
    make
    sudo make install
    
  • Install postGIS for Ubuntu from synaptic
  • Create a DB in postgreSQL, and install postGIS
    su postgres
    psql -h ubi.cs.washington.edu -W -d jobDB -U jobAdmin
         CREATE DATABASE "postgis"
           WITH OWNER = "jobAdmin"
                ENCODING = 'UTF8';
    psql -d postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
    
  • Add shape files to DB
    cd /projects/ubicomp99/postgis/bus/data
    # shp2pgsql -D myshape.shp mytable mytestdb | psql mytestdb
    # shp2pgdwl -s [washington coordinate plane] [shape file] [tablename] | psql -d [dbname]
    shp2pgsql -s 2926 Busstop busstop | psql -d postgis
    shp2pgsql -s 2926 routes busroute | psql -d postgis
    shp2pgsql -s 2926 moving_stops moving_stops | psql -d postgis