vendredi 27 février 2015

PyQGIS load dxf file as a vector layer


Can somebody help me with loading a dxf file as a vector layer with PyQGIS?


Is QgsDataSourceURI an option? I've tried it with this code, but it didn't work.



fitxer="/tmp/prova.dxf"
uri = QgsDataSourceURI()
uri.setDatabase(fitxer)
uri.setDataSource('', 'entities', 'OGR_GEOMETRY', "OGR_GEOMETRY='POINT'", 'fid')

layer = QgsVectorLayer(uri.uri(), 'prova', 'ogr')

print 'isValid:', layer.isValid()




Aucun commentaire:

Enregistrer un commentaire