Pergunta

I ran command in psql:

my-spatial-db=# CREATE EXTENSION postgis;

and get error:

ERROR:  could not open extension control file "/usr/share/pgsql/extension/postgis.control": No such file or directory

my-spatial-db=# select postgis_full_version();
NOTICE:  Function postgis_gdal_version() not found.  Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
NOTICE:  Function postgis_raster_scripts_installed() not found. Is raster support enabled and rtpostgis.sql installed?
NOTICE:  Function postgis_raster_lib_version() not found. Is raster support enabled and rtpostgis.sql installed?
                                 postgis_full_version                                      
-----------------------------------------------------------------------------------------------
 POSTGIS="2.0.2 r10789" GEOS="3.3.6-CAPI-1.7.6" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML="2.9.1"


my-spatial-db=# select version();
                                                   version                                                   
-------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.7 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7), 64-bit

I installed PostGIS from .tar since my os is AWS EC2 Amazon Linux(doesn't have build-in postgis package in yum)

I also ran these two commands:

psql -d my-spatial-db -f /usr/share/pgsql/contrib/postgis-2.0/postgis.sql
psql -d my-spatial-db -f /usr/share/pgsql/contrib/postgis-2.0/spatial_ref_sys.sql

Am I missing something? Thanks very much!

Foi útil?

Solução 2

Does your database require either raster or topology support? If not, then you already have spatially enabled your database with the enabler scripts, since postgis_full_version() worked (ignore the NOTICE unless you need this functionality).

Note that the CREATE EXTENSION postgis is a different way to install PostGIS, which is not compatible to using enabler scripts (psql -f /path/to/postgis.sql). If you prefer this method, then you need to build PostGIS with raster support (i.e. requires libgdal-dev), and don't run the enabler scripts.

See related answer: https://stackoverflow.com/a/22998869/327026

Outras dicas

For readers on RHEL 5, that particular distro doesn't support PostGIS 2 via PGDG, per this blog post, because there isn't a suitable libgeos in RHEL 5.

This answer only applies to RHEL5. If you're using something else you probably just didn't install PostGIS.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top