[QGIS-Developer] Could not find topology of layer NULL.NULL.'topo'

David Wahlund david.wahlund at gmail.com
Fri May 24 05:51:24 PDT 2019


Hi
I'm trying to label each TopoGeom in a layer with it's id using
'id(<TopoGeom column name>)'.

sql = "SELECT *, id(my_topo_column) geom_id FROM myschema.mytable"
my_uri.setDataSource('', '({})'.format(sql), 'topo', '', 'geom_id')
my_uri.setSrid(str(my_layer_srid))
my_uri.setWkbType(my_layer_type)
my_layer = QgsVectorLayer( my_uri.uri(False), my_layer_name, 'postgres')

This gives the following warning

WARNING    Could not find topology of layer NULL.NULL.'topo'


Just adding the layer works. My guess is that since this sets the schema
and table names the provider is able to pick them up when it tries to find
the topology. I tried to supply a schema name but that crashes QGIS. I
guess the table declaration as a SELECT query doesnä't have a table name.


I tried to add a layer manually throught the DB Manager SQL Window with the
same result and warning.


Are there any special considerations that I've missed when trying to add
TopoGeom layers using PyQGIS?


Regards

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190524/687c8dca/attachment.html>


More information about the QGIS-Developer mailing list