Skip to main content
Question

simple txt to coordinate


Forum|alt.badge.img

Hi,

I have a simple txt with many coordinates like (no header):

554174.746999408, 5598075.08612377, 554175.302999408, 558090.53212377, 554177.963999408, 5598129.63312377, 554182.011999408, 5598160.71912377, 554182.176999408, 5598181.49312377, 554180.422999408, 5598212.50312377, 554172.863999408, 5598249.02912377, 554167.975999407,

I want to validate that geometry. I tried using different readers (txt, csv) and transformers like stringreplacer.

I found this question

https://knowledge.safe.com/questions/39344/use-of-the-geometryreplacer.html

but could not modify my workbench with success.

Any hints on that?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

femo
Contributor
Forum|alt.badge.img+6
  • Contributor
  • January 25, 2018

Hi @nhaz,

assuming that your data is a comma separated list of x and y coordinates (order x, y, x, y ,etc.). I also assume that you would like to have a Point Feature at the end:

Hope this helps


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 25, 2018

easyconnect.fmw

Use stringsearcher on the text with regexp ([\\d.]+),\\s*([\\d.]+), advanced set AllMatch.

Listexplode AllMatch. You have coordinate list now.

Split by "," using a splitter.

Create vertex list{0},list{1}

Sort by _lelement_index. (generated by the exploder)

Pointconnector.


takashi
Celebrity
  • January 26, 2018

Hi @nhaz, if the string is comma-separated coordinates list (x, y, x, y, ...), you can convert it to space-separated coordinates list and then apply the GeometryReplacer.

Try setting these parameters to the GrometryReplacer. Assuming that the attribute "_coordinates" stores the comma-separated coordinates list.

  • Geometry Encoding: GML
  • GML SRS Axis Order: 1,2
  • Geometry Source:
<gml:LineString>
<gml:posList>@ReplaceString(@Value(_coordinates),","," ")</gml:posList>
</gml:LineString>

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings