[Qgis-user] Fwd: pyqgis dxf
Alexandre Busquets
abusquets at gmail.com
Wed Feb 25 02:03:02 PST 2015
Hi Ricard,
thanks for your help, but this is not a valid option for me. I need load
the layer directly, without the "Select vector layers to add" dialog.
2015-02-25 10:55 GMT+01:00 Richard Duivenvoorde <rdmailings at duif.net>:
> On 25-02-15 08:05, Alexandre Busquets wrote:
> > 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', 'OGR_GEOMETRY',
> > "OGR_GEOMETRY='POINT'", 'fid')
>
> iface.addVectorLayer('/tmp/points.dxf', 'mydxflayer', 'ogr')
>
> works for me in the python console
>
> did not try the QGSDataSourceURI-path, but that should also work
>
> (note that depending on you settings and data you will get one or more
> dialogs (for crs and/or sub layers)
>
> Regards,
>
> Richard Duivenvoorde
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150225/37bc5cce/attachment.html>
More information about the Qgis-user
mailing list