Saturday, 5 December 2015

Loading DXF file as vector layer using PyQGIS?


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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...