Solved

Remove z-coordinates in a linestring

  • 9 May 2023
  • 3 replies
  • 66 views

I have a csv-file containing WKT's, and I want to use GeometryReplacer.

 

However, I want to remove the z-coordinates in the linestring. The linestring is formatted like this:

LINESTRING (252388.4 6630392.1 39.726, 252360.1 6630378.5 38.626, 252350.3 6630372.4 38.626)

What's the fastest way to do this in FME?

 

 

icon

Best answer by geomancer 9 May 2023, 12:03

View original

3 replies

Userlevel 4
Badge +36

First replace the geometry using the GeometryReplacer, and then remove all Z values with the 2DForcer.

Userlevel 4
Badge +36

Just for the fun of it, and just because we can: 

You can also remove the z values from the WKT using a regular expression in a StringReplacer.

Remove_Z_by_regexThe regular expression in Text To Replace is:

\d+\.?\d*(?=[,)])

Note that the regular expression starts with a space!

The regular expression parsed:

  •  \d+\.?\d* Find a space, followed by a number (a number consists of one or more digits, optionally followed by a dot, optionally followed by digits) ...
  • (?=[,)]) ... which is followed by a comma or a right parenthesis

and replace the space and the number with nothing.

Ok, thanks. Ok, thanks. I would like to help you by sharing the https://www.grabmyessay.com/samples/category/sociology website with you where you can find essay samples. I am also using that website whenever I want to write essay assignments.

Reply