Spatial analyses between 2 geofence

159
1
04-01-2024 01:18 AM
Moi_Nccncc
New Contributor III

Here is my scenario: 

I have AVLS events that are streamed and based on these events, a dynamic geofence is created. Then, I want to perform a spatial analysis to determine how many points (geofences) generated from these AVLS events fall within another polygon (geofence) using GeoTagger.

So the analyses is between geofences 

 

Tags (1)
0 Kudos
1 Reply
RJSunderman
Esri Regular Contributor

@Moi_Nccncc --

You cannot use GeoTagger (or any of the configurable processors really) to perform a spatial operation between two geofences. The geometry processors all take an event record and use the event record's geometry as an argument to a spatial condition. The processor uses specified geofences as a second argument when evaluating the spatial condition.

You can do what I think you want to do, however. You already stipulate that point features from previous AVL locations are registered as geofences. What you want to do is configure an input to either query to retrieve  (e.g. Poll an ArcGIS Server for Features) event records whose polygon you want to use to count intersecting points -- or arrange to receive via HTTP/POST (e.g. Receive JSON on a REST Endpoint) the polygon you want to use.

GeoTagger is able to take an event record's polygon geometry and evaluate an Intersects Any condition to pull the names of intersecting point geofences into the event record being processed. This will give you a comma delimited list of (point) geofence names in an attribute field you specify (e.g. geo_tags) whose location intersects the event record's polygon.

geo_tags:    "Newkirk,Tecolotito,Logan,Pastura,Conchas Dam,Fort Sumner,Melrose"

You then configure a Field Calculator with an expression to replace any substring between two comma with an empty string. You are essentially removing all of the geofence names from the comma delimited list and leaving only the commas. You can do this with a replaceAll( ) function call which supports Regular Expression pattern matching.

replaceAll(geo_tags, '[^,]*', '')

The regular expression pattern in the replaceAll( ) expression above matches "any single character which is not a comma" (e.g. [^,] ) zero or more times (e.g. [^,]* ) and replaces each matching substring with an empty string.

Now you simply count the commas, remembering to add one for the final geofence name in the list. The result of this expression gets written into an attribute field whose type is a Long integer.

length(replaceAll(geo_tags, '[^,]*', '')) + 1

When mocking up a solution to check syntax, I used a Receive JSON on a REST Endpoint input to model receiving a new AVL point location, ran that event record through a Create Buffer processor to create a 100km geodesic polygon, then used a GeoTagger to get the names of the point geofences which intersect the received AVL point location's buffered AOI. Strip the geofence names from the comma delimited list and count the commas.

RJSunderman_0-1714691721763.png

-- RJ

0 Kudos