There is a PostgreSQL database containing some layers that have few types of geometry (multipolygons and linestrings). I need to distinguish these geometries in two separate layers.
My basic strings that make layer for QGIS are:
uri.setConnection('srs', '5432', 'db_name', 'postgres' , 'password') for i, name in enumerate(sorted(list_of_layers)): # list containing elements like ['schema_name', 'layer_name'] if name in ['layer_with_geometry_collection']: uri.setDataSource(name, name, 'SP_GEOMETRY') vlayer=QgsVectorLayer (uri.uri(), name, "postgres")
Where do I need to set the geometry type?
If I check
vlayer.wkbType(), it throws me
uri.setWkbType() hadn't helped yet.