 Hello everyone, and welcome to today's live webinar on how to set your Mergin Maps forms up like a pro. My name is Hans van der Krust. With my company CrossGIS, I'm an official partner of Mergin Maps. I'm also an associate professor of open science and digital innovation at IoT Delft Institute for Water Education. I'm excited to be here today to share my knowledge with you. Before we begin, I would like to take a moment to thank you all for helping me reach 25,000 subscribers on this YouTube channel at the start of this year. It is an honor to have such a large and engaged audience, and I'm grateful for your support, which motivates me to continue making interesting content. I'm also excited to announce that I have launched my first course at Udemy. It's about point cloud processing and 3D visualization with QGIS. To celebrate these milestones, I have a special present for all of you watching today, so stay tuned until the end of this webinar. Without further ado, let's get started. We have a special guest with us today, Peter Patrick from Lutra Consulting, who will be answering your questions. Hi Peter, please introduce yourself. Hi, I'm Peter, and I'm part of the Lutra Consulting team, software company involved in software development and open source GIS for 15 years now. We are also developers of Mergin Maps, and I was personally responsible for Mergin Maps project for the last two years, and I'm very pleased to be here today with you and answer your questions. Thanks, Peter. Before we get started to dive into the practice, I have a few slides to start with, so let's have a look at those. This webinar will be about setting up Mergin Maps forms like a pro, so hopefully a lot of pro tips for you. For the people who are new to Mergin Maps, Mergin Maps is a great ecosystem for collecting and sharing and publishing data, GIS data, collecting them in the field, using mobile phone, setting it up in QGIS and sharing through a cloud service, and it integrates very neatly with QGIS. You can style your layers, add all the layers you want to use in the field, create mobile forms, and it keeps track of your versions of any changes in your data, and you can connect external GPS receivers, you can collaborate with other users, so it's very useful for teamwork in the field, and it's very easy to use. And today we're going to talk about widgets, and widgets are a nice way to customize the field forms that we use in Mergin Maps, but you can use widgets also in QGIS itself to visualize to users your attribute tables in a nice way. So what you're going to learn today is how to set up widgets in QGIS, with which you can create drop-down menus at date and time and pictures, and also use the more complex ones where we have relations, and you can add multiple entries, and also then how it looks like on your mobile device. So here you have some screenshots, and you see here that you learn how to make those tabs at the top, and you see the effect of using the different widgets. After that we're going to dive into attaching multiple photos to features using the one-to-end relations, and here on the screen you see an example, we have five different features, and each feature has multiple pictures attached to it, which we collected in the field. So that's also what you will learn today. Very helpful is the official documentation of Mergin Maps. It has a very nice documentation about the widgets. I will paste the link in the in the chat, and it has a widget gallery, which gives a nice overview of the possibilities, and it comes with example projects that you can try yourself. So let's get started by looking at the practice. To demonstrate the widgets I have prepared a survey layer, and let's check the attributes that I've put in the layer. Go to the layer properties, information here, you see it has a FID, date in the date time, notes, photo observer, server number, land cover, crop type, water source, irrigation type, cover and fence, and note the different data types that are used here. Now let's go to the attribute form tab to set up the widgets. You can change it here to drag and drop designer to have some more flexibility. I remove the FID, though it was already hidden, and I'm going to reorder here the fields. This determines the order of the field form, and with the plus button I can add a tab. So let's make a tab info and drag it to the top, and under that tab later I will group all the general information, and I create another tab with the plus button called land cover, which contains all the land cover information. Maybe later I need to shuffle things, so I'm not going to group them yet into the tabs, and now I'm going to configure each field with a widget, and let's start with the observation number. At alias you can rename the field name to something more human readable, and the widget type in this case is range, and I keep the subtype as editable, this will result in a widget where I can, with plus and minuses, increase the integer number, and it has to start at minimum of one. It cannot be null, and I want to enforce the not null constraint, and it should also be a unique number, because we want a unique ID for each observation, and I can add any expression to the widget, and here I use the expression that observation number should be larger or equal to one, and I can give a description of this expression, and you will see this also back in the mobile device. For observer I use the alias surveyor, for widget type I keep text edit, which will just be an open edit field. Also that one should not be null, I would like to see the name of the surveyor for each observation, it doesn't have to be unique, but I can use a default value here, and there's a nice variable, margin username, so by default it will use the margin username on your mobile device, and fills this in for the surveyor. Then we go to the date widget, give us alias date and time, and I change here the display format to custom, because I would like to have a different notation. If you click that help button, you will see here a lot of explanation of how to customize the display format of the date. I'll demonstrate it here, so for the year, month and day I want to start with the day number, then in 7 dash I use a slash, if I use mm I see the month number, mm a short month and mm the full month name, but here I just want the number. So this is how I can customize the display format. You can override the field format, but this is only useful if you don't have the date field in the date data type, so in this case we don't need to do that, because my date field is in the date data type, as you can see here also from the icon in the available widgets panel. Also I don't want this to be null and enforce the not null constraint, and to make it easy for the surveyor I use here the now function, which will use the current date and time. I don't check the box apply default value on update, because then every time you make a correction to the observation it will also update the date to now, but I want to keep the original date of the observation. For photo you make sure that the widget type is attachment, storage type select existing file and the path should be a relative path to the project and use the integrated image viewer, and if you keep width and height on auto it will scale with the size of your mobile device or the attribute table in QJS. Next I want a notes field just for open notes to be taken and use a text edit, multi-line, so you can type a bit more than in the normal widget. Then in the land cover I use the alias land cover class, and I want to drop down menu, so for drop down menus you can use value map, and then value will be stored in the attribute table and description is what the user can choose from a drop-down menu. You can also load this from a layer or from a CSV file, now because this is a survey for land cover this should not be null and it should be enforced not to be null. Then for crop type I use the alias crop type, and here I'm going to use also drop down but not a value map, but I'm going to create a value relation. In this way I can link to another non-geographic table and the advantage is that I can extend the crop types always separate from the main survey layer. So let's click okay to close this dialogue and create that layer, go to layer, create layer, new geopackage layer and make sure you save this in the same folder that you're going to synchronize with margin. I call this one crop types, you can change the table name if necessary and it should have no geometry and I just add only one field called crops and add it to the field list. Now I can edit this attribute table and here I can add rows and I'm going to add all the crops and later I can extend this or remove crops and then that's easy because it's separate from the main survey attribute table. So under the widget type I choose the layer crop type, key column FID, value column crops and I want this only when the land cover is crop type. So I'm going to put a constrained expression there, land cover equals crop land. Make sure you type the class exactly as was written under land cover, case sensitive and you can put a description here which will also be made visible in the mobile device if the constraint is not met. Don't check the box to enforce the expression constraint otherwise this need to be always valid. However check the box allow multiple selections if you want to have multiple crop types selected which is useful for intercropping. So for water source I use the alias water source, I want a simple drop down with the value map and there I typed different types of water sources and I need to have an expression constrained that land cover should be crop land. Note that here I made a little mistake with the case of crop land which should be capital, I've corrected that later. So always be careful this is case sensitive. So for irrigation type I use the alias irrigation type again a value map for creating a drop down and here I add the different irrigation types. Remember that the value field will be stored in the attribute table and the description is what is shown to the user so you can vary this and in this case I want an expression for the restriction water source equals and then check how it was exactly called irrigated and add a description that this is only for irrigated parcels. Undercover change the alias to vegetation cover. In this case use a range and it would be nice to have a slider. So instead of editable I'm going to use a slider the dial is not supported. I want a minimum of a 0% and a maximum of 100%. This visual estimation so a step size of 5% would be fine and I use a suffix here percentage which will also be shown on the mobile device and fence is a boolean type and then automatically the widget type is set to checkbox and then true or false will be stored. If you have the data type as string and you use checkbox you can also store any text that you put there under checked state and unchecked state but here we'll just use true and false. And as an alias I use a question is the parcel fenced. So now we can select all the fields and drag them into the tab where we want them. So now we have the info and the land cover tab with the different fields under it. Let's test our form by editing the survey layer and adding a feature. Here we see the two tabs and let's see if the restrictions work. If I choose cropland the others become active. If I choose irrigated I can choose an irrigation type and the slider and the checkbox are there. I would like to add two more features of merging maps that is the ability to scan QR codes. So you just need to create a field QR code with data type string like okay and another nice feature is to add a hyperlink. So I add a field called link and that should also be a string. So go off the editing and click save. I'm going to add a new tab so I call this one links and I select QR code and drag it to links and a link and then I drag both of them to links so they are under the tab. For QR code I don't need to set anything except the alias. So as an alias I say scan the QR code and for link I need to change text edit to multiline html and then I can add a hyperlink in html format under default value. So here I'm creating a hyperlink to the documentation of merging maps where it describes how to add hyperlinks and the text to be linked is called help and this all should be in quotes because it's a string and then there in the preview you see hyperlink help. Now on that help page there's another very nice example that you can link to Google Maps to use it for navigation. So under alias I change the name to navigate and I paste here the example which then says open Google map and it will put your coordinate in Google map so you can use that for further navigation that's very useful. Let's test this. Here there's the links tab and there's scan QR code which doesn't look interesting at the moment but on the mobile device you will see there the QR scanner of your mobile device. The last thing that I want to show is how to set the preview on the mobile device and there we use on the layer properties display and I can choose here to show the observation number and then under the html map tip use hashtag image and there we're going to refer to the photo file name and you need to add here a variable which is the project folder and you see there in the preview where that is use insert to add it there you'll see there in the square brackets the expression being added need another expression for the file name and that is stored in the photo field so under fields and values you find photo just double click okay and then insert this should then point to the path of your picture and show a preview in the mobile device so let's save the project and synchronize with the cloud so we can have a look at our mobile device gives a little warning here because I've started with a sample project which I've heavily modified but that doesn't affect the result. On the mobile device in the emerging maps app download this project and it's just indoor so just for the example of testing the form I'm going to add a point here so at the top you can see the three tabs info land cover and links under info there I can fill in the observation number just using the plus there and it's a unique number surveyors filled in automatically date and time I can take a picture just one here in the office and take some notes then I go to the land cover tab and there it tells me to really fill in this land cover if I choose tree cover I see warnings that I can't fill in all the crop information if I choose cropland I can use here because of the value relation multiple crops which is useful if you have intercropping for example with multiple crops per parcel I choose rain fat I'm warned that I cannot fill in the irrigation type but if I choose irrigation of course I can then choose the irrigation type after collecting the points I synchronize and then back in QGIS I synchronize and check the result in the attribute table and there's the result in the form view and also here you can see the tabs if I go to the table view you can also see what it does with the value relation puts those curly brackets and then with the chosen classes so now you've learned all the tips and tricks of widgets and how to use them in merchant maps I hope that was useful for you before I'm going to look at your questions so feel free to post your questions in the chat I'm going to give Peter first a chance to respond to this demonstration his observations maybe I missed something so there are extra tips and tricks so Peter yeah thank you very much I think it was very illustrative video I have six small notes first note is that really it's good to use template projects or example projects from documentation because it's best best start where everything is set up and tested second tip for me is that if you are adding a new fields in a in a layer it's it can break the the database schema and it can make a conflict file so when you're adding a new fields you should really follow the instruction documentation synchronize all devices then change the schema and then synchronize them back so you don't have a conflict files and what is good if you are creating new layer let's say is adding some some text fields extra text fields that you used as a hidden widget at the beginning and then later during the survey you will find out that you need some extra data in a form you just show the show these fields and add them a new widget so you will not break the database schema you don't need to worry about conflicts third tip is that for the expression it's good to check the documentation for example there is a new variable called merging email that you can use it's not shown in a plugin yet but it's already implemented in a phone so you can use also not just merging username but also merging email that is registered if you found it better for photos i have a few tips it's probably you can also look for advanced functions like renaming of the photos having different names for them also selective sync so the photos are not synchronized to your colleagues phones resizing of the photos to save some some bandwidth and storage and the qr codes were already mentioned which are good for if using qr codes the selective sync and other features will be in the in the next demonstration of this webinar so yes yes so that okay so the the for the features for for example this dial and or others we have a wish list that you can join and vote for features that we will implement next or as it is open source project it's also open to funding if you want to boost some development of particular feature and the the last tip is about the new feature that we implemented a few months ago and its support in a mobile application for other widgets uh these are read only and is html widget and text widget and also spacer widget and these widgets can be used for let's say displaying the the instructions how to feel or what to feel to the surveyors in a field the html widgets also can be used to to if you have photos or pdfs on some extra location you can include the the link to the extra location in a form so the surveyors can click on the link and open let's say pdf in the browser or extra photo and these other widgets are very useful for as i said instructions or links or attachments so those are like my small tips on top of what was said very useful peter and i'm sure that in future sessions or videos we'll also cover those new things let's see if there are some questions here from the viewers there's of course a question if the video will be available after the webinar for sure this will remain on my youtube channel there's here a question which external receivers can be supported can you comment on that on android most of the external receivers are already supported through through bluetooth for ios we support all the receivers that has ios mock location implemented and yeah so so generally most most of the receivers on the market should be supported already we have also a link in the documentation where you can check a particular receiver and also sometimes there are some tricks for some applications that could be downloaded that will show you or from the vendor that are required to to run the the device with merging maps nice if you have a receiver that is not listed and you have heavy then you tested it works let us know and we'll add it to the list for others thank you there's another question from fiasca slav the difference between this and q-field it's it's similar technology both technologies are powered by qgis so it's like qgis running on the phone so you can use your q-field project in merging maps as it is pretty much and and tested out so it's more similar than different but to mention some differences the synchronization service or architecture is completely different our architecture is more mimics the the git technology and also for mobile phone we try to make the application no training so you don't need to even if you have surveyors in a field that are not from gis they should be able to use the application pretty much without any training or with like minimal training so the so you need the power user of gis or qgis only for setting up the project but everything else should be available for anyone who has a very basic knowledge of mobile devices and mobile applications like navigation recover anything like that thank you there's here a question i think some of you can also comment on it do you know if there's a possibility of remembering the last cell you recorded in the form yes this is possible you need to go to the settings and there is a checkbox like allow remember last recorded value and if you activate that setting then in a form you will have a small checkbox next to each field that you can use to remember last entered value for your next entry nice then there's a question here Nelson any plans to support audio video attribute forms attachment editor widgets uh yes i seen i think that there is the item in a wish list so yeah once it's come to the top of the list or we'll implement it as far as i know it's not on a short term plan let's say in the following months but i think it could come in 2024 but partially this html widget or other widgets could be used already now but the full support is not planned short short term let's say next few months it's great it's great to see that you guys follow the wish list so i would like to ask everyone here who has wishes to go to that wish list let's see how software will further improve in 2024 and beyond yeah the wish list is simple like wish list dot merging maps dot com so it's easy to remember there's another question here is it possible to toggle on off legend symbol in a layer with many categories defined uh no this is also not supported yet also i think that there was a wish list item or for it but this is not yet supported it's um yeah not on a short plan not yet supported then there is a question from arthur but that's already a nice bridge to the next item that i'm going to show you i'm going to demonstrate how to take multiple photos and configure widgets in such a way that you can store multiple pictures so i think we should go to that demonstration now okay you probably already know how to configure a widget for storing one picture in emerging maps form you choose widget type attachment storage type select existing file and then make sure that you store the path as a relative path to the project path and set the integrated document fewer to type image and automatically scale the width and the height for configuring merchant maps for using multiple pictures per observation we need to follow a different procedure we're going to create a merchant maps project from scratch for surveying multiple pictures per point i'll start with adding a backdrop from open street map you can simply drag under xyz tiles from the browser panel the open street map layer and i zoom into an area of interest then i create a new layer a geo package layer i create a database called survey and the table name i keep it survey it's a point layer this is where we're going to collect our points and i create some fields here like nodes and this is the most important one for multiple pictures is unique id should also be of the text type let's first style this survey layer i use a dot marker and give the red color now create a second layer which is a non spatial layer it's a geo package i'll save it as photo database because this will contain all the data linked to your pictures i call the table photos and then i use here no geometry as geometry type the table name photos will also be used like that in the form so take care that you give it the name that you want you can also rename the layer later i add a field called photo a field surveyor the date and the most important one here is external underscore pk and then click okay now click right on survey layer and go to the layer properties there under attributes form click on unique id set the widget type to hidden otherwise it will show up in your field form and add here at the default value uu id which adds a unique identifier set f id also to hidden you can give another alias for nodes if needed now we need to configure the one to end relation go to your project properties and there go to the relations tab and click add relation you can keep the id as it is you don't need to give it a name relationship is association and there choose survey with the field unique idea in the left column and the right column use photos and external pk so these are now linked in a relation now click right on photos and go to the layer properties of photos click on external underscore pk and there you see that the widget type is automatically set to relation reference display expression to nodes and the relation is there click on f id to also make it hidden for photo change the widget type to attachment keep it at select existing file store path should be relative to project path and then the integrated document viewer should be set to image with an auto width and height so it scales with the size of your viewer you can give aliases to the other fields here so let's use capitals for photo and for surveyor and for surveyor we can also set a default value which can be your merge in maps name use the variable add merge in underscore username and for date we can use the default value of now the current date and time will be automatically filled in then now we need to do a few settings in the project properties first of all i want to set the view settings to the extent here on the screen and then here under merge in maps you see the parts are grayed out that is because this is not yet a merge in maps project so let's save the project it's still in a local folder i call it photo survey demo and then i click the plus icon of merging maps and i create a new merging maps project from the existing one and they also give it the name photo survey demo which then will be stored under c users i'll click finish and now it will be synchronized with the merging maps cloud which has been done successfully now from now it's a merging maps project and i can go back to project properties and there under the merging maps tab i can do some settings for if i don't have much space on my phone i can enable selective sync which will only synchronize my pictures and not from other users to my phone and i can set the photo quality to medium for example here i can also control the file names that are stored on my phone i could use for example my merging maps username and then add the date with an underscore but i could also use just a simple string and the date and call it survey something else in a single quote for a string and then the date will be added with an underscore click apply or okay and then save and synchronize the project to push these updates and now you're ready to use this application in the field let's have a look at the project on your mobile device i add a point here i can add nodes i call this location scout work plan and then i can add the first picture it uses the photo widget to take a picture there it fills in my username and other information i take the second picture and that's also added let's do a third one and this one is also added now to save this feature i just tap save and now this feature has the three pictures and let's take a final one here at the schiland's house take a picture there from the front take another one now from the side and the last one at the inner court and tap save again to save this whole feature with the three pictures now let's synchronize to the cloud and back in the office we can synchronize to qjs and there we see our pictures added there are the points and now click write on survey and if we open the attribute table we see there the unique id but if i switch to form view it is changed into the features in the first column and then in the main panel i see here the different pictures for each of our observation points so that works nicely if you want to add multiple pictures per observation point i hope that was useful for you all Peter do you have any comment on this video things i missed or tips yeah thanks just two of them one is that what you've seen for photos in the video it's also possible for relations in general without photos if you for example i don't know have a place and going to visit the place a few times per year and want to take some notes about the visits particular visits or some other result photos and so these relations also works generally and then a small tip only that recently we added a feature that you can if you have a photo to tap on a photo and it will show you the photo full full size and you can then zoom in or rotate the photo and on the phone to to see some like details if you need to so this is just a small like user experience tip to in the field if you need to now you can click on the photo so it's very useful i've noticed when i configured the file names in how to store the pictures on a different file name that it didn't take that up you could see that in the video could it be related to the relations or is it something else you think the the real thing with the photo is like should work and it's tested i'm not sure definitely generally maybe there is a some bug with combination with relations i would have to check generally if there is such a bug or something is not working the the best place is probably join our community chat it's emerging apps com slash community slash join and ask there and or possibly to go to github and look for issue tracker and see if such a bug is reported but i don't know top of my mind if there is such such particular bug at the moment with the recent application i would need to check okay we'll further test it and see what's going on there there is a question here from johnson also partly answered by cyber i think can the multipot is labeled differently on the desktop and the labels made visible to the surveyors the label is probably meant the name of the photo on a disk i think um and if this is the case i um i am probably like not not uh yeah because because it's uh it's just the thought the emerging map synchronization works that you can imagine is like one folder on a disk and it's just transferred to your phone as it is and vice versa so the file has the same name but there is an option with the media thing to transfer photo to external location and also it's possible probably through python or some scripting to to rename the photos afterwards as post processing but this this would be interesting to see to like the the use case for for such such feature in general what sabra also answers here is you know you can use any field for for the labels which can also be an expression that you want to use so i think there's a lot of opportunities there to have the labels as you want the template projects that are provided in the documentation are very useful in that sense they also showed how to add the x and y coordinate and the direction and all these extra things related to your pictures also what what was mentioned by peter about using relations for other things there's a really nice example project which makes it really clear is about cars and car types so if you choose a certain car brand then you can only choose from a relational table the types the models from that brand so that gives a lot of insights on how these relations work and how you can configure those any other questions anything to add peter from your side no i thank you very much for inviting me i think it we seen today a lot of interesting tips how to set up different widgets and happy surveying to everyone thanks peter for being here and i promised everybody at the beginning that i would have a surprise for you to celebrate these milestones so i'm going to tell you what it is i want to give everybody who's watching this a limited time to access my new udemy course on point clouds and 3d visualization in qdis for free i'll paste the the link now in the chat so a limited amount of people 100 can use this and only for two days so here's the link and hope you will enjoy that course feel free to give reviews and feedback on that and with that i would like to end this webinar thank you for participating and asking nice questions i hope this was helpful for you and i'll keep you posted for a nice new content so see you all next time bye bye see you bye