Skip to main content
Solved

calculate geometry

  • December 30, 2019
  • 2 replies
  • 95 views

Forum|alt.badge.img

Hello, I have a polygon geometry in that format:

[[[(6.240171999999999, 50.590275999999996), (6.239148999999999, 50.5886), (6.238637, 50.58772), (6.238766999999999, 50.587680999999996), (6.239457, 50.587494) ]]]

(This is only a short extraction, I have around 10000 points for one polygon)

What is the easiest to build the geometry and display it in the inspector? As I have around 10 000 vertices I don't want to do a split, create a list and vertices. Is there a shorter way?

Best answer by markatsafe

@kat The GeometryReplacer that @erik_jan mentions has any options for different supported geometry encodings. If you know what encoding then the GeometryReplacer might work 'out-of-the-box'. Your data looks like JSON, but not GeoJSON which looks more like:

{"type":"Polygon","coordinates":[[[-123.3,49.3],[-123.3,49.1],[-122.3,49.1],[-122.3,49.3],[-123.3,49.3]]]}

So I think if you replace your () (Parentheses) in your geometry with [] (braces) and then add the wrapper:

{"type":"Polygon","coordinates": ... }

you can use the GeoJSON encoding in the GeometryReplacer.

Also seems to be additional leading and trailing [] which need to be dropped for GeoJSON.

Example workspace (2019.1): geojson.fmw

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

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • December 30, 2019

I would use the GeometryReplacer transformer and the WKT (Well Known Text) format.

You will need to format the geometry attribute to match the WKT (add the POLYGON definition).

It should look like this: POLYGON ((0 0,10 0,10 10,0 10,0 0))

That is POLYGON ((X Y,X Y,X Y,X Y,X Y)), using the comma to separate vertices and a space to separate X and Y).

Hope this helps.


Forum|alt.badge.img+2
  • 1891 replies
  • Best Answer
  • January 3, 2020

@kat The GeometryReplacer that @erik_jan mentions has any options for different supported geometry encodings. If you know what encoding then the GeometryReplacer might work 'out-of-the-box'. Your data looks like JSON, but not GeoJSON which looks more like:

{"type":"Polygon","coordinates":[[[-123.3,49.3],[-123.3,49.1],[-122.3,49.1],[-122.3,49.3],[-123.3,49.3]]]}

So I think if you replace your () (Parentheses) in your geometry with [] (braces) and then add the wrapper:

{"type":"Polygon","coordinates": ... }

you can use the GeoJSON encoding in the GeometryReplacer.

Also seems to be additional leading and trailing [] which need to be dropped for GeoJSON.

Example workspace (2019.1): geojson.fmw