Hello, I am desperately trying to use QField’s basemaps directory to share raster files that are common to several projects. It works maybe one time out of a hundred, but most of the time it doesn’t. Does anyone have a clear procedure or tutorial on this topic? Thank you in advance for your help.
Yan
Hello, is there a particular reason you are trying to share rasters that way?
There already is a functionality to share common data for multiple proyects in a qfield compatible way, they are called “shared datasets”. You can check this page on the documentation to learn more. It works not only for rasters, but for vector too.
At the very least, it would be a more clear and standard way of doing what seems to be the same thing. “Basemap” is generally used to only refer to a single, bottom raster layer with a XYZ tile structure/format.
Hello Cuprico.
Yes, indeed, the term basemaps can be confusing. By basemaps, I don’t mean configuring a background map through Project Properties > Base map, but rather placing rasters in QField’s basemaps folder on my phone so they can be shared across several projects. What I’m trying to do is save storage space on my team’s phones and ensure that fairly heavy maps can be available outside GSM coverage areas. The documentation available for QField used to be more explicit about cable transfers and project configuration via QField Sync. It seems to me that in QGIS, in addition to setting the link in Preferences > Options > Data Sources > Localized Data Paths, you also had to process the raster through Project Properties > Cable Export using ‘remove from project’.
Ah! I misinterpreted your initial post, thanks for clarifying. Didn’t paid enough attention, I now see that you said the basemaps folder. It is indeed a weird choice of words, but I digress.
Just did a small test right now, in case the problem might be related with a recent change. What I did was:
-
Created a project as usual in a random folder on my computer. It has a simple Geopackage and a OpenStreetMap layer as background.
-
Configured desktop QGIS to add a Localized Data Path as the page suggest, on my user folder on linux, on
~/gis-common. -
Copied some random geotiff I had directly on the
~/gis-commonfolder. -
Dragged that geotiff on the
~/gis-commonfolder into the QGIS window with my project opened. On theLayerspanel it says that it is located in/home/user/gis-common/file1.tiff -
Went to
Plugins>QfieldSync>Configure Current Project. Then on theCable Packagingtab I’ve set the layers I want to edit asOffline editing, while the OpenStreetMap and raster layer where set asDirectly access as data source. -
Use the
Package for QFieldbutton of the QFieldSync plugin. It warns me that I’m using a shared file:
This created a new folder populated with some files on~/QField/export/test. There are no signs of the geotiff on this new folder. -
I plug the phone to the computer.
-
Copied the “shared file”
file1.tiffonto phone > Android > data > ch.opengis.qfield > files > QField > basemaps. -
Copied the folder
~/QField/export/testinto/Android/data/ch.opengis.qfield/files/QField/basemaps/on my phone.
I then opened the project on my phone and it worked ok, I can see all the layers, including the raster.
Let me know if this is more or less what you are trying to do or if you need something more complex.
Hello,
Thanks @cuprico for your answer. It works well for me.
I have an other question : I want to share my qgis/qfield project between multiples laptops. In your example you put your layer with an absolute path : home/user/gis-common/file1.tiff which is not portable in different laptop.
I tried to put my layer with a relative path ../file1.tiff (and put that path is Localized Data) but that way, qfieldsync does not find this path as Localized Data Pathan try to synchonize the layer in qfieldcloud.
Is there a way to share to solve this problem.
Thanks !
hmm, if you are working with QFieldCloud, you have to make some extra steps! Check the link to the documentation I’ve sent. You need a second project that lives on QFieldCloud (“shared_datasets”), as this will be the folder on which all your clients connected to that QFieldCloud instance will be able to get the shared files.
Hello,
I read the doc on “shared_datasets”, but I don’t think it address the problem I point.
In my case, I don’t want to send my basemaps on qfieldcloud (they are very heavy). I put them directly on the multiple phones I use, and it work well.
My problem concern editing a qfield project on several computer. As I say, I put my folder (/home/user/my_path) in the “Localized datasets” QGIS parameter, and my basemap is localised in this directory. When I try to sync the qfield project in an other computer, the layer are not found (which is normal, there is no directory /homer/user/my_path is this computer !). When I try to put the basemap with a relativ path (eg : ../my_base_maps.mbtiles), QfieldSync does not identify that path as a “Localized datasets” and try to sync the layer on QfieldCloud. And it results that my project don’t work on mobiles !
thanks for your help !
I see… maybe what you want can’t be achieved this way. Keep in mind that the typical idea/workflow for QField is to make “field ready copies” of your project in order to capture data and send those changes right back to a central “desktop” for processing, specially when talking about all the methods for Cable Transfer. On the QFieldCloud workflow, it’s not necessarily like this, but the server can be thought of as this “central desktop”. I don’t think it’s much of a “collaboration” tool for multiple desktop users (although it might look and somewhat work like it because it deals with packaging projects, user accounts and organisations).
For that, maybe you’ll have to consider other more “traditional” ways of sharing datasets. For example, having the data available on a PostGIS database, WMS of WFS server, or even maybe just a shared network drive with the same attachment point on each client computer. Otherwise, what you are describing sounds like something akin to a Git repository, where each user has a local copy of all the code (data in this case) and the ability to push and pull changes from external sources. But there is a reason why Git is usually limited to only text files and small files, it might be too much of an overhead to deal with large files this way.
Ok I see, thanks for the background.
I thougth it was a quite common usage : people do field survey, come back to their desktop and try to visualize what they and others did on the field in QQIS !
The option with the WMS/WFS server will only work if we have network on the field, right ?
I think, I’ll try with a shared network. I’m affraid that it will be very slow …
But if qfieldsync could find a path which is in Localized Data Path even if the layer path is relative, it would be realy great !
Thanks againt for all the work on the project !
yes indeed! It seems like the only thing missing to allow you to work as you wanted is to add the ability for QGIS/QField to read paths relative to the Localized Data Path in addition to being relative to the project file location.
That’s something I’ve seen done in other software, for example in KiCAD (a software for making circuits and PCBs), it is common to have very heavy “libraries” for components (lights, switches, that sort of thing). There you can set something like “environment variables” that point to the root folder for this libraries. For example, you can have a path written as %KiCAD_COMPONENT_LIBRARY%/lights/light1, and then you setup on each PC what the %KiCAD_COMPONENT_LIBRARY% variable means, allowing you to bypass problems like the /homer/user/my_path you’ve mentioned.
Maybe there is a way to replicate this behaviour on QGIS right now, but I don’t know how to do it.
