Data enrichment with ArcGIS QuickCapture and Integromat

6667
13
06-04-2020 04:42 PM
IsmaelChivite
Esri Notable Contributor
4 13 6,667

The whole idea with ArcGIS QuickCapture is to simplify as much as possible the field data collection experience. Now, simplicity for end users, is not in conflict with being able to generate rich GIS data.  I assume you are already familiar with ArcGIS QuickCapture's device variables. Device variables allow you to automatically calculate a good number of GIS attributes such as direction of travel, fix time, username, speed, horizontal accuracy and many others.  Device variables are a great way to enrich the GIS attributes of field observations made with the QuickCapture mobile app.

 

In this article, we will explore options to enrich your data using Integromat.  Integromat is a workflow automation solution that lets you integrate many applications and services together without writing code. If Integromat is news to you, I recommend you watch the ArcGIS QuickCapture: Automate Workflows with Integromat - YouTube video. You can create an Integromat account at integromat.com for free and then decide if it is worth for you to upgrade to a paid subscription.

 

Integromat is commonly used to automate notifications when data from QuickCapture is captured. For example, say you want an SMS to be sent to a field coordinator when a high priority issue is reported through the QuickCapture mobile app. That is about one of the most common reasons why people use Integromat.  As I said earlier, our intent in this article is to explore data enrichment with Integromat. This is also a very powerful use!   What if you could automatically populate GIS attributes to field observations from QuickCapture? Say you want to calculate the closest address to a record submitted, or store the current weather conditions at the location where an incident is reported...  What if you want to automatically associate a parcel identifier with data submitted from QuickCapture? All of this can be done. Automatically, and without much effort.

 

Example 1: Reverse Geocoding

 

Lets start with a simple example to warm up: A new record is submitted from the QuickCapture mobile app and the closest address to that location is automatically found and stored as a GIS attribute. Something like this:

 

ArcGIS QuickCapture reverse geocode

 

To achieve the above an Integromat scenario can be put together so every time a record is submitted, a call to the Esri World Geocoding service is made. The output from the reverse geocoding service call is used to update the new record with the address. A step by step guide is included in this 12 minute video.  This recording should give you enough information for you to build scenarios like this on your own:

 

Note: At 9:52, the video describes how you need to add curly brackets around the JSON in features. That is necessary, but you ALSO need to enclose the whole thing with square brackets. Do not forget that! Sorry about the omission in the video.

The video references the following links, which will be useful if you plan to do this on your own:

 

 

When using the Esri World Geocoding service, keep in mind you should pass forStorage=true as a parameter in your reverse geocode call if you plan to store the output as an attribute in your feature. Alternatively, you can use a similar technique to use your own locator service from ArcGIS Enterprise.  When using your own locator service, you do not have to worry about ArcGIS Online credit consumption or including the forStorage=true parameter.

 

Custom locator services can also be used to find the closest asset to a location. In this case, you may not be interested in getting an address, but just the identifier of the closest asset to a location. This can be useful, for example, when using QuickCapture to report the condition of an asset. The user taps the button when close enough to the asset and keeps moving; your Integromat scenario will do the rest: associate the condition to the closest asset.

 

Example 2: Point in Polygon query

 

You can also enrich field observations using a point in polygon query. Say for example you have a parcel layer and you want to know in which parcel a particular observation was made. As long as the observation was made inside the parcel, a point in polygon query will do the job for you.

 

The technique to get this done is very similar to what was described in the Reverse Geocoding video.  The HTTP module in Integromat is used to execute the query, and again to update the record.  The query operation is described in the Query (Feature Service/Layer)—ArcGIS REST API: Services Directory | ArcGIS for Developers help topic. However, as a quick reference, here is the bare bones URL pattern you will want to follow:

 

https://<featurelayerURL>/query?geometry=<x>,<y>&geometryType=esriGeometryPoint&inSR=4326&spatialRel...

 

You will note that in the documentation for the query operation, the geometry input is a json object, but you can also pass, for points an x,y value. Not officially documented, but it works!

 

A quick important reminders:

 

  • Always use https
  • Your feature layer URL must specify the layer index too. The end of it will look something like https://...FeatureServer/0/  Where /0/ is the index of your layer in the feature service.
  • It is important to pass the inSR parameter as 4326, to ensure that the query will work regardless of the spatial reference of your target polygon layer.
  • For the outFields parameter, indicate the exact attributes you want to back from your query. Do not be lazy requesting all the attributes as this will increase the network traffic unnecessarily and will complicate your life when authoring the scenario in Integromat.

 

Once you have the values you want from the intersecting polygon, you will use the Integromat http module to update your feature attributes. If you have watched the reverse geocoding video above, this should be no secret to you.

 

Example 3: Weather forecast

 

Using the Integromat Weather app, you can also enrich incoming QuickCapture records with a weather forecast. The Weather app takes an an input the XY coordinates of the location you are interested in and can report a weather forecast for the following day or days.

 

Integromat QuickCapture Weather

 

Example 4: ArcGIS Geoprocessing Services

 

If you are into ArcGIS geoprocessing services, you can also use the HTTP module in Integromat to pass parameters and run your own gp services.   The great thing about gp services is that they provide great flexibility to do more sophisticated analysis on the QuickCapture record location. In the screenshot below, for example, the HTTP module invokes a service that runs a valve isolation trace against a Utility Network dataset. The output, again, is used to enrich a QuickCapture observation.

 

 

When working with Geoprocessing services in this way, it is important to execute the tasks synchronously. The ouptuts from a gp service are processed similarly to how outputs are parsed from the Esri Geocoding service.

 

13 Comments
ChelseaRozek
MVP Regular Contributor

Thanks so much for the explanation video! This is exactly what I needed to get around not yet having JavaScript functions in the web version of  Survey123. 

SaraPluta
Emerging Contributor

This is great!  We are hoping to use this with our field collection and are hoping to utilize the nearest address functionality.  

As I work to implement the steps you demonstrate in the video, I am getting stuck at the second HTTP request in Integromat, to update our feature class.  It is giving us an output error: {"error":{"code":400,"message":"Unable to complete operation.","details":["Parser error: Some parameters could not be recognized."]}}

SaraPluta_0-1631823208731.png

We are not using a hosted feature layer from AGOL, we are using a feature service from our ArcGIS federated server, published through AGOL for use with our Quick Capture application.

Any thoughts on why this error might be thrown or what we might need to do differently to get the reverse geocode to work?  Also, are there any other steps needed when working with a service published through ArcGIS server?

Thanks in advance,

Sara

RosemaryHatch
Regular Contributor

@SaraPluta Were you ever able to find a solution to your error? I'm getting a different error, but am also struggling in the same place with trying to write back to a service published through ArcGIS Server. Thanks!

iHack
by
Occasional Contributor

Hello @IsmaelChivite 

 

In Example 2: Point in Polygon query, the Query operation does not result in a JSON output.  Instead, it is in HTML format.  How do you pass the result from the query to the Update Features operation?  I'm actually trying this with Survey123 instead of QuickCapture.

IsmaelChivite
Esri Notable Contributor

If you get back HTML I suspect it is because you did not specify the f=json parameter. The default output format is HTML. Make sure you add f=json to the URL you send to the ArcGIS REST API.

If you are doing this for Survey123, consider this other approach too: https://community.esri.com/t5/arcgis-survey123-blog/understanding-reverse-geocoding-in-survey123-3-0... 

iHack
by
Occasional Contributor

@IsmaelChivite  great!  That worked.

I'm getting an error in my output for the HTTPS Post update operation:

Data
{"error":{"code":400,"message":"Invalid URL","details":["Invalid URL"]}}
 
The survey share settings for "What can submitters do?" is "Only add new records" for security purposes.  Changing it to "Add and update" didn't make a difference.
IsmaelChivite
Esri Notable Contributor

@iHackI think I know why you are getting the error but it will save me the typing if we do a quick call. Please send an email to ichivite@esri.com so I can get you into a screen sharing session

 

IsmaelChivite
Esri Notable Contributor

Thanks @iHack  for your time on the phone. Sharing here the cause of the problem for others to benefit from it.

In the video, I did not explain correctly what to type in the features parameter. I forgot to enclose the attributes JSON string in between square brackets. The screenshot below shows the correct JSON with the square brackets added. Sorry!

I bet this is what got @RosemaryHatch and @SaraPluta in trouble too. Just follow instructions as shown in the video... but also enclose the whole attributes JSON with square brackets!

IsmaelChivite_0-1666825911701.png

 

 

 

iHack
by
Occasional Contributor

@IsmaelChivite ,

Thank you so much.  This is amazing.  I so appreciate all that you do on behalf of Esri for the GIS community.  Looking forward to participate in the ArcGIS Survey123 Community Gallery!

by Anonymous User
Not applicable

Does anyone know if this functionality is planned to be built into Quick Capture by default? I was also under the impression that Quick Capture was going to be depreciated once integrated with Field Maps - or is this no longer happening? I don't want to build workflow that will become obsolete in a short period of time. 

JohnathanHasthorpe
Esri Regular Contributor

@Anonymous User There are no plans to depricate QuickCapture and 1.16 will be released early in December. To keep QuickCapture simple and focused, it makes sense to keep it as a standalone app.

We are working on support for Arcade expressions in QuickCapture and this may meet your requirements. What is you use case?

 

 

 

by Anonymous User
Not applicable

thank you for the info - I would love to use Arcade Expressions for my workflows! I started creating the Make workflow as outline in Ismael's video and ran into a token error fairly quickly (maybe because it has been disabled by my administrator? or because I didn't create the Quick Capture & Workforce projects?)

I'm new to my organization and we currently have a Quick Capture app that collects road deficiencies as field workers patrol the city. The data collected in Quick Capture appears in various Workforce Projects. One of these projects hasn't been used in 6+ months and therefore has a backlog of locations that need to be assigned to field workers (~1800 records have been created in the last 2 months). In Workforce I have the ability to assign multiple deficiencies to a field worker at one time but would also like the ability to automatically populate the location field (using the nearest civic address) and the priority (based on the road class of the nearest street).  I've added all of the feature services to an ArcGIS Pro project and figured there must be a way to auto-populate this information. I believe this could be achieved with an Attribute Rule that executes when a point is added in Quick Capture (i.e. when a deficiency is identified append the point to the workforce assignments feature class, calculate the nearest address and priority).

SHartholt_0-1669815125328.png

 

 

 

BrandiN
Emerging Contributor

@IsmaelChivite 

Now that Integromat has gone away and is now 'Make' - is the ability to reverse geocode still supported via Make? If yes, is the procedure outlined in the above video the same in Make as it was in Integromat?