Skip to main content

I have XML file with features I'm trying to read.. that works. Next step is to create a polygon for each feature, I have a string with points that make the polygon. String looks like this:

 

173363.252 587903.412 173363.369 587902.665 173362.055 587900.798 173363.867 587888.745 173364.007 587887.815 173371.744 587888.843 173368.618 587904.7 173363.252 587903.412

 

That's a list of x and y coordinates, now I can't figure out a idea to make polygons from it. Any ideas? Do I have to seperate them, create lines and make a polygon from it? Any help is appreciated.

 

 

Hello, the workflow outline you sketched is indeed the way to do this. I did the following:

imageimageimageThere is probably an easier way to do this, but this works pretty good.

imageHope this helps

 

P.S: RD New spotted 😎 veel plezier!


This is what I would do:

  •  With a StringSearcher, use the regex below to extract the coordinate pairs into a list using the All Matches List Name.
(/\d.]+) \s*(l\d.]+)
  • Using a ListConcatenator, concatenate the list in a single attribute with a comma as the Separator Character between each coordinate pair.
  • Use a GeometryReplacer with OGCWKT encoding with the following Geometry Source to build the geometry.
POLYGON((@Value(_concatenated)))

imageimage


This is what I would do:

  •  With a StringSearcher, use the regex below to extract the coordinate pairs into a list using the All Matches List Name.
(/\d.]+) \s*(l\d.]+)
  • Using a ListConcatenator, concatenate the list in a single attribute with a comma as the Separator Character between each coordinate pair.
  • Use a GeometryReplacer with OGCWKT encoding with the following Geometry Source to build the geometry.
POLYGON((@Value(_concatenated)))

imageimage

:o Very cool!


This is what I would do:

  •  With a StringSearcher, use the regex below to extract the coordinate pairs into a list using the All Matches List Name.
(/\d.]+) \s*(l\d.]+)
  • Using a ListConcatenator, concatenate the list in a single attribute with a comma as the Separator Character between each coordinate pair.
  • Use a GeometryReplacer with OGCWKT encoding with the following Geometry Source to build the geometry.
POLYGON((@Value(_concatenated)))

imageimage

Thanks! Worked like a charm. 


Thank you so much for the solution, those suggestions solved my problem also.


Reply