Creating Extensions v1.0

Edit this page

After installing PostGIS, create a PostGIS database and the extensions in each database you wish to use PostGIS extensions. You must not create the extensions in the postgres or edb database.

  1. Before creating the postgis database, we recommend creating a superuser to administer the database. To create the user, navigate into the bin directory under your Advanced Server installation and connect to the server with the psql client:

    ./psql -d edb -U enterprisedb -h 127.0.0.1
  2. Then, to create a privileged role, invoke the following command:

    CREATE ROLE gisadmin LOGIN PASSWORD 'password' SUPERUSER;
  3. Log out of psql, then connect as gisadmin:

    edb=# \q
    ./psql -d edb -U gisadmin -h 127.0.0.1
  4. Use the following commands to create the postgis database owned by gisadmin:

    CREATE DATABASE postgis;
  5. Use the \c command to switch to the postgis database, and use the CREATE EXTENSION command to create the PostGIS Extensions:

    \c postgis
    CREATE EXTENSION postgis;
    CREATE EXTENSION postgis_topology;
    CREATE EXTENSION fuzzystrmatch;
    CREATE EXTENSION address_standardizer;
    CREATE EXTENSION address_standardizer_data_us;
    CREATE EXTENSION postgis_tiger_geocoder;
    CREATE EXTENSION postgis_sfcgal;
    CREATE EXTENSION postgis_raster;

When connected with pgAdmin, you should now see PostGIS extensions, functions, tables, and trigger functions beneath the postgis database public schema. The postgis database is now geospatially enabled and can be used as a template to create new Geospatial databases.

Extensions on PgAdmin Fig. 1: Extensions on PgAdmin