Skip to main content
Solved

Create polygons from a string of coordinates

  • September 30, 2024
  • 6 replies
  • 143 views

ricardoa
Contributor
Forum|alt.badge.img+3

Hi there!

I want to create polygons from an attribute that contains a string of coordinates and other information. 

My problem is that I don't know how to only extract the coordinates from the string and then create the polygons by their ID attribute. 

 

The string in the coordinates attribute looks like this:

“{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[13.707920553133594,60.03475791657763],[13.708950521395312,60.03304306231432],[13.705474378512012,60.03160680337132],[13.702513219759567,60.02997753853561],[13.702255727694139,60.030577803349054],[13.703929426119434,60.03184261136259],[13.706161024019824,60.032571461785544],[13.707920553133594,60.03475791657763]]]}}”

 

ID attribute 1 to 10

 

Regards, 

 

Ricardo :) 

Best answer by nielsgerrits

Thank you @nielsgerrits !!!

Here is the file. 

Workspace sample attached.

 

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.

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+62

You can create a geometry from this using the GeometryReplacer. Set it to Esri JSON. If that does not work you might need to extract the geometry part using the JSONExtractor. If you want me to create a sample workspace, you’ll need to attach complete source file.


ricardoa
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • October 1, 2024

Thank you @nielsgerrits !!!

Here is the file. 


nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • October 1, 2024

Thank you @nielsgerrits !!!

Here is the file. 

Workspace sample attached.

 


ricardoa
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • October 2, 2024

Thank you @nielsgerrits 😃👍🏽😄


thomasmarti
Contributor
Forum|alt.badge.img+9
  • Contributor
  • October 7, 2024

Hi @nielsgerrits 

why did you use the FeatureReader instead of the Excel-Reader? What are the benefits of your solution?

 

Greets 

Tom


nielsgerrits
VIP
Forum|alt.badge.img+62

Hi @nielsgerrits 

why did you use the FeatureReader instead of the Excel-Reader? What are the benefits of your solution?

 

Greets 

Tom

Hej Tom, this is personal preference. When the FeatureReader and FeatureWriter were introduced (in 2016?) I stopped using the classic Readers and Writers. I find them more intuitive to configure. All our teammembers use FME this way.