Skip to main content

Hello, 

I have received a GEOJSON file from a data supplier, which I would like to convert into a shapefile. Unfortunately, I am not able to extract the geometries with their corresponding attributes from this file. If I use the standard reader for JSON files, I can look at all attributes in the Inspector, but I have no geometries, only an object (?). If I integrate a ListExploder after the reader, I at least have all the objects that are integrated in the file, but I only ever see the first point of the object.
My question now is how I can extract both the geometries and the corresponding attributes from the file and save them in a ShapeFile or similar?

I attached a small sample.

 

Thanks a lot

It’s not a standard geometry format, so you’ll have to parse it yourself. The json describes “changes” for each “id”, and separately describes the vertices of each id changes. I assume these points together describe a line?

To break up the json into individual features that represent each “id”, first you can use a JsonFragmenter, fragmenting on jsong“changes”]

  • . Expose the id attribute for each changes to remerge on it later.

    Then, to get the geometry, you need to go down the tree to where it is. JsonFragmenter again on jsong“structure”] “points”]

  • . This should result in each feature having the json for each point geometry.

    JsonExtractor on the result for jsonr“geometry”]e“latitude”] and jsong“geometry”][“longitude”]

    VertexCreator to turn each lat/long into a geometry

    PointConnector to join the set of points into lines (grouping by the “id” extracted earlier)

    I might not have the json queries exactly right, but you’ll get the idea.


  • Reply