Convert a WKT Polygon string to Geometry

I am busy doing an IoT device locating project and need to create and display a map that shows the reception coverage of specific high sites.

I have a flow that creates the device location points which I can convert to geometry with the “Create point from 2D Geometry” and can create the map included below.

I want to display a polygon and it was easy enough to create a properly formatted WKT polygon string "POLYGON ((x y, x y, …))" but cannot find a node or flow of nodes to convert this to a geometry that can be displayed with a “View geometries as Map” node. When is write the polygon string and display it in QGIS the output looks like this…

I would like to be able to produce output like this in KNIME instead of having to move between applications.

An extract of the flow with the data for this example is attached.

Points_2_Polygon.knwf (30.5 KB)

Any suggestions would be appreciated.

tC/.

Hi tC,

I’m afraid you exported the workflow with an absolute path to a csv file, but no csv file.
I’d suggest creating a data folder within your workflow folder (in windows explorer) and putting the csv file there. Then you can configure the CSV Reader as in the screenshot below.

image

This also ensures that the file is present when you export the workflow.

Could you share an updated workflow with us?

Kind regards
Marvin

1 Like

Hi @marvin.kickuth,

Thanks for the advice… I have not used the relative path before. The updated workflow is attached.

Points_2_Polygon_B.knwf (66.9 KB)

tC/.

2 Likes

Hi @TigerCole,

your Polygon string is just fine, but the Coordinate Reference System was missing. This is a table property:
image

… which you can inject with the “Inject Column Properties” Node, as in the attached workflow:

The result should look like this:

Hope this helps!
Lukas

5 Likes

Hi @LukasS

Solved … thank you so much.

I also missed naming the geometry string column I created with the “Column Combiner” to “the_geom” so that the “Inject Column Properties” node would work properly.

Thanks again.

tC/.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.