We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Kompa_ • 1 year ago

Just gonna leave this here incase anyone else is having trouble.
I have 0 experience with code and couldn't get your command to work, I kept getting "filename was unexpected at this time" as a response and I iterated with ChatGPT and ended up with this and it worked.

for %A in (folder\with\the\files\to\be\merged\*.gpkg) do ogr2ogr -f gpkg -append your\destination\folder\YourOutputFileName.gpkg "%A"

YourOutputFileName.gpkg is created automatically when you run the command.

Thanks for the initial solution.

Lorenzo • 12 months ago

Hi, I also have no experience with code, could you please help me?
Where did you put the code? In the python console in QGIS or as a SQL query?
I have to merge in QGIS 3 different geopackages in one while keeping the original geopackages editable and displaying any changes in the merged geopackage. Thank you for any kind of help.

Luis Puerto • 12 months ago

The commands are for terminal in macOS… I guess you can build similar commands on Windows terminal or powershell

Monch • 3 years ago

Hi Luis, nice workaround! I'm having the same issue at the moment. Quick question, the destination file will be automatically created after running the script or it needs to be in the destination folder already as a .gpkg?
Cheers!
Thank a lot!

Luis Puerto • 3 years ago

I believe that it will automatically created… but this was long time ago.

Hugues Lorent • 4 years ago

Hi Luis, nice post. Could you please tell me what "filename" stands for in the final command? Thanks,
Hugues

Andreas Scharmüller • 4 years ago

Nice post indeed. "filename" is just a variable. You could replace any other word, e.g. "i" or "myvariable".