Skip to main content
Solved

Extract Polygons from Json file


luisegutierrezc
Contributor
Forum|alt.badge.img+1

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.

View original
Did this help you find an answer to your question?

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • 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+1

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings