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 <[email protected]>:

> 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
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to