<div dir="ltr"><div dir="ltr">Bonjour Sylvain,<div><br></div><div>J'espère que vous allez bien.</div><div><br></div><div><br></div><div>If you want to append features from a source layer to another layer that already exists in a GPKG file, you can do this:</div><div><br></div><div>-----------------------------------------------------------------------------------------------------</div><div>options = QgsVectorFileWriter.SaveVectorOptions()<br>options.driverName = "GPKG"<br>options.layerName = "my_existing_layer_name"  <i># Write here the existing layer name in the GPKG</i><br>options.actionOnExistingFile = QgsVectorFileWriter.AppendToLayerNoNewFields<br>options.onlySelectedFeatures = True<br><br>path = "/tmp/existing_gpkg_file_path.gpkg"<br>layer = QgsVectorLayer("/tmp/my_source_layer.shp", "my source layer name", "ogr")<br><br>result = QgsVectorFileWriter.writeAsVectorFormatV3(<br>    layer,<br>    path,  <i># Existing GPKG file path</i><br>    layer.transformContext(),<br>    options)<br></div><div>-----------------------------------------------------------------------------------------------------<br></div><div><br></div><div><br></div><div>If on the contrary, you want to append a whole layer (with its own field structure, crs, etc.) to an existing GPKG database, you can follow this solution:</div><div><br></div><div><a href="https://gis.stackexchange.com/a/417950">https://gis.stackexchange.com/a/417950</a><br></div><div><br></div><div><br></div><div>As you can see, the key is to define the options.actionOnExistingFile property, whose possible values are well documented here: </div><div><br></div><div><a href="https://api.qgis.org/api/3.28/classQgsVectorFileWriter.html#afda86eff21ac1da7dc42cbdde424acb1">https://api.qgis.org/api/3.28/classQgsVectorFileWriter.html#afda86eff21ac1da7dc42cbdde424acb1</a><br></div><div><br></div><div><br></div><div><i>Note: SInce we're using writeAsVectorFormatV3(), you need at least QGIS v3.20 for this solution to work.</i></div><div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Germán<br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié, 19 abr 2023 a las 3:55, PIERRE Sylvain via QGIS-Developer (<<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg5608974687959568442">





<div lang="FR">
<div class="m_2410919256191438187WordSection1">
<p class="MsoNormal">Hi dev and users<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I don’t understand how to append an existing gpkg layer with pyqgis.<u></u><u></u></p>
<p class="MsoNormal">I’ve tried many QgsVectorFileWriter options<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.actionOnExistingFile
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.CreateOrOverwriteLayer<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">reset final layer<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">And <u></u><u></u></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.EditionCapability
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.CanAppendToExistingLayer<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">does not change anything<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">So what’s the good way to do this ?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This is my code (I’m iterating over several other data sources)<u></u><u></u></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.SaveVectorOptions()<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.driverName
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">'GPKG'</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.onlySelectedFeatures
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(181,137,0)">True</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.layerName
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">'parcelles'</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">for</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">dir</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">in</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">dirs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">:<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">           
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">print</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">dir</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">           
<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">           
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">if</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(203,75,22)">os</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">path</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">isdir</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">dir</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">):<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">               
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">db_GPKG</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(203,75,22)">os</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">path</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">join</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">dir</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">'MAEC2023.gpkg'</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">               
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">if</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(203,75,22)">os</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">path</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">exists</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">db_GPKG</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">):<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">gpkg_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">db_GPKG</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">+</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">"|layername=parcelles"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">RPG_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorLayer(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">gpkg_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">"RPG"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">"ogr"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u> <u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">expr</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> (</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(42,161,152)">'
 "fk_mesure" is not null '</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(88,110,117)">#expr = ('"fk_mesure" = \'{}\'').format('MAEC Papillons')</span></i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u> <u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">RPG_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.selectByExpression(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">expr</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">selected_feature</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">RPG_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.selectedFeatures()<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">print</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">len</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">selected_feature</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">))<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">if</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(203,75,22)">os</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">path</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">exists</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">db_GPKG</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">):
</span><i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(88,110,117)"># if the ouput file already exist</span></i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.actionOnExistingFile
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.CreateOrOverwriteLayer<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                       
</span><i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(88,110,117)">#self.options.actionOnExistingFile = QgsVectorFileWriter.AppendToLayerNoNewFields</span></i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                       
</span><i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(88,110,117)">#self.options.actionOnExistingFile = QgsVectorFileWriter.AppendToLayerAddFields
</span></i><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.EditionCapability
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.CanAppendToExistingLayer    <u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">else</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">:<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                       
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.actionOnExistingFile
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.CreateOrOverwriteFile<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"><u></u> <u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">                   
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">write_result</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">error_message</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(133,153,0)">=</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> QgsVectorFileWriter.writeAsVectorFormatV2(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">RPG_layer</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">db_GPKG</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">
 , </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">context</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">,
</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">self</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">.</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(38,139,210)">options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)">)<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:rgb(0,43,54)"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(131,148,150)"> <u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<table border="0" cellspacing="3" cellpadding="0" width="0" style="width:483.45pt">
<tbody>
<tr style="height:115.45pt">
<td width="134" valign="top" style="width:98.5pt;padding:0cm;height:115.45pt">
<p class="MsoNormal" style="margin-left:21.3pt;line-height:115%">
<span><img width="103" height="143" style="width: 1.075in; height: 1.4916in;" id="m_2410919256191438187Image_x0020_2" src="cid:1879a0554ab4ce8e91"></span><b><span lang="EN-US" style="font-size:14pt;line-height:115%;font-family:Verdana,sans-serif;color:rgb(204,0,102)"><u></u><u></u></span></b></p>
</td>
<td width="510" style="width:380.45pt;padding:1.5pt;height:115.45pt">
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:21.3pt;line-height:115%">
<span lang="EN-US" style="font-size:13pt;line-height:115%;font-family:Verdana,sans-serif;color:rgb(0,51,153)">Sylvain PIERRE</span><b><span lang="EN-US" style="line-height:115%;font-family:Verdana,sans-serif;color:rgb(0,51,153)"><u></u><u></u></span></b></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black">Chef de projet système d’information<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black">Direction des Systèmes d’Information et du Développement Numérique<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black">Service Projets et Ingénierie Numérique<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<b><span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black">Collectivité européenne d’Alsace<u></u><u></u></span></b></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black">Tél : 03 88 76 68 88<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:black"><a href="mailto:sylvain.pierre@alsace.eu" target="_blank"><span style="color:blue">sylvain.pierre@alsace.eu</span></a><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<a href="http://www.alsace.eu" target="_blank"><span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:blue">www.alsace.eu</span></a><span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:1pt;margin-left:0cm;line-height:115%">
<a href="http://www.facebook.com/toutelalsace" target="_blank"><span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:windowtext;text-decoration:none"><img border="0" width="14" height="15" style="width: 0.15in; height: 0.1583in;" id="m_2410919256191438187Image_x0020_4" src="cid:1879a0554ab5b16b22" alt="facebook"></span></a><span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif"> </span><a href="http://www.twitter.com/toutelalsace" target="_blank"><span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:windowtext;text-decoration:none"><img border="0" width="15" height="15" style="width: 0.1583in; height: 0.1583in;" id="m_2410919256191438187Image_x0020_7" src="cid:1879a0554ab692e333" alt="twitter"></span></a><span lang="EN-US" style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif"> </span><a href="http://www.instagram.com/toutelalsace" target="_blank"><span style="font-size:8pt;line-height:115%;font-family:Verdana,sans-serif;color:windowtext;text-decoration:none"><img border="0" width="15" height="15" style="width: 0.1583in; height: 0.1583in;" id="m_2410919256191438187Image_x0020_8" src="cid:1879a0554ab7745b44" alt="insta"></span></a><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>-----------<br></div><div>   |\__  <br>(:>__)(<br>   |/    <br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br><a href="http://twitter.com/GeoTux2" target="_blank">https://twitter.com/GeoTux2</a></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div></div></div></div></div></div></div><div><div><br></div><div><a href="http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo" target="_blank"><img src="http://gis.stackexchange.com/users/flair/4972.png"></a></div></div></div></div></div></div></div></div>