Postgresql – Trying to create PostGIS database

postgispostgresqlspatialUbuntu

I am trying to create a spatially enabled PostGIS database by following the PostGIS documentation.

In the short version, i executed,

createdb yourdatabase
createlang plpgsql yourdatabase

But I did not execute the last three commands,

psql -d yourdatabase -f postgis.sql
psql -d yourdatabase -f postgis_comments.sql
psql -d yourdatabase -f spatial_ref_sys.sql

Is my database still spatially enabled? If not, then can you tell me where these .sql files are located so I can execute those last commands, since I am getting the following error,

postgis.sql: No such file or directory

I am using Ubuntu 12.04.

Best Answer

You should install PostGIS, GEOS, Proj and maybe other components first. If you install PostGIS successfully, the postgis.sql, postgis_comments.sql, spatial_ref_sys.sql will locate the $PGHOME/share/contrib directory.