Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- host='localhost'
- port="5432"
- db='rob'
- user='rob'
- password='password'
- filter = "name = 'M5'"
- uri = QgsDataSourceURI()
- uri.setConnection(host, port, db, user, password)
- uri.setDataSource("public", "dft_major_roads", "geom", filter ,"gid")
- print uri.uri()
- vlayer = QgsVectorLayer(uri.uri(), "M5", "postgres")
- QgsMapLayerRegistry.instance().addMapLayer(vlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement