[Qgis-user] Changing data source from Postgis to Geopackage

Andreas Neumann a.neumann at carto.net
Mon Nov 5 08:10:17 PST 2018


Hi Alessandro, 

Interesting. Deferred handling of bad layers is kind of related, but not
exactly the same. 

In my case I want to "bulk-change" a lot of layers (60+) from Postgis to
Geopackage. The data itself is already converted and has exactly the
same structure. After the data source change I want the data source to
be permanent in the new project. So it is not just one or two, but a lot
of layers. Some of them have additional filters, some don't. 

Or - even better - allow to switch back and forth between Postgis and
Geopackage from within the same project. 

But https://github.com/qgis/QGIS/pull/8359 is already a very good start.
Would it also handle "bulk" change for all data from the same source? 

Thanks,
Andreas 

On 2018-11-05 16:49, Alessandro Pasotti wrote:

> If you mean change data source functionality, this is now available in https://github.com/qgis/QGIS/pull/8359 
> 
> There is also a new "Change data source..." menu entry in the layer's contextual menu, implemented for rasters and vectors. 
> 
> On Mon, Nov 5, 2018 at 4:46 PM Paolo Cavallini <cavallini at faunalia.it> wrote: 
> 
> This seems a good candidate for an extra function of the browser. Probably a simple Py script or a plugin should do, at least as a prototype. 
> 
> Better add a ticket not to forget? 
> 
> All the best. 
> 
> Il 11/05/2018 03:17 PM, Andreas Neumann ha scritto: 
> 
> Hi, 
> 
> Ok - I am doing it in the text editor. 
> 
> I also had to change 
> 
> <provider encoding="System">postgres</provider> 
> 
> to 
> 
> <provider encoding="System">ogr</provider> 
> 
> After doing this change, it worked. 
> 
> Andreas 
> 
> On 2018-11-05 15:01, Alessandro Pasotti wrote: 
> 
> On Mon, Nov 5, 2018 at 2:54 PM Andreas Neumann <a.neumann at carto.net> wrote: 
> 
> Hi, 
> 
> I have a relatively complex QGIS project with data storage in QGIS and would like to change the data source of all layers to Geopackage. 
> 
> I already have a Geopackage with the exact same data structure like in Postgis (automatic export from Postgis through ogr2ogr). 
> 
> Now I wonder what the best approach is to change all data sources from Postgis to Geopackage? 
> 
> Texteditor and search/replace or is there something more comfortable? 
> 
> Hi Andreas, 
> 
> you could first check if it works correctly with one layer, from the python console vl.changeDataSource('/my/new/path|layername=mylayername', 'layer_name', 'ogr') 
> 
> then exit without saving the project, make a backup and try search replace. 
> 
> -- 
> Alessandro Pasotti
> w3:   www.itopen.it [1]

_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Paolo Cavallini - www.faunalia.eu [2]
QGIS.ORG [3] Chair:
http://planet.qgis.org/planet/user/28/tag/qgis%20board/
 _______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user 

-- 
Alessandro Pasotti
w3:   www.itopen.it [1] 
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user 

 

Links:
------
[1] http://www.itopen.it
[2] http://www.faunalia.eu
[3] http://QGIS.ORG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20181105/6c2a7a3f/attachment.html>


More information about the Qgis-user mailing list