Question

GeometryReplacer results in linestring WKT geometries becoming points

  • 8 December 2022
  • 5 replies
  • 13 views

Badge

Hello!

 

I am using GeometryReplacer to convert a CSV file with a column containing WKT geometry. The column in question has the name "GEOMETRI, LINJE" and contains a linestring. When using GeometryReplacer, the result is a point with a point that seems to be the centre point of the coordinates of the linestring.

 

As an example, the string LINESTRING (280696.375713613 6653063.17617913, 280698.536236071 6653059.93539544, 280707.427616957 6653067.91270913, 280704.353027305 6653070.5718137, 280696.12642256 6653063.17617913) converts to a point with coordinates 280701.671, 6653065.356, neither of which appears in the original linestring string. The coordinate system used is ETRS89.UTM-33N, which I set using a CoordinateSystemSetter before the GeometryReplacer.

 

All of the LINESTRING () WKT-geometries become points. Does anyone have any insight as to why this happens and what I can do to make sure that GeometryReplacer produces the expected linestring instead of a point?

 

Thanks!


5 replies

Userlevel 3
Badge +26

Edit: Ahh, interesting. When I replaced my test attribute "A" with your "GEOMETRI, LINJE" it failed to produce the line. Can you try removing the comma from your attribute before the GeometryReplacer using an AttributeRenamer?

 

What version of FME are you using? In 2022.2, I'm getting the correct geometry.image

Badge +2

@corrag_oslo​ It does look like GeometryReplacer does not like an attribute with a comma in the name as @dustin​ suggests. Use AttributeRenamer to rename it and GeometryReplacer will give you the results you expect. We'll try and get that fixed in FME.

Badge

Thanks!

 

Seems like that was the problem - should have realised to test that out but I didn't think of it since I had another column with point geometries with a comma in the name that seemed to work as expected.

Now it works, when the attribute name is changed to not include a comma!

Userlevel 4
Badge +25

Thanks!

 

Seems like that was the problem - should have realised to test that out but I didn't think of it since I had another column with point geometries with a comma in the name that seemed to work as expected.

Now it works, when the attribute name is changed to not include a comma!

It differs from format to format of course, but as a general rule I try not to use any kind of special characters in attribute names.

Badge

It differs from format to format of course, but as a general rule I try not to use any kind of special characters in attribute names.

Good practice! But this dataset is from the Norwegian Public Roads Administration, so it's not something I'm able to influence unfortunately.

Reply