Select to view content in your preferred language

GeoEventserver Array in GeoEvent Definition

258
2
Jump to solution
01-28-2025 07:34 AM
Nico9
by
Emerging Contributor

What should the structure of the new GeoEvent Definition for the JSON data be to read the subsequent JSON data? There is an array in the data, which I cannot get into the GeoEvent definition.

URL to the data stream

https://www.pegelonline.wsv.de/webservices/rest-api/v2/stations.json?waters=POTSDAMER%20HAVEL,POTSDA...

 

The data is structured as follows:

[
{
"uuid": "5e10e1e7-9115-4bd7-ad57-e2062f516891",
"number": "580412",
"shortname": "POTSDAM",
"longname": "POTSDAM",
"km": 26.63,
"agency": "STANDORT BRANDENBURG",
"longitude": 13.072071020002,
"latitude": 52.3998866995299,
"water": {
"shortname": "PHv",
"longname": "POTSDAMER HAVEL"
},
"timeseries": [
{
"shortname": "W",
"longname": "WASSERSTAND ROHDATEN",
"unit": "cm",
"equidistance": 15,
"currentMeasurement": {
"timestamp": "2025-01-28T15:15:00+01:00",
"value": 102,
"stateMnwMhw": "normal",
"stateNswHsw": "unknown"
},
"gaugeZero": {
"unit": "m. ü. NHN",
"value": 28.434,
"validFrom": "2019-11-01"
}
},
{
"shortname": "WT",
"longname": "WASSERTEMPERATUR ROHDATEN",
"unit": "°C",
"equidistance": 60,
"currentMeasurement": {
"timestamp": "2025-01-28T15:00:00+01:00",
"value": 4
}
},
{
"shortname": "LT",
"longname": "LUFTTEMPERATUR ROHDATEN",
"unit": "°C",
"equidistance": 15,
"currentMeasurement": {
"timestamp": "2025-01-28T15:15:00+01:00",
"value": 7.6
}
}
]
}
]

 

The output from the input processor currently looks like this:

{
"GED_Name": "potsdam_input",
"uuid": "5e10e1e7-9115-4bd7-ad57-e2062f516891",
"number": "580412",
"shortname": "POTSDAM",
"longname": "POTSDAM",
"km": 26.63,
"agency": "STANDORT BRANDENBURG",
"longitude": 13.072071020001967,
"latitude": 52.3998866995299,
"water": "water : PHv,POTSDAMER HAVEL",
"timeseries": "[timeseries : W,WASSERSTAND ROHDATEN,cm,15.0,currentMeasurement : 2025-01-28T15:15:00,102.0,normal,unknown,gaugeZero : m. ü. NHN,28.434,2019-11-01, timeseries : WT,WASSERTEMPERATUR ROHDATEN,°C,60.0,currentMeasurement : 2025-01-28T15:00:00,4.0,null,null,null, timeseries : LT,LUFTTEMPERATUR ROHDATEN,°C,15.0,currentMeasurement : 2025-01-28T15:15:00,7.4,null,null,null]"
}

 

If I feed this into a fieldmapper, I get this output:

{
"GED_Name": "potsdam_output",
"uuid": "5e10e1e7-9115-4bd7-ad57-e2062f516891",
"number": "580412",
"shortname": "POTSDAM",
"longname": "POTSDAM",
"km": 26.63,
"agency": "STANDORT BRANDENBURG",
"longitude": 13.072071020001967,
"latitude": 52.3998866995299,
"water_shortname": "PHv",
"water_longname": "POTSDAMER HAVEL",
"timeseries_shortname": "null",
"timesseries_longname": "null",
"timeseries_unit": "null",
"timeseries_equidistance": "null"
}

I can process the data stream fine up to the array "timeseries", but I can't get the array to work. Can someone help me define the input or output GeoEvent definition for the array?

Thanks
Nico

 

 

0 Kudos
1 Solution

Accepted Solutions
TimoT
by
Frequent Contributor

Hi @Nico9 

Hopefully someone more knowledgeable can chime in as it has been a while since I've used Geoevent Server.

You can use field mapper to flatten the data structure. Use dot notation for nested fields, and index notation for arrays.

Refer to the following resources for more information and examples:

View solution in original post

0 Kudos
2 Replies
TimoT
by
Frequent Contributor

Hi @Nico9 

Hopefully someone more knowledgeable can chime in as it has been a while since I've used Geoevent Server.

You can use field mapper to flatten the data structure. Use dot notation for nested fields, and index notation for arrays.

Refer to the following resources for more information and examples:

0 Kudos
Nico9
by
Emerging Contributor

Hello TimoT,

this a

https://community.esri.com/t5/arcgis-geoevent-server-blog/json-data-structures-working-with-hierarch...

In the Output GeoEvent definition, you can access the contents of the array by specifying the index.

In my case, this works like this, for example:

timeseries[0].unit

Thanks for the help!