[Qgis-developer] pyqgis dxf

Alexandre Busquets abusquets at gmail.com
Tue Feb 24 09:01:03 PST 2015


I changed the code without 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()








2015-02-24 16:12 GMT+01:00 Alexandre Busquets <abusquets at gmail.com>:

> Hi,
>
> can somebody help me with load  a dxf file  as a vector layer?
>
> 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', None, "OGR_GEOMETRY='POINT'",
> 'EntityHandle')
>
> layer = QgsVectorLayer(uri.uri(), 'prova', 'ogr')
>
> print 'source:', layer.source()
> print 'isValid:', layer.isValid()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150224/9383faa8/attachment.html>


More information about the Qgis-developer mailing list