Home > Linux, PostGIS, PostgreSQL, Uncategorized, Windows > Create a spatial database with PostGIS

Create a spatial database with PostGIS

Ensure your PostgreSQL database is correctly installed and running. Do do it just check the connection using PgAdmin III client. If an error arrises, probabily your server isn’t running. nu Start it using the “Start server” entry in the start menu of your operating system or else on Ubuntu this will work (if the server was installed as in this previous post)

sudo /opt/PostgreSQL/8.4/installer/server/startserver.sh

1) Open the Databases tree item and have a look at the available databases. The postgres database is the user database for the default postgres user and is not too interesting to us. The template_postgis database is what we are going to use to create spatial databases. Right-click on the Databases item and select New Database.

Note: If you receive an error indicating that the source database (template_postgis) is being accessed by other users, this is likely because you still have it selected. Right-click on the PostgreSQL 8.4 item and select Disconnect. You can then double-click the same item to reconnect and try again.

2) Fill in the New Database form with the info below and click OK.

Name: your_database_name
Owner: postgres
Encoding: UTF8
Template: template_postgis
.

3) Select the new database and click on the SQL query button (or go to Tools > Query Tool).

4) Enter the following query into the query text field:

SELECT postgis_full_version();

5) Click the play button in the toolbar (F5 will work also) to execute the query. The query will return a string that confirms that PostGIS is properly enabled in the database.

Information source/

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment