Skip to main content

I'm using the HTTPCaller to read in an MDS data feed that I would like to convert to an AGOL line feature by connecting the points together from the "route" attribute. I'm able to extract the attributes for each trip in the dataset using the JSON Fragmenter and JSON Extractor, but I'm getting stuck on creating the geometry. How can I take each point coordinate from a trip and connect them into a line and keep the trip attributes associated with it? Example of the JSON format is attached.

 

imageBecause 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

    jsonfragmenter-parameters


    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

    jsonfragmenter-parameters

    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

    jsonfragmenter-parameters

    Thank you @takashi, this works perfectly.


    Reply