Select to view content in your preferred language

Specifying a Event's field when using Union Processor

600
2
08-14-2018 08:44 AM
NathanKoski
Regular Contributor

Hi all,

I am working with a geofence of points, each geofence has a category/name of ORDER_ID/METER_ID.

I am processing incoming events which contain ORDER_IDs which match a geofence. I want to use Union to grab all of the geometeries related to that events ORDER_ID and combine them for further processing.

I am trying to use Regex to grab the ORDER_ID out of the incoming event and use the events ORDER_ID to match to Fences this is my current regex:

${ORDER_ID}/.*

but it does not seem to work.

However if I manually enter an order id into the union processor, say 123456/.* then it behaves as desired.

I am wondering if I am doing something wrong here, or if Unions cannot use fields in their regular expressions? I cannot find anything one way or the other in any of the documentation.

If it is not possible, what might be a way to specify geofences on an event by event basis?

Thanks!

0 Kudos
2 Replies
RJSunderman
Esri Regular Contributor

Hello Nathan,

I have confirmed with our developer who maintains the various processor implementations that what you are trying to do with the Union processor will not work. Currently the ${field_name} construct is only supported as part of a filter expression, or when using the GeoTagger processor.

What we need, but do not have, is a Field Enricher capable of matching multiple feature records given a single primary key (e.g. a one-to-many enrichment). This is an enhancement request that has been in the product backlog for quite a while. There is a separate enhancement request to refactor all of the Geometry Overlay processors (e.g. Buffer, Convex Hull, Symmetric Difference, Union ... etc.) to allow dynamic substitution of event attribute field values.

Thinking through the problem, I could imagine configuring a GeoTagger processor to logically "OR" two mutually exclusive conditions such as:

  • INTERSECTS ${order_id}/.*
  • DISJOINT ${order_id}/.*

... that's a start; now I have a comma separated list of the names of all geofences matching the received event record's order identifier.

I could then use a Field Splitter processor (a custom processor available from our Gallery) to split the comma separated list of geofence names to obtain a series of individual event records. Each event record would have the received ${order_id} and the name of exactly one geofence associated with the ${order_id} of interest. Assuming that the ${meter_id} used as each geofence's name was unique I could then use a Field Enricher to enrich each event record in the series with the geometry of the feature record used to import the named geofence in the first place.

That approach requires quite a lot of processing, though, and probably won't scale if you have a high volume of geofences or if the velocity at which you are receiving event records is more than just a few event records per second. And it still doesn't give you what you were looking for originally -- a single geometry representing a UNION of each point geometry associated with the ${order_id} attribute value originally received.

Might it be an option for you to represent the locations of each ${meter_id} as a multi-point geometry rather than several individual point geometries? If each ${meter_id} were a vertex of a multi-point geometry then the geometry you get back when enriching an event record using ${order_id} to look-up a single multi-point feature would have the coordinates for each ${meter_id}.

Without changing your data model, I don't think you'll be able to do what you want using the current release of GeoEvent Server, unless you develop a custom processor using the GeoEvent Server Java SDK. I would probably recommend looking at developing a custom Python script or Desktop GP Tool rather than trying to force GeoEvent Server to do what you want to do. Unfortunately the only two simple approaches I can think of, using GeoEvent Server, both have open / pending enhancement requests.

- RJ

NathanKoski
Regular Contributor

Hi RJ, 

Thank you so much for following up, and confirming this for me. Yes, the approach we ended up taking with this service was to change the data source itself. The data source for the geofence points was in an oracle SDE, so I created a spatial view which aggregated all the pointed together using GROUP BY and a ST_GEOMETRY function, which will combine points into a multipoint feature on the fly. From there it is possible to then re-host the spatial view as a new map service, and use field enricher to grab the ORDER_ID geometry as a multipoint.

If anyone comes across this and is curious what the Oracle SQL code is,

SELECT ORDER_ID, sde.st_aggr_union (SHAPE) as SHAPE
FROM GeoFence_SP
GROUP BY ORDER_ID

The ability to join multiple rows to a geoevent using field enricher is something that I look forward to one day having, as I believe it would be an even simpler fix for several problems we have with Geoevent!

Thanks again, for your detailed follow-up, and confirming this with your devs.

Nate

0 Kudos