[QGIS-Developer] pygdaltools library documentation sparce
I am running simple code to convert dxf to gpkg and I get the error below. -am an trying to figure eout how to add a bunch of options ( -f GPKG -append -update --config DXF_ENCODING CP1252 --config DXF_INCLUDE_RAW_CODE_VALUES TRUE --config DXF_TRANSLATE_ESCAPE_SEQUENCES FALSE --config DXF_MERGE_BLOCK_GEOMETRIES FALSE --config DXF_INLINE_BLOCKS TRUE -nlt LINESTRING -nln 32111_F But can't even figure out how to add the recommended skipfailures. I tried adding gdal_tools.config_options("-skipfailures") but I get pyling tells me it is not callable. Anyone use pygdaltools? import gdaltools gdal_tools = gdaltools.ogr2ogr() gdal_tools.BASEPATH = r"C:\Program Files\QGIS 3.16.16\bin" gdal_tools.set_encoding("UTF-8") gdal_tools.set_input(self.dxf_out_path) gdal_tools.set_output(self.gpkg_out) gdal_tools.execute() And I get the ERROR:root:b"Warning 1: Layer creation options ignored since an existing layer is\r\n being appended to.\r\nWarning 6: Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR 1: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type shapefile.\r\nERROR 1: Unable to write feature 0 from layer entities.\r\nERROR 1: Terminating translation prematurely after failed\r\ntranslation of layer entities (use -skipfailures to skip errors)\r\n" Traceback (most recent call last): File "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", line 227, in main() File "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", line 196, in main mp_designs.gdal_convert() File "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", line 185, in gdal_convert gdal_tools.execute() File "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\ogr2ogrcmd.py", line 330, in execute return self._do_execute(args) File "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\basetypes.py", line 108, in _do_execute raise GdalToolsError(rc, err) gdaltools.basetypes.GdalToolsError: (1, b"Warning 1: Layer creation options ignored since an existing layer is\r\n being appended to.\r\nWarning 6: Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR 1: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type shapefile.\r\nERROR 1: Unable to write feature 0 from layer entities.\r\nERROR 1: Terminating translation prematurely after failed\r\ntranslation of layer entities (use -skipfailures to skip errors)\r\n")error: ___ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [QGIS-Developer] pygdaltools library documentation sparce
On Wed, 11 Oct 2023 at 15:15, Catania, Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer wrote: > > Anyone use pygdaltools? You're better off asking this on the GDAL-Dev list, rather than QGIS-Dev. Nyall > > > > > > import gdaltools > > gdal_tools = gdaltools.ogr2ogr() > > gdal_tools.BASEPATH = r"C:\Program Files\QGIS 3.16.16\bin" > > > > gdal_tools.set_encoding("UTF-8") > > gdal_tools.set_input(self.dxf_out_path) > > gdal_tools.set_output(self.gpkg_out) > > gdal_tools.execute() > > > > And I get the ERROR:root:b"Warning 1: Layer creation options ignored since an > existing layer is\r\n being appended to.\r\nWarning 6: > Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR 1: > Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type > shapefile.\r\nERROR 1: Unable to write feature 0 from layer > entities.\r\nERROR 1: Terminating translation prematurely after > failed\r\ntranslation of layer entities (use -skipfailures to skip > errors)\r\n" > > Traceback (most recent call last): > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", > line 227, in > > main() > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", > line 196, in main > > mp_designs.gdal_convert() > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", > line 185, in gdal_convert > > gdal_tools.execute() > > File > "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\ogr2ogrcmd.py", > line 330, in execute > > return self._do_execute(args) > > File > "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\basetypes.py", > line 108, in _do_execute > > raise GdalToolsError(rc, err) > > gdaltools.basetypes.GdalToolsError: (1, b"Warning 1: Layer creation options > ignored since an existing layer is\r\n being appended to.\r\nWarning > 6: Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR > 1: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type > shapefile.\r\nERROR 1: Unable to write feature 0 from layer > entities.\r\nERROR 1: Terminating translation prematurely after > failed\r\ntranslation of layer entities (use -skipfailures to skip > errors)\r\n")error: > > > > > > ___ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer ___ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [QGIS-Developer] pygdaltools library documentation sparce
OK. I am doing a bunch of GDAL commands in my QGIS plugin so opted for this forum. -Original Message- From: Nyall Dawson Sent: Wednesday, October 11, 2023 1:19 AM To: Catania, Luke A ERDC-RDE-GRL-VA CIV Cc: qgis-developer@lists.osgeo.org Subject: Re: [QGIS-Developer] pygdaltools library documentation sparce On Wed, 11 Oct 2023 at 15:15, Catania, Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer wrote: > > Anyone use pygdaltools? You're better off asking this on the GDAL-Dev list, rather than QGIS-Dev. Nyall > > > > > > import gdaltools > > gdal_tools = gdaltools.ogr2ogr() > > gdal_tools.BASEPATH = r"C:\Program Files\QGIS 3.16.16\bin" > > > > gdal_tools.set_encoding("UTF-8") > > gdal_tools.set_input(self.dxf_out_path) > > gdal_tools.set_output(self.gpkg_out) > > gdal_tools.execute() > > > > And I get the ERROR:root:b"Warning 1: Layer creation options ignored since an > existing layer is\r\n being appended to.\r\nWarning 6: > Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR 1: > Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type > shapefile.\r\nERROR 1: Unable to write feature 0 from layer > entities.\r\nERROR 1: Terminating translation prematurely after > failed\r\ntranslation of layer entities (use -skipfailures to skip > errors)\r\n" > > Traceback (most recent call last): > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\ > plugins\site_selection\tools\master_planning\load_mp_designs.py", line > 227, in > > main() > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\ > plugins\site_selection\tools\master_planning\load_mp_designs.py", line > 196, in main > > mp_designs.gdal_convert() > > File > "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\ > plugins\site_selection\tools\master_planning\load_mp_designs.py", line > 185, in gdal_convert > > gdal_tools.execute() > > File > "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdalt > ools\ogr2ogrcmd.py", line 330, in execute > > return self._do_execute(args) > > File > "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdalt > ools\basetypes.py", line 108, in _do_execute > > raise GdalToolsError(rc, err) > > gdaltools.basetypes.GdalToolsError: (1, b"Warning 1: Layer creation options > ignored since an existing layer is\r\n being appended to.\r\nWarning > 6: Normalized/laundered field name: 'EntityHandle' to 'EntityHa_2'\r\nERROR > 1: Attempt to write non-linestring (GEOMETRYCOLLECTION) geometry to ARC type > shapefile.\r\nERROR 1: Unable to write feature 0 from layer > entities.\r\nERROR 1: Terminating translation prematurely after > failed\r\ntranslation of layer entities (use -skipfailures to skip > errors)\r\n")error: > > > > > > ___ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: > Blockedhttps://lists.osgeo.org/mailman/listinfo/qgis-developerBlocked > Unsubscribe: > Blockedhttps://lists.osgeo.org/mailman/listinfo/qgis-developerBlocked ___ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer