The Geocortex Essentials identify operation allows you to draw a geometry on the map, and have the application return a collection of features that intersect that geometry. But the identify operation will only return results from your GIS layers, and many (likely most) of us integrate our GIS with various 3rd party business systems, such as asset management, document management, ERP, and business intelligence.
In this week’s Tech Tip, Drew Millen will show you how to invoke a Geocortex Essentials workflow from an identify operation to return non-GIS results. Perhaps you want to see documents in your document management system displayed on the map, or geo-located tweets for a specific area. Kicking off a workflow from the identify operation will allow you to display these types of results and will help you avoid writing a ton of custom code to do so.
“Hi, I’m Drew Millen, Director of Products at Latitude. In this short Tech Tip video, we’re going to talk about workflows; specifically how you can make Geocortex Essentials workflows run in Geocortex Viewer for HTML5 when you perform an identify operation. Let’s dive in.
I’m going to show you how to use identify workflows, which are Geocortex Essentials workflows that piggyback on top of the identify functionality. In this site, I’ve got the default identify behavior working, so when I perform an identify [operation], I’m going to find cities on top of this map, and I want to run a workflow every time I perform an identify as well.
Let’s look at the configuration file that supplies the configurations for this viewer. There’s a module in here called “identify”, and we want to configure the identify behavior. This [view you’re seeing] is the desktop.json.js file that configures the viewer we were just looking at. Notice that the identify module has a section called “identify providers”. It’s here that we specify which logic will run when an identify is performed by a user: for example, querying a graphics layer, or querying the map itself. And down here, I’ve added a workflow identify provider. I’ve also supplied some configuration to this identify provider, so it’s looking for workflows in my site with the suffix “_identify”. Any workflow I’ve added with this suffix will be run by this workflow identify provider.
With that in place, let’s author our workflow. I’m going to open the Geocortex Essentials Workflow Designer. If you go into the “file” menu and click on “new”, you’ll see that we’ve provided a template for creating identify workflows. This template supplies a basic example to help you get started. If you look at the arguments, an identify workflow is expecting a geometry as an input argument. That geometry comes from the identify the user performs. It’s also expecting a unique identifier just for some bookkeeping. We can just ignore that property.
The other properties are output arguments – things that your workflow must supply. For example, the feature set that’s returned from your query, the display name for that collection of features, and any aliases and formats that you want to use for the features that come back. In this example, we simply query a sample layer from ArcGIS Online that looks at [US] states. The geometry from the identify operation is passed in as a parameter to perform that identify. We set the display name to be “states” and we supply some aliases for the fields that are going to come back, making it readable for the user. And we supply some format strings for features that are going to be displayed in the map tips and results list.
With this workflow developed, we [now need to] attach it to our site so that it can be run every time we perform an identify operation. Let’s look at this app in Geocortex Essentials Manager, and I’ll navigate down to the workflows tab where I want to attach this workflow that we were just looking at. Recall that it must have an “_identify” suffix to be picked up by my workflow identify provider. I’ll give it the name “helloworld_identfiy”. Now it’s looking for the URL or URI of the workflow I just authored. So, I’m going to browse for that, and I’m going to go into the directory that we have for this site. I’ll upload it into a folder I created called “resources”. It’s now stored on my workstation as “helloworld_identfy.xaml”. I’m going to go ahead and upload it to that directory and select it.
Now Geocortex Essentials Manager is smart enough to know that this workflow has parameters, so I’m being prompted to supply them here. Because the geometry and unique identifier are going to be supplied by the identify operation, we don’t need to supply them here.
The workflow is now attached to my site, so I’ll go ahead and save it. Let’s refresh the viewer and see the resulting behavior. I’m going to run an identify again, which will identify the cities, but it should also run my workflow and grab the states. Here we can see the result of my states workflow populating the list of results that I expected.
To view a more sophisticated example, we’ve also done the same thing by integrating a workflow that uses the Twitter API to find tweets within a geographic area. In this case, I’m going to perform an identify at the San Francisco airport and discover all the tweets that have been added in this area in the last hour. This is a more sophisticated example of using an identify workflow in a Geocortex Viewer for HTML5 application. To learn more, please get in touch. Thanks for watching!”
Want to learn more about Geocortex Essentials? Visit our Discovery Center to take it for a spin and explore real-world examples of how Geocortex Essentials helps organizations address common (and not-so-common) business challenges.