Creating extensions v3.1

After installing PostGIS, create a PostGIS database and the extensions in each database where you want to use PostGIS extensions. Don't 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 to the bin directory under your EDB Postgres 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 isn't available on Ubuntu 18, Ubuntu 20, SLES 12, RHEL/CentOS 7 - ppc64le, and Windows platforms.

When connected with pgAdmin, you can see PostGIS extensions, functions, tables, and trigger functions beneath the postgis database public schema. The postgis database is now geospatially enabled. You can use it as a template to create geospatial databases.