Are VRT layers supported in QFieldCloud projects with shared_datasets?

Hello,

I am working with a QGIS project synchronized through QFieldCloud and
distributed to multiple users using the “share datasets” functionality.

I am considering using VRT layers (Virtual Raster or Virtual Vector Layers)
inside the project, but:

Are VRT layers officially supported in QFieldCloud projects, especially
using the share_datesets functionality?

If a VRT references multiple source datasets, do all referenced files need
to be explicitly shared?

If VRT layers are not supported or not recommended in this architecture, I
would appreciate clarification on the intended design constraints and
possible alternatives.

Thank you!

Hi Elena

I am also trying to set up vrt in combination of shared datasets. For my case i have a .vrt file with about 160 cog.tif files referenced (extracts of orthophotos distributed over a wide area). Only having to add one .vrt layer is a big advantage over adding 160 individual layers.

Did you find a way how it works for you?

For my project:

  • i was able to add a vrt to the project (from localized path)
  • i uploaded the .vrt and the referenced cog.tif (orthophoto) files to the shared_dataset project (via cli)
  • vrt was recognized by qfieldCloud as shared dataset

On Qfield the vrt layer is in the layer table, but the orthophoto doesn’t show. Instead only a black rectangle with text ‘1’ is shown.

I think qfieldCloud is not aware that it also has to copy all the cog.tif files referenced in the .vrt file to the client devices basemap directory while provisioning the project.

As .vrt is an officially supported file format it should actually be working.

I am happy to hear from your experience and findings.

Best regards
Samuel

Hi Samuel,

Thanks for your email!

I eventually solved my original problem by using a different approach: I converted my VRT mosaics into standalone COG files and uploaded them to shared_datasets. This works well in our operational QField projects.

One important detail: if you’re sharing your project with other users, make sure they also have access to the shared_datasets project (at least as Readers). Sharing the main project alone is not sufficient.

After receiving your message, I decided to investigate the VRT issue again and ran several tests.

I created a VRT referencing nine COG files, uploaded all the files to shared_datasets, and added the VRT as a layer in a separate QGIS project.

Here is what I found:

  • The VRT works correctly in QGIS Desktop when all nine COGs are available locally.

  • QFieldCloud correctly recognizes the VRT as a shared dataset.

  • A COG added directly as a layer in the QGIS project is correctly downloaded and displayed in QField, on both Android and iOS.

  • However, the VRT mosaic is not displayed.

  • I also tried placing all the COGs in the same directory as the VRT, using relative paths, but this did not solve the problem.

During some of my tests, QFieldCloud also reported an invalid_dataprovider error when trying to open the VRT during project packaging.

My findings therefore seem consistent with your hypothesis: QFieldCloud appears to recognize the files explicitly referenced by the QGIS project, but not the additional COG files referenced internally by the VRT. As a result, those files may not be downloaded to the device.

I also looked into how QFieldSync handles shared datasets. In the QGIS project file, shared raster layers are referenced using the localized: prefix, but this mechanism does not appear to extend to the internal references within a VRT. I couldn’t find a way to make QFieldCloud recognize those dependencies automatically.

So, unfortunately, I haven’t found a working solution using VRTs either.

For now, my workaround is to use standalone COG mosaics instead. This avoids the dependency issue and works reliably with shared_datasets.

If you find a solution, I’d be very interested to hear about it!

Best regards,

Elena

Hi Samuel,

Just a small update following a couple of additional tests.

I noticed that, although QFieldSync showed “Directly access data source” for my VRT layer, the corresponding QFieldSync/cloud_action property was missing from the QGIS project XML.

I manually added:

<Option name="QFieldSync/cloud_action" value="no_action" type="QString"/>

After synchronizing again, QField no longer reported errors when loading the VRT layer. However, the referenced COGs were still not displayed. I’m not entirely sure whether this improvement was caused by the explicit setting, but it might be worth checking in your project.

I also tried using localized: directly inside the VRT’s SourceFilename elements. This didn’t work: GDAL could not resolve those references in QGIS Desktop, and it didn’t improve the result in QField.

So unfortunately, neither test solved the missing COG dependencies.

Best regards,

Elena