2

How to create geoemtry from WKT in FME?

We have a csv file in WKT format:

"ID";"GEOM"
"1";"LINESTRING ( 15, 20 16, 20 21, 12)"
"2";"LINESTRING ( 15, 20 16, 20 21, 12)"
"3";"LINESTRING ( 15, 20 16, 20 21, 12, 23, 14)"

I found this article: https://knowledge.safe.com/articles/56486/converting-from-csv-data-2.html

But it shows how to split data into points and create a line.

Is there a simpler way?

1 Answer 1

6

The GeometryReplacer transformer will do this for you.

Set the geometry encoding parameter to: OGC Well Known Text (wkt)

From the documentation:

The OGC variants are useful if interaction with other OGC supporting systems is required. However, some characteristics of geometries may have been lost in these modes; for instance, any path will be flattened into a single linestring. For OGC Well Known Text and OGC Well Known Binary, if measures are specified in the source, they will be saved as the "default" (unnamed) measure on the generated geometry.

When converting from WKT or WKB, if the specified attribute has a blank value, the feature's geometry will be left untouched and a warning will be output. This is important to remember if a GeometryExtractor was used to generate an attribute which was used in this transformer, because that transformer produces an empty value whenever it encounters a feature with no geometry.

It's also important to note the OGC WKT Precision parameter.

If Geometry Encoding is OGC Well Known Text, this parameter can be used to control the precision used when converting numerical strings to floating point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.