In the November 2023 release, ArcGIS QuickCapture has a new integrated Arcade editor in the web designer. You can build expressions that calculate attributes for data collected with version 1.18 of the QuickCapture mobile app. Using Arcade expressions in QuickCapture projects is applicable to online and offline data collection workflows.
The following steps provide guidance for writing your own expressions in the QuickCapture designer. This example populates a field based on a point-in-polygon query that gets the name of a region in which a point feature was captured.
You can write expressions to return a value for the capture field using Arcade variables ($feature, $layer, and $map) and functions. To refer to layers in a web map using the $map variable, the web map must be saved as the project map. You'll start by creating a map for your project using a layer from ArcGIS Living Atlas of the World.
// Create a feature set using the 'World Countries Generalized' layer in the map
var countries = FeatureSetByName($map, "World Countries Generalized", ["COUNTRY"]);
// Intersect the current location with the countries and
// get the first country
var country = First(Intersects($feature, countries));
// If the current location does intersect a feature,
// return the name of the country. Otherwise, return null
if (!IsEmpty(country)) {
return country["COUNTRY"];
} else {
return null;
}
Note: When your expression references a polygon layer by name, you must include that layer in the web map that’s configured for your QuickCapture project. Ensure that the layer name and field name in your expression matches what’s used in the web map layer. To use this expression for point-in-polygon calculations with your own data, swap the “World Countries Generalized” layer name with the layer name from the map in your project and swap “COUNTRY” with the field name from the layer that you want to return.
12. Click Create. Save the project and download the project to the mobile app. (You can’t test this expression in the designer until the target feature layer has at least one record because it uses the first feature to run the test.)
13. In the mobile app, select the Take a photo button to capture a feature and photo. Once the record is processed and the expression runs, select Send to send the feature. (QuickCapture runs the expression before sending the feature.)
14. To verify the collected data, return to your project in the designer and click the info icon for the Photos target feature layer to open its item page.
15. Click Open in Map Viewer to verify that the new feature’s pop-up shows that the Country field is populated. (You may need to configure the pop-up to turn on the field.)
This example uses geographic regions, however, it would work for any polygon layer, such as land parcels, vegetation types, population count, and so on. For more information about using Arcade in QuickCapture, plus additional example expressions to try, refer to the blog post, Streamline field data collection in QuickCapture using Arcade. Here’s a list of the common use cases included:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.