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

  • July 12, 2022
  • 4 replies
  • 15 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+51
  • Celebrity
  • 2076 replies
  • July 12, 2022

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+58
  • Evangelist
  • 932 replies
  • July 12, 2022

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+31
  • Influencer
  • 627 replies
  • July 12, 2022

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
  • 6 replies
  • July 13, 2022

 

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