PostGIS
Vectormap driver based on a Postgresql database with the PostGIS plugin. More...
Vectormap driver based on a Postgresql database with the PostGIS plugin.
- Provides
- Requires
- None
- Configuration requests
- None
- Configuration file options
- dbname (string)
- Default: template1
- The name of the Postgresql database to connect to.
- host (string)
- Default: localhost
- The name of the database host.
- user (string)
- Default: postgres
- The name of the database user.
- port (string)
- Default: 5432
- The port of the database.
- password (string)
- Default: empty string
- The password for the database user
- layers (string tuple)
- Default: Field required
- Names of the layers. The layers are named after the corresponding tables in the database.
- Example
driver ( name "postgis" provides ["vectormap:0"] dbname "gis" host "192.168.0.2" port "5432" user "postgres" password "secret" layers ["obstacles_geom" "markers_geom"] )
- Creating a PostGIS Database
- The PostGIS extension and Postgres database come in a single package in Ubuntu called postgresql-8.1-postgis. PostGIS isn't supported by Postgres-8.2 at the time of writing. After the package has been installed the database should be running and a new user 'postgres' should have been added to the system.
After the database has been installed, you will need to install the PL/pgSQL language extension and load the PostGIS definitions.
- To do this switch to a postgres user (for example do a 'su - postgres').
- Create a database: createdb gis
- Add the PL/pgSQL language extension: createlang plpgsql gis
- Change to the directory holding lwpostgis.sql (For example '/usr/share/postgres-8.1-postgis/lwpostgis.sql')
- Load the PostGIS definitions: psql -d gis -f lwpostgis.sql
- Run psql command interpreter: psgl gis
- (Optionally) Add a user account:
- CREATE ROLE username WITH LOGIN CREATEDB CREATEROLE;
- Create a table for your geometry data
- CREATE TABLE obstacles_geom(id int4 PRIMARY KEY, name varchar(25));
- Let the PostGIS extension know about your data
- SELECT AddGeometryColumn('public', 'obstacles_geom', 'geom', 423, 'LINESTRING', 2);
- Add column for attributes:
- ALTER TABLE obstacles_geom ADD COLUMN attrib varchar(25);
Create one database table per one layer in the configuration file.
For more information see http://postgis.refractions.net/
- Database schema
- /TODO: Add documentation