PostgreSQL: Activating PostgreSQL PostGIS extension

This documentation is part of the Getting started guide. View the full guide here: How to get started with PostgreSQL.

👋 Welcome to the Stackhero documentation!

Stackhero provides a fully managed PostgreSQL cloud service, designed for reliability and speed:

  • Unlimited connections and data transfers for seamless scaling.
  • PgAdmin web UI included for intuitive database management.
  • Popular extensions included, such as PostGIS, TimescaleDB, and PgVector.
  • Simple, one-click updates keep your database secure and current.
  • High performance and strong security on private, dedicated infrastructure.

You can get started with Stackhero's PostgreSQL cloud hosting in just a few minutes. Enjoy a reliable database experience and save valuable time managing your data.

The PostGIS extension is included with our PostgreSQL service. You must activate it on each database where you plan to use it.

To activate the extension, connect to your database and execute this query:

CREATE EXTENSION postgis;

You can verify that PostGIS is working by checking its version:

SELECT PostGIS_Full_Version();

Alternatively, retrieve a list of all installed PostGIS extensions:

SELECT * FROM pg_extension WHERE extname LIKE 'postgis%';

If necessary, you may add other extensions. However, it is strongly recommended that you do not activate extensions that you will not use:

-- Enable PostGIS
CREATE EXTENSION postgis;

-- Enable raster support
CREATE EXTENSION postgis_raster;

-- Enable Topology
CREATE EXTENSION postgis_topology;

-- Fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;

-- Rule based standardizer
CREATE EXTENSION address_standardizer;

-- Example rule data set
CREATE EXTENSION address_standardizer_data_us;

-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;

Caution: do not activate PostGIS on the database postgres!