Question

Splitting non paired XY in a single column

  • 24 October 2018
  • 3 replies
  • 3 views

Hi, I've been passed a csv file with Polyline data in a single column where the XY are not paired, just next to each other with the same delimiter used between all the points. I don't know how to separate them and pair them so I can create a shape file of the line. an example of the polyline column is like this...

532792.000#182214.000#532800.155#182168.565

The rows range between two to several points. Any advice on how to achieve this would be greatly appreciated.


3 replies

Badge

Hi @peterpenguin

The AttributeSplitter transformer should achieve this if you read the features into the workspace and use the # key as the splitter - this will give you a list of 4 attributes which you can explode to give the 4 attributes.

Alternatively, you could specify '#' as the delimiter on the 'parameters' dialog of the CSV reader.

Userlevel 1
Badge +21

You could replace your delimiter with a space then wrap the whole thing up inside LINESTRING(....) e.g. LINESTRING(532792.000 182214.000 532800.155 182168.565) which you can then use in a geometry replacer as well known text to rebuild the geometry

Badge +14

Adding to the solutions here the challenge is coming up with a geometry definition that doesn't mean you need to replace odd # with a comma and even # with a space or similar. GeoRSS just has spaces between each coord pair and each pair of coords, so you could try that using StringReplacer > StringConcatenator > GeometryReplacer... see attached example. example.fmw

Reply