Streaming OpenSKY JSON problem

1395
2
02-13-2018 01:16 PM
deleted-user-0NXDqYAmJ8kX
New Contributor II

Hello,

I have tried to get a stream service configured from the https://opensky-network.org/api/states/all 

There seem to be a problem with this JSON format because it does not create proper geoevent definition.

It does not recognize the "states" object as an Array of objects.

I have tried to manually add the "states" object into the geoevent definition using a Group and string object with Cardinality set to Many.

I would then use the array index (states[5],states[6],states[7]) to Calculate geometry, and states[0] for the TrackID etc using processor.

The JSON return is as follows:

{"time":1518552809,"states":[["ac96b8","AAL2423 ","United States",1518552809,1518552809,-93.4581,44.9529,1150.62,false,116.59,94.3,0,null,1143,"2236",false,0],["aa56db","UAL1711 ","United States",1518552808,1518552809,-80.8667,41.8291,11277.6,false,291.48,97.3,0,null,11376.66,"1031",false,0],["aa56da","UAL2796 ","United States",1518552809,1518552809,-76.0575,39.2978,8229.6,false,266.64,42.03,0.65,null,8435.34,"0753",false,0],["a0cfbd","AAL1852 ","United States",1518552807,1518552807,-67.3843,19.9709,9144,false,218.45,321.21,0,null,9593.58,"2330",false,0],["7c6b2d","JST745  ","Australia",null,1518552775,null,null,null,true,0.19,180,null,null,null,"3662",false,0],["a77eae","N582PU  ","United States",1518552809,1518552809,-86.9988,40.4198,228.6,false,39.31,83.99,-1.3,null,342.9,"1200",false,0]]}

Thanks in advance for any insights.

0 Kudos
2 Replies
deleted-user-0NXDqYAmJ8kX
New Contributor II

Bump! ‌

No takers?

Derek Law Michelle MathiasGeoEvent

0 Kudos
RJSunderman
Esri Regular Contributor

Hey Juliano -

I think the problem is that the JSON being returned by OpenSky organizes the "states" not as an array, but as an array of arrays. The nested arrays are not named elements, so GeoEvent Server is unable to create a GeoEvent Definition for the data's structure.

When you suggest that you want to access the data as states[5], I don't think you are indexing to the value you intend to access. Consider the following illustration:

JSON Sample

The reference states[5] does not access the value -111.4485 ... it references the entire array of values at the sixth position within "states" (zero-base indexing). When I queried the https://opensky-network.org/api/states/all endpoint just now, I got 5534 arrays organized within the states[ ] array.

JSON allows a variable number of unnamed arrays to be nested within an array ... but unless every internal array has a name, GeoEvent Server won't be able to create a GeoEvent Definition. Every event attribute in an event definition must have a name.

Hence the following - while completely valid JSON - cannot be ingested by GeoEvent Server.

{"myLists":[["A","B","C"],["D","E","F"],["G","H","I"]]}

If the data were reorganized to give each interior array a name:

{"myLists":[
    {"set1":["A","B","C"]},
    {"set2":["D","E","F"]},
    {"set3":["G","H","I"]}
  ]
}

... then GeoEvent Server would be able to create a GeoEvent Definition.

GeoEvent Definition

Each interior array would have to be part of a named element, I think, for the JSON to be valid. The GeoEvent Definition above indicates that myLists is an array of several elements. Each named element in myLists contains an array, which is an array of several string values.

The article w3schools.com - JSON Arrays does a good job of explaining this.  You also might take a look at a blog I just posted:  https://community.esri.com/community/gis/enterprise-gis/geoevent/blog/2018/07/25/json-data-structure...

Hope this information helps (sorry that no one replied to you to date)

- RJ