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


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

Userlevel 4
Badge +30

Hi @alain2002​ 

 

The transformer LineBuilder you can create a line.

 

First you need to geospatial your points - VertexCreator.

 

 

Thanks,

Danilo

Userlevel 4
Badge +36

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.

 

 

 

Userlevel 3
Badge +26

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