Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When packaging QGIS to Qfield, Datasources with identical file names (stored in different sub-directories) are silently overwritten #2925

Open
Hannes-Ole opened this issue May 20, 2022 · 2 comments
Labels
QFieldSync It's QFieldSync - close this issue or keep if depending on the QFieldSync issue

Comments

@Hannes-Ole
Copy link

Hannes-Ole commented May 20, 2022

Describe the issue

When packaging a project that contains multiple layers with the datasources that use the same filename (within different directories), these datasets are overwritten in the qfield folder and only the last one file is kept (that is then the basis for all respective layers).
E.g. I have a QGIS project containing
Layer A (data source: ./project_version1/standmap.shp)
Layer B (data source ./project_version2/standmap.shp)

When packaging for QField, all datasources are only copied to a single directory, where standmap.shp (A) is then overwritten by standmap.shp (B). As a result, a map that would usually show two different datasources now only shows one (see screenshot below).
Layer A (data source: ./standmap.shp)
Layer B (data source ./standmap.shp)

In my use case, a lot of identically named datasets are automatically generated in subfolders. Manual renaming is a workaround, but very tedious.

Reproduction steps

Steps to reproduce the behavior:

  1. Create two different datasets with the same filename in subfolders
  2. Add them to a QGIS project
  3. Package for QField
  4. Browse to the resulting qfield folder. You will see only one dataset.

Expected behavior

Ideally, QField handles datasources with the same name by sorting them in subfolders or renaming them (e.g. standmap_1.shp, standmap_2.shp, ...). This is an option a lot of file browsers natively offer (do you want to overwrite or rename?)
At least, the user should see a warning, that datasources with the same file name are present and only one of these files will be present as datasource for the QField project.

Observed behavior

Datasources with the same name are silently overwritten until the last one is kept as the only datasource that all respective layers use.

Screenshots and GIFs

grafik

Desktop

Reproducible on various systems/versions:

  • OS: Windows 7 / 10
  • QGIS Version 3.16.11 / 3.22.5 / 3.24.3
  • QFieldSync Version 3.x / 4.1.1

Additional information

  • Problem started happening recently, didn't happen in an older version of QField: No
  • Problem can be reliably reproduced, doesn't happen randomly: Yes
  • Problem happens with all files and projects, not only some files or projects: Yes
@bduncan175
Copy link

Has there been a resolution or workaround for this? I have data that I can't get from qfield because of this issue.

@Hannes-Ole
Copy link
Author

I don't know of a resolution. My workaround is not using the QField export for projects where I want to keep my folder structure (or where I have datasets with the same name).
Since QGIS projects are fully supported in QField, I now switched to simply copying the complete project folder with .qgz instead of using the QField export feature. Obviously this has the drawback of not making use of choosing a subset of layers/data, but it works for me and it forgoes the abovementioned problem.

In your case, I am unsure why you wouldn't be able to get data from QField? Because it doesn't sync to the right layer? Have you tried doing a manual join / merge?

Hope that helps. Best regards!

@nirvn nirvn added the QFieldSync It's QFieldSync - close this issue or keep if depending on the QFieldSync issue label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QFieldSync It's QFieldSync - close this issue or keep if depending on the QFieldSync issue
Projects
None yet
Development

No branches or pull requests

3 participants