Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
I have already installed all the required components, I had to actually locate the file in the /usr/share/postgresql/8.4/contrib/ – Sam007 Jul 18 '12 at 16:14
step1 : cd /usr/share/postgresql/8.4/contrib/ – francs Jul 18 '12 at 22:13
step2: psql -d yourdatabase -f postgis.sql – francs Jul 18 '12 at 22:13
yup already done – Sam007 Jul 18 '12 at 22:21

You must install the PostGIS functions, data types, etc. before you can use PostGIS. This can be found in these three SQL-files. Set the correct path to the files and execute them in PostgreSQL by using psql.

share|improve this answer
I located the files in the /usr/share/postgresql/8.4/contrib/ – Sam007 Jul 18 '12 at 16:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.