<div dir="ltr"><div dir="ltr">Hi Luis, <div><br></div><div>if you are fine with a plugin solution, then there is one called "Append Features to Layer" [1] that adds a new algorithm to QGIS Processing. </div><div><br></div><div>If you run it once via Processing Toolbox, then in the Processing History you'll get the Python command, which you could use in your code to append features to layers.</div><div><br></div><div><br></div><div>BTW, QGIS Processing will come with an append features to existing layer out-of-the-box. It's planned for QGIS 3.14. See it in action [2].</div><div><br></div><div><br></div><div>Regards, </div><div><br></div><div>Germán</div><div>-----------</div><div>[1] <a href="https://github.com/gacarrillor/AppendFeaturesToLayer/">https://github.com/gacarrillor/AppendFeaturesToLayer/</a></div><div>[2] <a href="https://github.com/qgis/QGIS/pull/35641">https://github.com/qgis/QGIS/pull/35641</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 13 may. 2020 a las 6:25, Jorge Gustavo Rocha (<<a href="mailto:jgr@di.uminho.pt">jgr@di.uminho.pt</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">Hola Luís,<br>
<br>
The options are quite simple. You can see them in this SO question:<br>
<a href="https://gis.stackexchange.com/questions/87404/how-to-write-a-new-layer-to-postgresql-from-qgis-plugin/360270#360270" rel="noreferrer" target="_blank">https://gis.stackexchange.com/questions/87404/how-to-write-a-new-layer-to-postgresql-from-qgis-plugin/360270#360270</a><br>
<br>
You should create a temporary layer with the original one, plus the<br>
features you want to append. Then you write it to the database.<br>
<br>
Does it help?<br>
<br>
Regards,<br>
<br>
Jorge Gustavo<br>
<br>
On 13/05/20 11:57, Luís Miguel Royo Pérez wrote:<br>
> Hi all,<br>
> I'm seeking a way to append features to a layer when exporting into a<br>
> PostGIS layer.<br>
> <br>
> For now I'm using the tool QgsVectorLayerExporter.<br>
> <br>
> I'm doing something like this<br>
> <br>
> QgsVectorLayerExporter(uri, "postgres", fields, layer.wkbType(),<br>
> utils().crs, overwrite,{}).addFeatures([feat for feat in<br>
> layer.getFeatures()])<br>
> <br>
> Inside the curly brackets I know I can place the options, but I can't<br>
> find where are these options documented. Or wether these options can<br>
> help me in my task of append features to a QGIS layer.<br>
> <br>
> Can anyone point me in the right direction in this task of appending<br>
> features?<br>
> <br>
> Kind regards.<br>
> -- <br>
> Luís Miguel Royo Pérez.<br>
> Analista-Programador GIS<br>
> C/ Antic Regne de Valencia nº 4. Manises (Valencia)<br>
> Teléfono:+34  679846103<br>
> webs:<br>
> <a href="http://inisig.com" rel="noreferrer" target="_blank">inisig.com</a> <<a href="http://inisig.com" rel="noreferrer" target="_blank">http://inisig.com</a>><br>
> <a href="http://geofibra.com" rel="noreferrer" target="_blank">geofibra.com</a> <<a href="https://geofibra.com" rel="noreferrer" target="_blank">https://geofibra.com</a>><br>
> <br>
> <br>
> <br>
> _______________________________________________<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>
> <br>
<br>
J. Gustavo<br>
-- <br>
Jorge Gustavo Rocha<br>
Departamento de Informática<br>
Universidade do Minho<br>
4710-057 Braga<br>
Gabinete 3.29 (Piso 3)<br>
Tel: +351 253604480<br>
Fax: +351 253604471<br>
Móvel: +351 910333888<br>
skype: nabocudnosor<br>
_______________________________________________<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></blockquote></div><br clear="all"><div><br></div>-- <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>