opengisch / QField

A simplified touch optimized interface for QGIS
http://www.qfield.org
GNU General Public License v2.0
836 stars 227 forks source link

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

Open Hannes-Ole opened 2 years ago

Hannes-Ole commented 2 years ago

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:

Additional information

bduncan175 commented 1 year ago

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 commented 1 year ago

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!