[Qgis-user] python qgis 3 adding features fails partly

Michel Stuyts michel.stuyts at edegem.be
Thu Feb 28 01:34:24 PST 2019


You can add an empty table to QGIS but it depends on the definition of your geometry column.

This table can be added:
CREATE TABLE public.test
(
    id oid NOT NULL,
    naam text COLLATE pg_catalog."default" NOT NULL,
    geom geometry(Point,31370),
    CONSTRAINT test_pkey PRIMARY KEY (id)
)


This table cannot be added:
CREATE TABLE public.test
(
    id oid NOT NULL,
    naam text COLLATE pg_catalog."default" NOT NULL,
    geom geometry(Geometry,31370),
    CONSTRAINT test_pkey PRIMARY KEY (id)
)

The easiest way to create the new table is to use the DB Manager.

Michel

-----Oorspronkelijk bericht-----
Van: Qgis-user <qgis-user-bounces at lists.osgeo.org> Namens Reginald
Verzonden: donderdag 28 februari 2019 9:22
Aan: qgis-user at lists.osgeo.org
Onderwerp: Re: [Qgis-user] python qgis 3 adding features fails partly

Hi,

I'm still scratching my head over this one.
As a test I created a table 'test' in postgis:
id: pkey type oid
naam: type text
geom: type geometry

select updateGeometrySrid('test','geom',31370) # assigning projected CRS to geometry

When I try to add this table to qgis using the database explorer I get an error because there is no geometry in the table.
So I was wondering if it is impossible to add an empty postgis table to qgis?

Regards,



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the Qgis-user mailing list