Because there could be multiple trips, and you need attributes from the top level and also from each point, it's an awkward series of json transformers.
JSONFragmenter by jsonn"data"]]"trips"]
Then JSONExtractor to extract the route and device with jsonn"route"] and jsonn"device_id"]. Perhaps remove the original json attribute at this point if it's going to be too large.
Then fragment that route into point parts with jsonn"features"]
Then JSONExtractor the attributes for each point jsonn"geometry"]]"coordinates"]]0] and jsonn"geometry"]]"coordinates"]]1] and jsonn"properties"]]"timestamp"]. If you don't need the time you can ignore that.
Then VertexCreator, and lastly a LineBuilder, grouping by the device_id
Hi @mzondervan ,
Alternatively, you can read every Feature object as GeoJSON features directly with JSONFragmenter, since the "route" object is a GeoJSON document.
- JSON Query: jsonn"data"]]"trips"]
- ]"route"]
- Fragment as Format: GEOJSON
Hi @mzondervan ,
Alternatively, you can read every Feature object as GeoJSON features directly with JSONFragmenter, since the "route" object is a GeoJSON document.
- JSON Query: jsonn"data"]]"trips"]
- ]"route"]
- Fragment as Format: GEOJSON
Aha, fragment as format GeoJSON. I didn't know that was an option, thanks!
Hi @mzondervan ,
Alternatively, you can read every Feature object as GeoJSON features directly with JSONFragmenter, since the "route" object is a GeoJSON document.
- JSON Query: jsonn"data"]]"trips"]
- ]"route"]
- Fragment as Format: GEOJSON
Thank you @takashi, this works perfectly.