Question

JSON with GeoJSON, two polygons, cant extract them nor the attributes that belongs to them

  • 28 September 2021
  • 2 replies
  • 18 views

I have a test environment so the data included in this workspace is just test data. I get the data via a http-caller. If I save "_result_body" with a JSON Writer and use feature reader to read in the saved json file I can get the polygons with no problem. But this wont work for me, I need to be able to directly interpret the response I get from the http-caller.

 

I been hacking away for two days now and I just wont work. So its best to ask for help, and also some general tips on how I should interpret the response body. I read some tutorials about JSON and GeoJSON but those examples are not near as complex as this one is.

 

I included a workspace where I created the response-body as an attribute if someone wants to push me in the right direction it would be nice.

 

And another question. The data should appear in Sweden. But looking at the individual cordinates it looks odd, and the response from the http caller didnt include any info about the coordinate system. Maybe I didnt fill in the http-caller correctly or something. Is this normal that the coordinate system isnt included?

 

/Edit: I tried all tutorials that safe have about JSON https://community.safe.com/s/article/tutorial-getting-started-with-json. They are good, but doesnt work with my JSON code.

 

 

Thanks in advance.

 

 


2 replies

Userlevel 4
Badge +30

Hi @essb​ 

 

I updated your Workspace with some transformers to create the geometry polygons:

 

Workspace_Json 

Geometry in FME Data Inspector:

 

GemetryI believe that the coordinates are in meters. How is the UTM from Sweden?

 

Attached the new version of Workspace.

 

Thanks in Advance,

Danilo

Hi @essb​ 

 

I updated your Workspace with some transformers to create the geometry polygons:

 

Workspace_Json 

Geometry in FME Data Inspector:

 

GemetryI believe that the coordinates are in meters. How is the UTM from Sweden?

 

Attached the new version of Workspace.

 

Thanks in Advance,

Danilo

Thanks alot!

 

I see that you exposed "array{}.Geometry". I only tried with Geometry.

 

I think I understand, to be able to fragment correctly in "JSONFragmenter2" with the query "json["features"][*]["geometry"]" you first need to explode the two arrays like you do in "ListExploder".

 

But I dont understand why the "escaped" characters dissappear ( {\\"type\\":\\"FeatureCollection\\",\\" ) , in JSONFormatter8 after ListExploder they are gone ( "type" : "FeatureCollection" "features" : [{"type" : "Feature", "geometry" : { ). Why is that, what is happening that removes them?

 

But all in all, working with JSON is complicated, I need to find some good indepth tutorials.

 

Edit: We use EPSG:3006 and its defined on the same way as UTM Zone 33

 

 

Reply