IMPOSSIBLE UPLOAD IMAGES TO SERVER FROM QFIELD BY WEBDAV #5092
Replies: 4 comments
-
Any news on this topic? Looking exactly for this kind of solution hence relatively stored photos cannot be synced due to Android limitations for reading /data storage. |
Beta Was this translation helpful? Give feedback.
-
Hi, We could imlement a feature in QField to achieve your goal. We are currently looking for funding support. Please get in touch with us at [email protected] if you're interested. :) Thank you and best regards, |
Beta Was this translation helpful? Give feedback.
-
Howdy, I had run into the same issue and came up with a solution that I believe is the most flexible. TLDR; Upload of images from QField (with Internet) can easily be done using file manager tools that support WebDAV. I'm using Owlfiles since I find it to be the easiest to use. Here is my scenario and solution: I'm a private landowner using QGIS to manage my forest and other land management tasks. Single user, but I believe my solution would work for anyone, including larger teams. I'm using QGIS on my FreeBSD workstation. Data is stored in a PostGIS DB and images are stored in a DCIM subdirectory under the project folder. QField on a tablet has a straight copy of the project directory for online access only. QField on my mobile phone has both, a straight copy of the project dir for online access, and an exported QField offline version for when I'm out in the woods. My project layers are configured with multiple tabs: Main data, meta data (GNSS stuff, virtual fields with length/area info, etc), a DCIM tab for the image using the "common" QField method with the form using an attachment in the DCIM directory, and a WebDAV tab with the form configured using the attachment with WebDAV storage. The WebDAV server is configured with a URL that uses the DCIM directory of the project. (In my case, Nginx with WebDAV plugin running in a FreeeBSD jail on my workstation with a null-mount to the QGIS project in my home dir, and permissions properly set so that Nginx can save/access files etc). The layer tables have two fields (ImageFile and ImageURL), one with the file name for DCIM directory, and one with the WebDAV URL. There are triggers on the tables that will keep both fields "in sync". Meaning, if a new entry is made and a DCIM upload populates the ImageFile column (during QField import), the ImageURL entry gets automatically populated. Likewise, if an upload is made via WebDAV, the function called by the trigger will populate the ImageFile column accordingly. Same applies to changes to either column, or removal (blank/NULL) of either column. So the layers will be able to reference the same image file (DCIM dir is the same as WebDAV dir) since both (ImageFile and ImageURL) are kept in sync. On the workstation using QGIS, images can be added either via the DCIM tab or the WebDAV tab. Since both mechanisms use the same directory, the image is immediately available in the "other" tab. (For multi-user sites, the image directory can of course be a network drive, with WebDAV being configured for the same share/mountpoint). On the tablet (QField with Internet access), images are available in the DCIM tab if they were previously copied, or always and immediately in the WebDAV tab since it pulls from the "central" image repository through he network. (BTW: All tables also have triggers that cause QGIS to reload a given layer on change to the data table, so "things will just pop up"). On the mobile phone, the "online" version is the same as the tablet. The offline version of course only has data, including images, from the last QField package export. Most of the time in the field, I'm offline. Adding new images is done via the DCIM tab, in essence adding images of the DCIM directory. Once back in the office, an import back to the workstation will copy these to DCIM directory, and images are immediately available, even to the tablet via WebDAV. Should the need arise, the online version on the phone (provided Internet is available) can be used to make an new entry to a layer, with a photo being captured using the DCIM tab and native camera. Then simply open that image, select "Share", select Owlfiles (other whatever WebDAV supporting file manager you prefer), select the configured WebDAV server entry, and the image gets uploaded from the mobile to the workstation. It is now immediately available not just in QGIS on the workstation, but also on other "remotes" such as my tablet. On those yet-to-be-synced remotes with Internet/network access, the image is immediately available in the WebDAV tab. (Of course, not in the DCIM tab since the image is not present on the remote yet). Likewise, should someone in the field need an image, the "office" can simply add it to the image directory (using either the DCIM tab or the WebDAV tab), and any remote with Internet access can access it via the WebDAV tab. (Again, not the DCIM tab since it wasn't copied onto the device during mobile prep yet). Mobiles without Internet access (using QField offline mode) can of course not immediately add data and images to the project until back in the office and an import is performed, at which time the added item and its image are available to any online user since the image is copied to the "shared" DCIM folder. If images need to be updated on existing layer items, an offline user could capture an image in the field using the DCIM method in the QField offline project, open and copy that image to the Documents or Download directory, then travel to an area with Internet access, and a) use QField online to update information on an existing item in a layer, if required, and b) use Owlfiles to upload the updated image via WebDAV. This all works fine for me and my purposes, but of course does not do away with the normal QField Import process after returning from the field, or doing a QField Export to prep the mobile before heading out into the field. However, since the WebDAV server and DCIM directory are the same, there are no cases were images could be lost or would require additional copy processes. The QField Import/Export will handle keeping images up-to-date for all use cases, and after Import, images are immediately available to any other online user. Sharing an image from the field, with Internet access and QField online, using Owfiles does not require much effort. The image is captured with the DCIM tab (local copy of the image). Then it's only a couple taps on the screen to share it via WebDAV. It allows connected/online remotes to share layer data and images in real-time, while still allowing offline users to capture and contribute data using QField offline. The only other way to make it even more convenient would be using QField Cloud or such, which may or may not work for you depending on the project size and complexity, amount of users, etc. As a bonus, I'm also running the QGIS server component as I'm planning to share my data with my consulting forester via WMTS/WCS/WFS. He will even have access to the images via WebDAV URL, and can even contribute images via WebDAV. Those would again be immediately available on QGIS workstation and QField online users, as well as QField offline after export. Hopefully above was not too confusing. Again, using DCIM directory and WebDAV simultaneously (with trigger function keeping those two columns synced), with both mechanisms using the same image directory, works out the best for me. Your mileage may wary, but you're welcome to give it a try. I can highly recommend Owlfiles for WebDAV upload on mobiles in the field. Being able to capture an image (via native camera in DCIM tab), then sharing it (by opening that captured image in QField, then selecting Share from your image app, selecting Owfiles, and selecting the WebDAV repository) is not as difficult as it may first sound. Give it a try. Regards, PS: Here is my PostGIS trigger function to keep ImageFile and ImageURL table columns synced. I'm not a professional SQL developer, so perhaps this may look awkward to the pros, but it works for me: drop function if exists qgis_fill_image_path() cascade; create function qgis_fill_image_path() returns trigger language plpgsql To deploy: drop trigger if exists qgis_fill_image_path on public.table; create trigger qgis_fill_image_path before insert or update on public.table for each row execute procedure public.qgis_fill_image_path(); |
Beta Was this translation helpful? Give feedback.
-
wow... that's a huge reply - gonna check this out and send you an
answer. Thank you so very much!
|
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I am working on a project in QGIS 3.28.8 and PostgreSQL 16 on a Windows Server 2022 for managing trees, linear elements, and areas in a city in Spain. This is important due to the current data protection legislation in Spain.
The majority of the project involves management (assigning work teams to different tasks) using QGIS 3.32.8 and task control using QFIELD 3.2.0 on an Android 13 tablet.
Everything is working perfectly. When I modify alphanumeric and geometry data in some of the tables in QGIS, the changes appear in QField, and when I modify in QField, the changes appear in QGIS immediately.
To store photographs, we have configured a WebDAV service on the server. And it works almost perfectly. When I upload a photo using QGIS, it uploads perfectly to the server and I can view them from the tablet (Android).
The problem is that I cannot upload photos to the server from QField. I have tried many things, but none of them work.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions