[Qgis-developer] pyqgis dxf

2015-02-20 Thread Alexandre Busquets
Hi, can somebody help me with load a dxf file into a layer? I have done this: fitxer="PARCELARIPEPCH.dxf" layer = QgsVectorLayer(fitxer, 'prova', 'ogr') if not layer.isValid(): print "invalid layer" And always have an invalid layer. And then, how I have to filter by different geomtry typ

[Qgis-developer] pyqgis dxf

2015-02-24 Thread Alexandre Busquets
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'", 'EntityHand

Re: [Qgis-developer] pyqgis dxf

2015-02-24 Thread Alexandre Busquets
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

Re: [Qgis-developer] pyqgis dxf

2015-02-25 Thread Alexandre Busquets
the solution: fitxer="/tmp/prova.dxf|layername=entities|geometrytype=Point" layer = QgsVectorLayer(fitxer, 'prova', 'ogr') QgsMapLayerRegistry.instance().addMapLayer(layer) 2015-02-24 16:12 GMT+01:00 Alexandre Busquets : > Hi, > > can somebody help me with load a dxf file as a vector layer

Re: [Qgis-developer] pyqgis dxf

2015-02-25 Thread Luigi Pirelli
please, post it in the question you did in gis.stackexchange. would be great if you can add a simple example also in the http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/loadlayer.html cloning, modifying and pull request to: https://github.com/qgis/QGIS-Documentation/blob/master/so