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.


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.


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.


I found the geodjango documentation really good.

https://docs.djangoproject.com/en/1.9/ref/contrib/gis/install/postgis/ https://docs.djangoproject.com/en/1.9/ref/contrib/gis/install/geolibs/

They have given step by step explanation on installing postgis and dependencies. You can consult the postgis documentation or other sources when instructions are django specific.

  • Thanks, but you've basically added a link-only answer which we don't like here because they break over time. Please add stand-alone answers, though supporting links are fine. – Colin 't Hart Apr 24 '16 at 11:50
  • @Colin'tHart I totally agree with you. I considered to post entire content, but posted the links because size of content was too large and it belongs to django, so chances are thin that this content will be removed. Will improve the answer. But right now, detailed answer has more than 2 links I need more than 10 repo points for that. – Ashish Rana Apr 24 '16 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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