Skip to main content
Solved

Extract Polygons from Json file

  • July 18, 2024
  • 2 replies
  • 262 views

luisegutierrezc
Contributor
Forum|alt.badge.img+3

Hi Guys, 

I have recently using FME and would like to know if anyone can help me explain how to extract the polygons from a JSON file. I intend to create a workspace, but it does not extract what I need. Also, I have read a few similar questions about this topic but still do not have a solution. 

The file is the following one:

Also, I have attached my workspace with much of the work :(

 

If there is anyone who can help me much appreciate it.

Best answer by nielsgerrits

What you have is GeoJSON. Steps to parse this:

  • JSONFragmenter to split the featureNodes.
    • json["data"]["featureNodes"][*]
  • JSONExtractor to get the geometry from the featureNodes.
    • json["geometry"]
  • GeometryReplacer to replace the geometry attribute with a geometry

    • GeoJSON

  • CoordinateSystemSetter to assign coordinatesystem.

    • EPSG:4326

The trick to find the correct query in the JSON transformers is to first point to a file with the json, generate the query by selecting what you need and then change the file to the attribute.

 

Attached sample workspace.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • July 18, 2024

What you have is GeoJSON. Steps to parse this:

  • JSONFragmenter to split the featureNodes.
    • json["data"]["featureNodes"][*]
  • JSONExtractor to get the geometry from the featureNodes.
    • json["geometry"]
  • GeometryReplacer to replace the geometry attribute with a geometry

    • GeoJSON

  • CoordinateSystemSetter to assign coordinatesystem.

    • EPSG:4326

The trick to find the correct query in the JSON transformers is to first point to a file with the json, generate the query by selecting what you need and then change the file to the attribute.

 

Attached sample workspace.


luisegutierrezc
Contributor
Forum|alt.badge.img+3

Thank so much @nielsgerrits for your help and explain the process. it was what I was looking for.