Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
March 2014
Page 2 of 29
Import and work with GeoFences to filter events based on spatial constraints.
Work with GeoEvent Processor Manager to define and configure filter properties.
Getting started
If you are starting with this module, a GeoEvent Processor configuration file is included to help you
quickly get started with the exercises in this module. Importing this product configuration will create the
items listed below if items with the same names already exist, importing the product configuration will
update them and overwrite any changes you may have made in a previous module.
March 2014
Page 3 of 29
If you completed Module 2, you will notice the Flights GeoEvent Service in this configuration file has
been simplified to remove field mapping and the feature service output which are not necessary for the
exercises in this module. The server data store assumes ArcGIS for Server is installed on the localhost
and is reachable at http://localhost:6080/arcgis/.
Follow the steps below to import the GeoEvent Processor configuration for Module 3.
1. Open GeoEvent Processor Manager at https://localhost:6143/geoevent/manager/.
2. In GeoEvent Processor Manager, navigate to Site > GeoEvent Processor > Configuration Store.
3. Click Import Configuration and browse to Module3_QuickStart.xml file located in the
\configurations folder included with this tutorial.
4. Select the Module3_QuickStart.xml file and click Import to import the configuration.
Notice the tcp-text-in Input Connector and tcp-text-out output are in a STOPPED state. You may find that
stopping your input, output, and GeoEvent Service components before exporting a GeoEvent Processor
configuration is a good practice. Upon import, a STARTED component has the potential to begin
processing data immediately and could possibly conflict with other started components. You can start
and stop components in GeoEvent Processor Manager.
5. Navigate to Services > Inputs and click
6. Navigate to Services > Outputs and click
The Flights GeoEvent Service should already be running. There is little a GeoEvent Service can do if its
inputs and outputs are not running.
March 2014
Page 4 of 29
Follow the steps below to create and configure a new attribute filter, incorporate the filter into the
Flights GeoEvent Service, publish the reconfigured service, use the GeoEvent Simulator to simulate flight
events, and observe the simulated event data output in a TCP Console application.
7. In GeoEvent Processor Manager, navigate to Services > GeoEvent Services and click the Flights
GeoEvent Service to edit it.
8. Click Show to reveal the menu containing the alignment tools and service components available.
9. Double-click Filter in the menu to add a new filter element. The Filter Properties dialog will open
where you can configure the new filter element.
March 2014
Page 5 of 29
10. Enter Low Altitude as the name of the new filter element.
11. Click the Definition drop-down and select the Flights-TcpTextIn GeoEvent Definition.
Note: The list only contains GeoEvent Definitions currently configured as part of your site.
12. Click the Field drop-down and select the Altitude event field.
Note: The list only contains event fields applicable to the selected GeoEvent Definition.
13. Click the Operator drop-down and select the >= operator.
Note: The list only contains operators applicable to the data type of the selected field.
14. Enter 10000 in the Value property text box.
The properties illustrated above configure a single filter expression. A filter must contain at least one
expression. Multiple expressions can be logically combined within a single filter as you will see shortly.
15. Click
To edit an expression, click the expression once to select it the properties will be available and
you can edit the expression as necessary.
March 2014
Page 6 of 29
Notice the
drop down to the left of the expressions list. When adding multiple
expressions to a filter, you can specify whether each condition needs to be true in order for the
event to pass through the filter (e.g. AND) or whether it is sufficient that any condition be true in
order for the event to pass through the filter (e.g. OR).
19. Launch the TCP Console application which will be used to monitor data sent to a TCP socket from
GeoEvent Processor.
20. Open the GeoEvent Simulator and configure the properties below:
Click Load File and browse to the FeatureFlights.csv file in the \simulations folder included
with this tutorial.
Leave the Time Field # property set to field 1 and click Load.
Check the Set value to Current Time checkbox to simulate real-time data.
March 2014
Page 7 of 29
Refer to the illustration below and the exercise steps in Module 1 for more information on configuring
the GeoEvent Simulator.
In the TCP Console application, you should see a number of new flight events appear.
Notice that only 7, of the possible 9, flight events were sent from GeoEvent Processor. The two events
that were not sent were filtered by the filter you incorporated above that filters out any flights below
the established altitude of 10,000. Filters in GeoEvent Services are exclusive; events which do not meet
the filters criteria are removed from the event stream and are not sent to a designated output.
22. In GeoEvent Processor Manager, navigate to Services > Monitor.
Notice the Flights GeoEvent Service shows an event count of 9 events In and 7 events Out.
March 2014
Page 8 of 29
The event counts beneath Inputs and Outputs confirm that nine events were received by the input, but
only seven events were sent to the output.
Note: You may need to click Reset Statistics and send another batch of nine events from the GeoEvent
Simulator to see this illustrated, especially if you have been using GeoEvent Processor prior to
starting this exercise.
If you open the FeatureFlights.csv file in a text editor, you should be able to identify the two events
whose altitude was less-than 10,000 resulting in the events being filtered or removed from the event
stream by the Low Altitude filter in the Flights GeoEvent Service.
Review the simulation data and confirm that only 61 of the 81 flight events report an altitude greater-orequal to 10,000.
23. In GeoEvent Simulator, click Play
Processor.
24. In the TCP Console application, you should observe the 61 events that met the filters criteria.
25. In GeoEvent Processor Manager, navigate to Services > Monitor.
March 2014
Page 9 of 29
Notice the event counts confirm that 81 events were received by the input, but only 61 events were
sent to the output.
What if the wrong GeoEvent Definition had been selected and the filters criteria specified a
field not included in the event (e.g. AltitudeInFeet >= 10000 rather than Altitude >= 10000)?
What if the event were being interpreted with a different GeoEvent Definition such as one
which named the event field AGL or AboveGroundLevel rather than simply Altitude?
Again, filters in a GeoEvent Service are exclusive. If an event is received which does not have the filters
target field, the event will be discarded. If an event is received which has the target field, but the field value
does not meet the filters criteria, the event will be discarded. If the attributes data type does not make
sense given the filters expression (e.g. Altitude >= SomeStringValue) the behavior is undefined; events may
or may not be filtered depending on the systems ability to convert SomeStringValue to an Integer.
The different drop downs available on the Filter Properties dialog are designed to help you quickly
construct valid queries. When you choose a GeoEvent Definition, only the fields available in that
GeoEvent Definition are displayed in the Fields drop-down. Further information is provided including the
field names, data types, and field tags which can help you in determining appropriate operators and
values.
You may have noticed the Definition drop-down contains an asterisk (*) as an available option, as
illustrated below.
March 2014
Page 10 of 29
A filter applies its criteria to any event received by the filter. If you wanted a filter to apply its criteria to
only one type of event, you would select the $DEFINITION_NAME as the Field and build an expression
like: $DEFINITION_NAME = Flights-TcpTextIn. You would then add the expression to the filters list of
criteria, combining the expression with a logical AND as illustrated below.
Notice, by selecting $DEFINITION_NAME, the Value property changes to a Definition Name property
with an available drop down which lists only the GeoEvent Definitions currently configured as part of
your site.
The following exercise was designed to illustrate the two concepts highlighted above the exclusive
nature of filters and the ability to filter based on GeoEvent Definitions. Follow the steps below to import
a GeoEvent Processor configuration that contains the GeoEvent Service, inputs, outputs and GeoEvent
Definitions which support the following exercise.
1. In GeoEvent Processor Manager, navigate to Site > GeoEvent Processor > Configuration Store.
2. Click Import Configuration and browse to the Module3_AVL_Exercise.xml in the
\configurations folder provided with this tutorial.
This GeoEvent Processor configuration contains the following items:
Two new GeoEvent Definitions (AVL-Model-26T and AVL-Model-9A) used to interpret simulated
Automatic Vehicle Location (AVL) event data.
March 2014
Page 11 of 29
6. Click
to the right of the imported AVLReports-TcpTextIn input to start the new input.
7. Navigate to Services > Outputs. Use the available controls to stop the tcp-text-out
output and start the new AvlReports-TcpTextOut output.
8. Navigate to Site > GeoEvent Processor > GeoEvent Definitions.
Notice the two new GeoEvent Definitions added to the list. These two GeoEvent Definitions are nearly
identical, the only difference being AVL-Model-9A provides the vehicles current mileage, whereas AVLModel-26T does not.
9. In Windows Explorer, browse to the AVLSample.csv simulation file located in the \simulations
folder provided with this tutorial.
10. Open the AVLSample.csv file in a text editor to review its contents.
The scenario suppose you had a data feed that sent event data from vehicles equipped with different
models of an AVL module and you wanted to use a filter to identify which vehicles had exceeded 30,000
miles and use that as an indicator that scheduled maintenance is necessary.
Based on the above information, you know that applying a filter with an expression like Mileage > 30000
is going to filter out all of the events reported by the AVL Model 26T, because that model does not have
a Mileage field so it is not reporting vehicle mileage. In this scenario, you do not want to lose those
events from that particular model, so you will make a few updates to your GeoEvent Service so you can
preserve those events.
11. In GeoEvent Processor Manager, navigate to Services > GeoEvent Services.
12. Click
13. Click to select the Model-9A (Mileage) filter to review the filters properties.
March 2014
Page 12 of 29
14. Click Show to reveal the menu containing the alignment tools and service components.
15. Double-click the Filter element to add a new filter to the canvas.
16. In the Filter Properties dialog, define a new filter expression as illustrated below.
17. Click
Click Load File and browse to the AVLSample.csv simulation file in the \simulations folder
provided with this tutorial.
Check the Set value to Current Time checkbox to simulate real-time data.
March 2014
Page 13 of 29
Refer to the illustration below and the exercise steps in Module 1 for more information on configuring
the GeoEvent Simulator.
22. Click Play to send the 21 events in the AVLSample simulation file.
In the TCP Console application, notice that 16 of the 21 events are sent from GeoEvent Processor. All of
the AVL-Model-26T events were sent, but only the AVL-Model-9A events whose Mileage value was
greater-than-or-equal to 30,000 were sent, as illustrated below.
In GeoEvent Processor Manager, the Monitor page helps you quickly see which components are running
(e.g. STARTED), which are stopped, as well as the number of minutes since the last event was received.
The input and output associated with the Flights GeoEvent Service should not have received any events
for several minutes, while the components used in this exercise has received event very recently.
March 2014
Page 14 of 29
When a GeoEvent Service is designed to send event data to two different filters as you did in this
exercise it is important to note that all events are actually sent to both filters, Model-26T and Model9A (Mileage), but only the events that meet the filters criteria are sent to the one output.
Depending on the complexity of your filtering logic, you might elect to combine separate filters (like the
above) into a single filter containing multiple expressions. The illustration below shows how you could
combine the expression from each filter above into a single filter using the logical OR with the objective
of simplifying the GeoEvent Service.
March 2014
Page 15 of 29
When creating a new tag, you would enter the name for of the new tag, a general description, and
define the data type. The data type is important, as the tag can only be applied to fields within a
GeoEvent Definition which match the tags type.
March 2014
Page 16 of 29
For example, you could create a SPEED tag that would be applicable to fields which include any type of
integer value (short or long).
Once you have a custom tag, you can apply the tag to fields in different GeoEvent Definitions.
Filters can be configured with expressions that use tags rather than specific event field names. For
example, you could configure a filter which discards all events whose field tagged with SPEED was less
than some specified value.
In the illustration below, if an event were received by the filter whose GeoEvent Definition did not have
a field tagged SPEED, that event would be discarded by the filter.
March 2014
Page 17 of 29
March 2014
Page 18 of 29
When using the Import GeoFences dialog to import polygon geometry from a feature service:
The Name property functions much like a TRACK_ID. Each storm in the feature layer being
imported should have a unique name, this allows GeoEvent Processor to update its GeoFences
if/when the features in the feature layer are updated.
The WKID is the Well-Known ID of the WGS 1984 geographic coordinate system. For best
performance, you should choose the WKID of the spatial reference in which the event data is
expressed. All of the data provided with this tutorial uses latitude/longitude, which is why 4326
is the chosen WKID.
You can improve GeoEvent Processor performance by simplifying the GeoFences when they are
imported. The Max Allowable Offset property specifies the maximum physical distance the
simplified polygon can deviate from the original one. Larger values create more generalized
GeoFences and will result in faster spatial comparisons, but they will be less accurate.
March 2014
Page 19 of 29
Note: When choosing the Field, you can choose either GEOMETRY beneath the TAGS category (as shown
above) or shape beneath the FIELDS cateogry. This is another instance in which having the appropriate field
tagged in your GeoEvent Definition can make it easier to quickly configure elements in a GeoEvent Service.
8. Click
March 2014
Page 20 of 29
configured to use the same TCP port and two components cannot utilize the same port at the same
time.
12. In GeoEvent Processor Manager, navigate to Services > Inputs.
13. Click
14. Click
15. Navigate to Services > Outputs and stop the AvlReports-TcpTextOut output and start the tcp-textout output.
Recall that the Monitor page helps you quickly see which service components are running, which have
been stopped, and the number of minutes since the last event was received by a particular component.
16. In GeoEvent Processor Manager, navigate to Services > Monitor.
17. Click Reset Statistics to clear the event counts for each component.
Notice in the illustration below the AVL related inputs and output have been stopped and the tcp-text-in
input and tcp-text-out output that are part of the Flights GeoEvent Service have been started.
March 2014
Page 21 of 29
them to the TCP Console application, you will need to update the web map you worked with as part of
the Making Features Come Alive exercise in Module 2.
If you do not have the Flights web map or the Update a Feature output, take some time to work through
the Making Features Come Alive exercise in Module 2 before proceeding with the steps below.
18. Sign in to your ArcGIS Online account and click MY CONTENT.
19. Click the Flights web map to access the item details.
20. Click OPEN and choose Open in ArcGIS.com map viewer.
21. Click Add and choose Add Layer from Web and enter the URL of your published Storms feature
layer.
Obtain the feature service URL from the ArcGIS REST Services Directory:
Copy the browsers URL and paste it in the URL property on the Add Layer from Web dialog (e.g.
http://localhost:6080/arcgis/rest/services/IntroToGEP/Storms/FeatureServer/0).
Compare your web map against the illustration below. Notice the Storms layer is beneath the Flights
layer in the Contents view.
Note: The locations of individual flights may differ depending on what point you stopped simulating
flight events.
March 2014
Page 22 of 29
For this exercise, you will configure the web map to refresh the layer content periodically. The web
map will not update as frequently as it could if you used the Operations Dashboard for ArcGIS, since
the minimum refresh interval for a web map is 0.1 minutes (or every 6 seconds), but for these
purposes this will be sufficient and it demonstrates another way you can visualize data.
22. Click
23. Choose Refresh Interval and set the layer to refresh every 0.1 minutes as illustrated below.
The steps above were optional and not required in order to proceed to the next section below. You only
needed to complete the Making Flights Come Alive section found in Module 2 if you want to add an
March 2014
Page 23 of 29
output that updates a web maps feature layer to display the location of a flight regardless of whether or
not it is INSIDE a storm boundary.
Click Load File and browse to the FeatureFlights.csv file in the \simulations folder included
with this tutorial.
Leave the Time Field # property set to field 1 and click Load.
Check the Set value to Current Time checkbox to simulate real-time data.
Refer to the illustration below and the exercises in Module 1 for more information on configuring the
GeoEvent Simulator.
In the illustration above, notice the count of events Sent is 0 and the slider has been reset to the
beginning of the simulation file such that SWA2706 will be the first flight event sent.
March 2014
Page 24 of 29
From the Monitor page, the tcp-text-in input should have received 9 events In. The event count for the
tcp-text-out output should not have registered any events. In the TCP Console application, you should
not have received any flight events because, in the first batch of flight events, there are no flight events
INSIDE the Rocky Mountain storm.
Notice the event count for the Flights GeoEvent Service will only register events Out if at least one
output participating in the GeoEvent Service has sent event(s). If you elected not to incorporate the
fs-out output in the Update your Flights web map (optional) section above, all nine events in this first
batch would be filtered by the filter named Inside Storm no events would be delivered to the
tcp-text-out output, so the GeoEvent Service event count would remain at 0.
5. In the GeoEvent Simulator, click Step
If you are watching your Flights web map, give the map at least six (6) seconds to refresh and display the
event data. Notice the green dot, representing Flight SWA1586, is approaching the identified storm
area. The TCP Console application should not have received any flight data yet because no flights have
been reported INSIDE the storm area.
6. Click Step
March 2014
Page 25 of 29
From the Monitor page, the tcp-text-in input should now indicate that 45 events have been received. And
it the TCP Console application, Flight SWA1586 entered the storm and you should have received an event.
As you continue stepping through the data in the GeoEvent Simulator, notice that an event is posted to
the TCP Console every time a flight event is received. Also, observe that the spatial filter allows an event,
whose location is INSIDE one of its referenced GeoFences, to pass through the filter to the tcp-text-out
output.
Module 5 of this tutorial will introduce the Incident Detector Processor which can generate alerts based
on an opening condition. This would allow you to be notified with just a single alert upon a flight
entering a storm, instead of receiving many alerts while the flight is inside the storm. The Notifications
in GeoEvent Processor tutorial explains how to create outputs to send email and SMS message alerts
rather than simply displaying the events in a TCP Console application.
March 2014
Page 26 of 29
GeoEvent Processor to create GeoFences, and filters were then used to evaluate spatial conditions on
those features.
Oftentimes, feature services are dynamic and it would not be practical to manually import new
GeoFences every time you wanted to use an updated set of polygons from a feature layer. This section
will discuss how GeoEvent Processor can be configured to automatically synchronize its GeoFences with
the geometry provided by a feature service.
You may have noticed, when importing GeoFences, that the GeoFences page (Site > GeoEvent Processor
> GeoFences) had two buttons one to manually import GeoFences and one to setup automatic
synchronization of GeoFences with an identified feature layer. Clicking Synchronize GeoFences opens the
property dialog used to configure active synchronization of GeoFences.
In the illustration above, the value StormHazards was entered manually by typing the property value.
The Category Field is also has a drop-down, allowing fields containing Strings to be selected and used to
name the category into which imported GeoFences should be placed.
Name Field is a drop-down allowing fields containing either String or Integer values to be selected and
used as the attribute field from which a unique identifier can be retrieved. Every GeoFence imported
into GeoEvent Processor must have a unique name in the illustration the field StormName provides a
unique name for each storm imported as a GeoFence.
Active Field is a drop-down allowing fields containing either true or false values to specify whether a
particular GeoFence is active or should be disregarded because it is inactive. The (Always Active) default
was used in this example because the Storms feature service does not have a suitable field to use for
dynamically activating and deactivating GeoFences as GeoEvent Processor conducts GeoFence
synchronization.
March 2014
Page 27 of 29
Refresh Interval is important for overall system performance. You should specify a time interval which
reflects how often the feature layer is realistically updated. Entering too short an interval will result in
GeoEvent Processor frequently polling the feature service unnecessarily, which will impact performance.
Entering too long an interval may result in spatial conditions being evaluated against areas of interest
which have become stale.
The WKID properties default value 4326 is the well-known identifier of the WGS 1984 geographic
coordinate system. For best performance you should specify the WKID of the spatial reference used by
GeoEvents you expect to receive. All of the simulated data for these exercises express global positions
using latitude and longitude, which is why the default WKID 4326 is used.
You can improve GeoEvent Processor performance by simplifying GeoFences when they are imported.
Max Allowable Offset specifies the maximum physical distance that the simplified polygon can deviate
from the original one. Larger values result in more general GeoFences being used, which are faster for
spatial comparisons, but less accurate. The value is left blank for these exercises.
The GeoEvent Processor Manager lists its GeoFence Synchronizations on the GeoFences page.
This page must be refreshed before changes to a known set of GeoFences will be listed, since
synchronization occurs in the background.
If you are interested in experimenting with GeoFence synchronization, refer to the steps below to add a
new polygon to the Storms feature service and configure GeoEvent Processor to synchronize its known
GeoFences with the updated feature service.
1. Delete any GeoFences you have manually imported into GeoEvent Processor. GeoFence
synchronization will not overwrite existing GeoFences that have been manually imported.
2. Use the Synchronize GeoFences dialog illustrated above to configure the GeoFence synchronization.
The illustration uses the Storms feature service as the source of the polygon geometries for
GeoFences.
3. Navigate to the REST endpoint for the Storms feature layer.
http://localhost:6080/arcgis/rest/services/IntroToGEP/Storms/FeatureServer/0/addFeatures
4. Browse to and open the polygon.txt file in the \data\WorkingWithFilters folder included
with this tutorial.
5. Copy and paste all of the JSON block text from the polygon.txt file into the Features property field
on the REST endpoint.
6. Set the Format to JSON.
March 2014
Page 28 of 29
Congratulations!
By completing the exercises in this module you have learned how to configure and incorporate filters
into GeoEvent Services that you design and publish using GeoEvent Processor Manager.
Events received by an input contain information and an input relies on a GeoEvent Definition to
interpret this information and construct a GeoEvent, which a GeoEvent Service can then process. When
designing filters, it is important to understand the role of GeoEvent Definitions. Since GeoEvent
Definitions specify the data types used to represent event data, they control which operators are
applicable when developing the expressions included in a filter.
Through exercises in this module you also learned how to create filters which use attribute as well as
spatial expressions to filter event data. You learned how to import GeoFences necessary when filtering
events based on their location and how to design filters that use event information such as a GeoEvent
Definition name or a GeoEvent tag that has been applied to a field in a GeoEvent Definition. You also
learned how expressions can be logically combined within a single filter using AND / OR operations.
In Module 4, you will configure and incorporate processors into GeoEvent Services. You will be
introduced to the different types of processors and will incorporate the different processors into a
simple GeoEvent Service. Combining what you learned about event filtering with what you will learn
about event processing, you should be able to quickly begin designing and publishing sophisticated
GeoEvent Services.
March 2014
Page 29 of 29