[Qgis-user] Edition of PostGIS table with 2 geometries

pcreso at pcreso.com pcreso at pcreso.com
Wed Apr 11 15:23:22 PDT 2012


    > On 04/11/2012 10:15 PM, Piotr Pachół wrote:
    >
> Hello,
      > 
> I have table in PosGIS, which has 2 geometries: geometry(Point)
      > and geometry(MultiPolygon).
      > 
> Two geometries is because each object/record of table has 2
      > representations: as point and as polygon.
      >
      > In Qgis this table is displayed as two layers: point layer and
      > polygon layer.
      >
> When I create new object I have problem, because I can't add/edit
      > at the same time two geometries in one record of table.
      >
> When I add one object in  point layer and one object in polygon
      > layer I have 2 records in PostGIS table - I would like to have one
      > record.

This is the correct behaviour. You are telling QGIS to create a new record each time, so it does. Twice. What you need to do is create the new record (with either a point or polygon geometry), then update (edit)  this record to add the missing geometry value.

You could have PostGIS apply a trigger upon the creation of a record (with a new polygon geometry) to populate the point geometry column with either the polygon centroid (which may lie outside the polygon) or an arbitrary point lying within the polygon.


Brent Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120411/786bb3c5/attachment.html>


More information about the Qgis-user mailing list