Solved

How do I create an attribute of all coordinate pairs for the vertices of a polygon?

  • 17 August 2017
  • 3 replies
  • 15 views

I have a polygon feature of almost 700k records with a lot of vertices for each polygon (a lot of coastlines etc) and I need to create a csv with a record for each polygon including a list of coordinate pairs for the vertices of the polygon in the format y1 x1, y2 x2, y3 x3... I was doing this by extracting the coordinates into a list and then creating an attribute of coordinate pairs and aggregating all of those pairs into another attribute by UUID. However, I was only able to do this by generalizing the polygons in order to get this workspace to actually run. If I remove the generalization (preferred), then when the polygons are exploded into lists of vertices the workspace runs out of memory before it can aggregate all back together to get the attribute of coordinate pairs. I think I need to do this without creating a list. I've tried using a geometry extractor instead of the coordinate extractor and creating an XML attribute, but I still cannot figure out how to get the format of y x, y x...that I require into an attribute.

Any suggestions?

icon

Best answer by david_r 17 August 2017, 16:22

View original

3 replies

Userlevel 4

Have you looked at the CoordinateConcatenator?

Set the coordinate delimiter as a comma and the coordinate element delimiter as space.

Userlevel 2
Badge +17

Have you looked at the CoordinateConcatenator?

Set the coordinate delimiter as a comma and the coordinate element delimiter as space.

Agree. In addition, if the order of coordinate elements to be written should be y -> x, try inserting a CoordinateSwapper (Swap Type: X <-> Y) before the CoordinateConcatenator.

 

Furthermore, if you removed the geometry and unnecessary attributes from the feature immediately before exploding the list, your current solution could also work without generalizing the polygon. Have a look at the GeometryRemover and the AttributeRemover.

Thank you both so much! I have never tried the CoordinateConcatenator, but it is perfect. And the CoordinateSwapper will be a much used transformer as well.

Reply