Creating Extensions v3.1.2

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. Invoke the following command to create a privileged role:

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

    edb=# \q
    ./psql -d edb -U gisadmin -h 127.0.0.1
  4. Invoke the following command 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;
Note

The postgis-sfcgal extension is not available on Ubuntu 18, Ubuntu 20, SLES 12, RHEL/CentOS 7 - ppc64le, and Windows platforms.

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. 8: Extensions on PgAdmin