Skip to main content
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

Hi @alain2002​ 

 

The transformer LineBuilder you can create a line.

 

First you need to geospatial your points - VertexCreator.

 

 

Thanks,

Danilo


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),(\L|\]),""))

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(......,(\t|\]),""): 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.

 

 

 


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


 

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


Reply