I've built a database with postgreSQL with tables, which include geometry columns. When I add some data to my non-geometry columns, I can see them in QGIS when I connect to my database using postgis. Now, I want to add polygons to the existing entries with the editing tool in QGIS. That means, filling up the geometry columns in QGIS.

How can I do this? I've only heard about adding whole shapefiles to the database but not to add single features to a single column.

An example... I have the following table (municipality):

id smallint NOT NULL,
name varchar(50) NOT NULL,
mun_geom geometry(Polygon, 31468)

I can fill the columns id and name in postgresql when I'm connected to my database (like (1,'municipality1')). After adding municipality as a postgis layer I want to complement the entry with adding a polygon feature.

  • @mapBaker sorry but I cannot add a comment to your post because I don't have 50 reputation. Anyway your solution doesn't work for me. When I try to add part qgis show the error The new part is not a valid Geometry Thanks
    – franco_b
    Oct 6, 2014 at 14:22

3 Answers 3


Figured this out! (also asked here)

A record in a spatial table (Shapefile, PostGIS, Spatialite) that has no geometry can have geometry added by adding a 'part' to the feature using the advanced digitizing toolbar. Here's the workflow:

  1. Bring table containing the geometry-missing feature into QGIS
  2. Select the layer from the layers panel and start an edit session on that layer
  3. Right-click the toolbar area of QGIS (where there is no button) and open the advanced digitizing toolbar
  4. Open the attribute table of the layer and select the feature that is missing geometry
  5. On the advanced digitizing toolbar, click the add part tool
  6. You can now add the geometry of the feature (point, line, or polygon) as you would add any new feature to a table
  7. Save your edits, and stop editing. The feature now has geometry!

I tried to do something similar to what you're doing in Spatialite, I had a table and wanted to add and populate a geometry column for that table. I wasn't able to do it directly, but what I ended up with worked. I added a second table with just two fields, a key to match back to my original table and my geometry column. I populated it then created a view that combined the two tables. You can do the same, or you can populate the second table then use an UPDATE query to fill in the geometry column of your first table if you want everything in just one table.


maybe this tutorial can help you: http://www.gistutor.com/quantum-gis/20-intermediate-quantum-gis-tutorials/34-working-with-your-postgis-layers-using-quantum-gis-qgis.html

you can add new feature in your postgis layer using Qgis from editing tools in the Edit menu and editing attribute table using “Identify Features” tool and “Open Attribute Table”

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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