Skip to main content
Solved

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


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?

Best answer by david_r

Have you looked at the CoordinateConcatenator?

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

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

3 replies

david_r
Celebrity
  • Best Answer
  • August 17, 2017

Have you looked at the CoordinateConcatenator?

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


takashi
Evangelist
  • August 17, 2017
david_r wrote:

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.

  • Author
  • August 17, 2017

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.


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