Skip to main content
Question

hi, i am new to fme desktop I have in a csv lines stored in a column like [[x,y],[x,y],[x,y],[x,y]] and i dont know how to transform into fme line geometry Please help

  • Jul 12, 2022 1:00 PM UTC
  • 4 replies
  • 83 views

hi, i am new to fme desktop I have in a csv lines stored in a column like [[x,y],[x,y],[x,y],[x,y]] and i dont know how to transform into fme line geometry Please help

4 replies

danilo_fme
Celebrity
Forum|alt.badge.img+58
  • Celebrity
  • Jul 12, 2022 2:09 PM UTC

Hi @alain2002​ 

 

The transformer LineBuilder you can create a line.

 

First you need to geospatial your points - VertexCreator.

 

 

Thanks,

Danilo


geomancer
Evangelist
Forum|alt.badge.img+71
  • Evangelist
  • Jul 12, 2022 2:10 PM UTC

One solution is to turn the coordinate list into a WKT string (Well Known Text) using some RegEx in an AttributeManager, and feed the results to a GeometryReplacer.

WKT_RegEx 

LINESTRING (@ReplaceRegEx(@ReplaceRegEx(@Value(CoordList),"(\d+),(\d+)",\1 \2),(\[|\]),""))

WKT polyline representation: LINESTRING (x y, x y, x y,x y)

@ReplaceRegEx(@Value(CoordList),"(\d+),(\d+)",\1 \2): replace a comma standing between two numbers with a space (a number may contain digits and a dot)

@ReplaceRegEx(......,(\[|\]),""): replace any [ or ] with nothing (both [ and ] need to be escaped with a \ because they are special chararters in regular expressions).

You may test regular expressions in the StringReplacer.

 

 

 


dustin
Influencer
Forum|alt.badge.img+36
  • Influencer
  • Jul 12, 2022 2:23 PM UTC

Several ways to accomplish this, but the attached workbench should work. This assumes the column name is 'coordinates', so you may need to tweak some of the transformers.

image


  • Author
  • Jul 13, 2022 7:27 AM UTC

 

Thank you very much for your help. Both solutions are very good. Thank you