[Qgis-developer] addVectorLayer and PostGIS layer: forcing geometry type

luca_manganelli at comune.trento.it luca_manganelli at comune.trento.it
Thu Apr 28 10:01:23 EDT 2011

Hi all,

I have a PostGIS layer with multiple geometries: POINT, MULTIPOINT,

I tried to add a layer in this way:

  uri = QgsDataSourceURI()
  uri.setConnection ("cartografia", "5432", "schema", "postgres", "pppp")
  uri.setSql ("sql=GeometryType('wkb_geometry') IN
  self.iface.addVectorLayer (uri.uri(), tab, "postgres")

but QGIS complains that it cannot add GEOMETRY types. How can threat this
layer as LINESTRING ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110428/db1cb754/attachment.html

More information about the Qgis-developer mailing list