Solved

calculate geometry

  • 30 December 2019
  • 2 replies
  • 10 views

Badge

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?

icon

Best answer by markatsafe 4 January 2020, 00:19

View original

2 replies

Userlevel 2
Badge +12

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.

Badge +2

@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