<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">I am running simple code to convert dxf to gpkg and I get the error below. -am an trying to figure out 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)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">But can’t even figure out how to add the recommended skipfailures flag. I tried adding
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdal_tools.config_options("-skipfailures")<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">but I get pylint tells me it is not callable. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Anyone use pygdaltools? There is some documentation, but nothing showing you how to set these command line parameters.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">import gdaltools<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdal_tools = gdaltools.ogr2ogr()<o:p></o:p></p>
<p class="MsoNormal">gdal_tools.BASEPATH = r"C:\Program Files\QGIS 3.16.16\bin"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gdal_tools.set_encoding("UTF-8")<o:p></o:p></p>
<p class="MsoNormal">gdal_tools.set_input(self.dxf_out_path)<o:p></o:p></p>
<p class="MsoNormal">gdal_tools.set_output(self.gpkg_out)<o:p></o:p></p>
<p class="MsoNormal">gdal_tools.execute()<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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"<o:p></o:p></p>
<p class="MsoNormal">Traceback (most recent call last):<o:p></o:p></p>
<p class="MsoNormal"> File "c:\Users\RDTECLAC\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\site_selection\tools\master_planning\load_mp_designs.py", line 227, in <module><o:p></o:p></p>
<p class="MsoNormal"> main()<o:p></o:p></p>
<p class="MsoNormal"> 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<o:p></o:p></p>
<p class="MsoNormal"> mp_designs.gdal_convert()<o:p></o:p></p>
<p class="MsoNormal"> 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<o:p></o:p></p>
<p class="MsoNormal"> gdal_tools.execute()<o:p></o:p></p>
<p class="MsoNormal"> File "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\ogr2ogrcmd.py", line 330, in execute<o:p></o:p></p>
<p class="MsoNormal"> return self._do_execute(args)<o:p></o:p></p>
<p class="MsoNormal"> File "C:\Users\RDTECLAC\AppData\Roaming\Python\Python39\site-packages\gdaltools\basetypes.py", line 108, in _do_execute<o:p></o:p></p>
<p class="MsoNormal"> raise GdalToolsError(rc, err)<o:p></o:p></p>
<p class="MsoNormal">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:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>