A PostGIS layer can be created in DB Manager.

Click on "DB Manager". (see the picture above)



The box "DB Manager" popups.

In the left panel click on "+" on the left of "PostGIS".



Mark the connection under PostGIS, that you want to use. In our example it is named "FDS PostGIS".

Sometimes it is nessesary to click on a "+" further down the tree, to make the "Table" menu visible. (see the picture above)

Under "Table" click on "Create table".



The box "Create Table" popups.

Choose the Schema you want to use. In our example it is named "vitjandi".

Give the layer a name under "Name". In our example we use "ruskspannir".


A layer in PostGIS that contains geometric data, always has a column named "the_geom".

In this column the geometric data are saved.

We need to save geometric data, so we put an "x" in front of "Create geometry column".

We choose "POINT" because we will register our features as points.

In "Name" we write "the_geom".

"SRID" should contain the code of the coordinate system, that we want to use. We write "32629".

Enter "x" in "Create spatial index". This will make the table/layer work faster.



We also need to create other columns to the layer.

Click on "Add field" and a column appears.

All layers should have a "gid" column, which is a unique id. Therefore we first create a "gid" column.

Set "Name" to "gid", and let "Type" be "serial".



Create one more column named "stodd", and set "Type" to "numeric".

Create another column named "litur", and set "Type" to "varchar".

Now we can save data about size and color of "ruskspannir".

The "gid" column is needed as a primary key, and because of this we will set "Primary key" to "gid".

(if you dont know what "primary key" means, dont think much about it. Just always create a column named "gid" and choose it under "Primary key" and you will do fine)

Click on "Create".

After the layer is created, click on "Close".

P.S.: When we give names to layers and columns in the database, it is a good base rule to never use special characters, to use "_" instead of space and where using letters only use lowercase letters. If you do follow these base rules, you will get rid of unessesary troubles.



We are finished creating the layer, but we havent added it yet.

Click on "Add PostGIS Layer", and the box "Add PostGIS Table(s)" popups.



Under "Connections" choose the connection you want to use, and click on "Connect".

Then in the list find the layer you want to use. In our example it is "ruskspannir".

Click on "Add".



Now we have added the layer "Ruskspannir", which we just made.

Click on the icon "Toggle Editing" and then on the icon "Add Feature".

Click somewhere on the map, and the box "Attributes" popups.



You can see, that the "Attributes" box contains the same columns, that we created a while ago.



Then enter some values in the fields.

Dont change anything in the column "gid", just let it contain the text, that is already there.

After you have entered something into the fields, click on "OK".



And now our first feature is created in our new PostGIS layer.


You are welcome to write comments below. If you have any questions, please post in the forum.

PostGIS layer