Database Reference
In-Depth Information
CREATE SCHEMA postgis;
3. Install PostGIS in the
postgis
schema of the
chapter10
database.
1. If you are running PostgreSQL 9.1 or a newer version, use the
CREATE EXTENSION
statement.
CREATE EXTENSION postgis
WITH SCHEMA postgis;
The
WITH SCHEMA
clauseofthe
CREATE EXTENSION
statementin-
structsPostgreSQLtoinstallPostGISanditsobjectsinthe
postgis
schema.
2. If you are not running PostgreSQL 9.1 or a higher version, run
PostGIS's
postgis.sql
,
spatial_ref_sys.sql
, and
rtpost-
gis.sql
files. But, before doing so, make sure you set the
search_path
field to the PostGIS schema.
> psql -d chapter10
chapter10=# SET search_path
= postgis;
chapter10=# \i /PATHTOFILE/
postgis.sql
chapter10=# \i /PATHTOFILE/
rtpostgis.sql
chapter10=# \i /PATHTOFILE/
spatial_ref_sys.sql
4. Check whetheror not the PostGIS installation has succeeded:
> psql -d chapter10
chapter10=# SET search_path = public,
postgis;
SET
chapter10=# \dn
List of schemas
Name | Owner