Question

I would like to transform a GeoJSON link into a line feature


Hello everyone,

 

I'm currently trying to make a path from a GEOJSON "link" which was return from a HTTPCaller. Is there any way to transform the link below into a line feature?

 

Thank you in advance.

 

This, below, is the GeoJSON file in question.

https://docs.google.com/document/d/1-H6F53Z3Mpu9qmOLQwvifWVPuG7xgjtk4aekHyG1nUU/edit?usp=sharing


2 replies

Userlevel 6
Badge +32

This is quite doable.

  • Put a the response in the JSONFragmenter and fragment the steps. JSON Query:
  • Individual segments
json["routes"][*]["legs"][*]["steps"][*]
  • Complete route
json["routes"][*]
  • Flatten Query Results into Attributes and expose the attribute "geometry".
  • Use a GeometryReplacer to generate the geometry from the attribute "geometry".
  • Set the correct CRS, looks like it is WGS84 / EPSG:4326.

 

The hard part is to find the correct JSON Query. The easy way to do this is to safe the JSON repsonse to a file, set the JSONFragmenters Input Source to File and then hit the "..." button to see and select in the structure. 

2021-05-25_14h50_47Then switch back to JSON Attribute and select the response body from the HTTPCaller.

Added a sample workspace template.

Thank you Niels, much appreciated!

Reply