generalpostgresql

Check for PostGIS support

Execute the following command and check the output to find out if PostGIS is installed and which version is in use:

$ psql -c "SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' ;"

Here is an example of the output:

     name       | default_version | installed_version
------------------+-----------------+-------------------
postgis          | 2.0.0           |
postgis_topology | 2.0.0           |
(2 rows)

To check which version of PostGIS is being loaded by the database, execute the following command:

$ psql yourdatabase -c "SELECT PostGIS_Full_Version()"

Here is an example of the output:

postgis_full_version
-----------------------------------------------------------------------
POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6
March 2012" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8"
LIBJSON="UNKNOWN" TOPOLOGY RASTER
Last modification December 21, 2022