Geographic Information Systems Asked by aurel_nc on January 12, 2021
I had to backup a PostGIS model in a geopackage and I wonder how to load a non-spatial table, aka a table with NO geometry_column.
Just had to write None instead of the geometry_column name in the setDataSource method.
uri = QgsDataSourceUri()
uri.setConnection("MyServerAdress", "5432", "myBase", "user", "pass")
uri.setDataSource(schema, table, None)
layer = QgsVectorLayer(uri.uri(False), table, "postgres")
QgsProject.instance().addMapLayer(layer)
Correct answer by aurel_nc on January 12, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP