mardi 24 février 2015

pyqgis load dxf file as dxf file as a vector layer


Can somebody help me with load a dxf file as a vector layer with pyqgis?


Is QgsDataSourceURI an option? I tried with this code, but I haven't been lucky.


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()


Thanks.





Aucun commentaire:

Enregistrer un commentaire