danzig666 / qconsolidate3

Modified version of the QConsolidate/OQ-Consolidate plugin for QGIS 3+
GNU Affero General Public License v3.0
12 stars 4 forks source link

Different vector layers with same name get saved as single layer #7

Open simbamangu opened 5 years ago

simbamangu commented 5 years ago

I consolidated a project that had a set of layers with the same name ('point locations' inside layer groups - these were filtered to show different points based on a query). On opening the consolidated file, all of those point layers had the same set of features except for the ones which had a different name. They point to the same geopackage layer, but the filter is removed and only the original filtered features are present.

ninnghazad commented 4 years ago

Raster files with same names also show this problem. Duplicate names should be a number appended or something like that instead of overwriting each other.

acarneAC commented 4 years ago

This project unfortunately does not seem to be maintained anymore. I was having similar issues as you, simbamangu - I had a project with many layers referencing one csv file with underlying point data, and different filters. The plugin as currently written would a) force conversion to shp files, and b) create one for each filtered layer.

I've forked the plugin and update it to add a new mode which preserves source data file types, and correctly links multiple layers with the same source to the copied source file: https://github.com/acarneAC/qconsolidate3

Note that the original behaviour is currently still maintained if you do use a conversion to SHP/GDB.

eanema commented 6 months ago

I have been having the same problem with this plugin and fixed it in a different way. I have not inspected the code from @acarneAC but it seems his problem was slightly different than just having layers with the same name overwrite previously written files.

I have forked this repo and fixed this issue by checking if the file name exists and if it does adding a _2 or _3 etc as needed. (I have also fixed a few other issues that are mentioned in the issues section)

There are not many code changes, but they can be see here: https://github.com/danzig666/qconsolidate3/compare/master...eanema:qconsolidate3:master

The forked repo is here: https://github.com/eanema/qconsolidate3