Skip to main content
Solved

calculate geometry

  • December 30, 2019
  • 2 replies
  • 78 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

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

2 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • 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
  • 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


Reply


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