0

I would like to append new layer (created with model builder) to a new/existing geopackage in a batch processing. Tried with 3.36RC and 3.34.4 LTR.

  • Every line is a csv converted to point
  • Every line should have a different layer name (name of the file)
  • Every line should be saved in one geopackage

Processing chain in Model Buidler The value in the output ('final') is empty

Output window Leaving it like that will overwrite the whole file and leave only the data of the second file.

Here is output name that I tried :

- D:/final.gpkg (using the dot menu on the right)
- D:/final.gpkg table="@INPUT" (dot menu + manually added table)
- ogr:dbname='D:/final.gpkg' table="@INPUT" (from the expression)
- 'ogr:dbname='||  'final.gpkg'  || ' table='|| rand(0,1000)
- 'ogr:dbname='||  'final.gpkg'  || ' table='|| 'Survey_' ||  rand(0,100)|| '.shp'

Trying in the drive QGIS is installed in does not change the result.

Sometime I got the following message :

.gpkg table="@INPUT" files are not supported as output for this algorithm.
*Changing the order of algorithms does not help.* 

Or this :

    Erreur OGR : sqlite3_open(final.gpkg) failed: unable to open database file)

It does not have to be in the processing chain but at least in the output window of the bulk processing.

Can you help me (or break it down if the answer already exists) ?

links to research resources


Partial success !

I can export all layer in one geopackage with this :

ogr:dbname='D:\final.gpkg' table="data_"
=> add number after underscore   here ⬆️

Success on auto-naming (kinda)

Here is what I have now (in the field calculator):

'ogr:dbname='
||  'D:/Data.gpkg' 
|| ' table='
|| 'data_' 
||  rand(0,100000)

This works at bringing each files as a layer in one geopackage. I use rand to create a number for the name. I could not figure out a way to have a unique identifier. Maybe filename as a variable ? I have not find how to do that tho.

Because it is multiple files at once, even if I use id the modeler will restart at the beginnning of each files.

0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.