<div dir="ltr"><div>Hi, <br></div><div>
<span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">I am new to the plugin programming for Qgis, I am trying to create one project with offline layers and later update the database in postgis.</span> <span title="" class="gmail-">I was reviewing some documentation and plugin on the subject, but I am unable to solve a problem I am having.</span><br><span title="" class="gmail-">I am creating the offline project inĀ  geopackage or spatialite, but when I delete objects or modify and synchronize, it shows me the same objects that I downloaded from the database.</span> <span title="" class="gmail-">What am I doing wrong?</span><br><span title="" class="gmail-">This is part of my code:</span></span></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"Courier New""><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">download_project</span>(<span style="color:rgb(148,85,141)">self</span>):<br>    <span style="color:rgb(98,151,85);font-style:italic">"""Download selected project to convert it offline."""<br></span><span style="color:rgb(98,151,85);font-style:italic">    </span>proj = QgsProject.instance()<br><br>    project_name = proj.title()<br><br>    layer_ids_to_download = [<br>        layer_id<br>        <span style="color:rgb(204,120,50)">for </span>layer_id<span style="color:rgb(204,120,50)">, </span>layer <span style="color:rgb(204,120,50)">in </span>proj.mapLayers().items()<br><br>    ]<br>    offliner = QgsOfflineEditing()<br>    offliner.convertToOfflineProject(<span style="color:rgb(106,135,89)">'D:</span><span style="color:rgb(204,120,50)">\\</span><span style="color:rgb(106,135,89)">temp'</span><span style="color:rgb(204,120,50)">,</span>project_name+<span style="color:rgb(106,135,89)">'.sqlite'</span><span style="color:rgb(204,120,50)">,</span>layer_ids_to_download<span style="color:rgb(204,120,50)">,</span><span style="color:rgb(170,73,38)">onlySelected</span>=<span style="color:rgb(204,120,50)">False,<br></span><span style="color:rgb(204,120,50)">                                     </span><span style="color:rgb(170,73,38)">containerType</span>=QgsOfflineEditing.SpatiaLite)<br><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">sincronizar</span>(<span style="color:rgb(148,85,141)">self</span>):<br>    offliner = QgsOfflineEditing()<br>    offliner.synchronize()</pre><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">
Regards,<br>Salas</span></span></div></div>