Select to view content in your preferred language

Update feature attributes only when not Empty (not NaN)

513
1
06-14-2019 01:46 AM
MarkusBenninghoff
Occasional Contributor

Hello community,

I already have a workaround for my problem, but I'm curious if there is a more elegant way to handle it.

I receive messages on a UDP port as comma comma-separated values (25 fields). These are never complete. Most of the time I receive geometric information only (ID, coordinates, speed). Occasionally I receive additional information for my IDs (ID, name, measurements, destination).

## Geometrics
#ID, Ycoord, Xcoord, speed, ..., time
000123,9.1543,55.7552,235.89,,,,,,,,,,,,,,,,,,,,05/31/2019, 08:38:10
000123,9.1544,55.7553,250.30,,,,,,,,,,,,,,,,,,,,05/31/2019, 08:38:15

## Additional Information
#ID, ... , name, ... measurements ..., destination, time
000123,,,,,,,,,,Vehicle1,74,,,,8,1,6,5,3,0,6.40,Destination2,05/31/2019, 08:38:00
000123,,,,,,,,,,,74,108,12,10,8,1,,,,,,,05/31/2019, 08:38:30 ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

The geometrics are filtered from the rest in GeoEvent Server. The idea is to later enrich it with the additional information.

Normally, I would Update a feature layer with the additional information and use the hosted feature layer to enrich the geometric data. However, as you can see the data contains empty/nan values, which leads to crucial information (Name, Destination) occasionally being unavailable when updating+enriching.

  • How can I update a feature layer while ignoring single empty/nan attributes?

I'm sincerely thankful to any suggestions.

kind regards, Markus

PS:

For now, I'm writing everything to csv, and using a python script to group the data, export it to csv/json,and load it to GeoEvent Server. Which seems to me like a unnecessary loop.

df2 = df2.groupby('ID', as_index=False).last()

The function ignores NaN-values by default.

0 Kudos
1 Reply
EmilSolbakken
New Contributor

Hi,

I have a similar question. When updating a feature in a feature service, I only want the fields that are actually set by the input event to be updated.

GeoEvent, however, seems to assign null values to all fields in the GeoEvent definition that are not set by the input event. Which leads to fields missing in the input event being updated/overwritten with null values on the feature service.

Is there a way to avoid this, i.e. make GeoEvent preserve field values that already exist that is not changed by the input event?

I know the Field Enricher can be used to get values from existing features, but seems like this require a static definition of which fields to grab.

The best option so far seems to be using Add Features as output and then re-process/merge the events somewhere else. But I still hope I am missing something, as this feels like pretty basic functionality.

 

Thanks in advance,

Emil

0 Kudos