[QGIS-Developer] Problems implementing a plugin to work layers offline

Francisco Danubio Salas Rosette franksalas1965 at gmail.com
Thu Mar 26 06:30:33 PDT 2020


Hi,
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. I was
reviewing some documentation and plugin on the subject, but I am unable to
solve a problem I am having.
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. What am I doing wrong?
This is part of my code:

def download_project(self):
    """Download selected project to convert it offline."""
    proj = QgsProject.instance()

    project_name = proj.title()

    layer_ids_to_download = [
        layer_id
        for layer_id, layer in proj.mapLayers().items()

    ]
    offliner = QgsOfflineEditing()
    offliner.convertToOfflineProject('D:\\temp',project_name+'.sqlite',layer_ids_to_download,onlySelected=False,
                                     containerType=QgsOfflineEditing.SpatiaLite)
def sincronizar(self):
    offliner = QgsOfflineEditing()
    offliner.synchronize()


Regards,
Salas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200326/13286230/attachment.html>


More information about the QGIS-Developer mailing list