Creating and editing geometry items using Well Known Text
Well Known Text (WKT) is an OGC regulated format for expressing a geometry. It is a quick and easy way to create and manipulate features using text strings.
Here we show you how to extract a WKT string from an existing item or create items in Cadcorp SIS Desktop 9.1 by copying and pasting.
WKT strings are also used in the SIS API, most notably for the creation of new features using the CreateItem Method, see SIS 9.0 Programming.
2D or 3D geometry items can be created by pasting a WKT string into an overlay in the Map Window.
There are two methods of doing this:
- Method 1 - Paste a WKT string as a representation of geometry into an overlay in the Map Window.
- Method 2 - Copy a WKT string defining a graphic item. Edit this string if required and then paste the string into the same or another overlay.
The examples shown specify a Polygon item but the same principle applies to other graphic items; LineString items, Point items and MultiPolygons.
Method 1
Create a WKT string in a text editor.
This is a typical string for a Polygon item:
POLYGON ((459188.712189556 430187.339828062,352378.36736197
430187.339828062,352378.36736197 330497.684655649,459188.712189556
330497.684655649,459188.712189556 430187.339828062))
Copy this string from the editor and paste it into the overlay in the Map Window:
The Polygon (and its position as defined in the WKT string) will be shown in the overlay.
Method 2
This is similar to Method 1 but the WKT string defining an existing item is copied from the Properties of dialog (it is pasted into a text editor only if editing is required).
When the WKT String has been modified it can be pasted back into the existing or another overlay. To do this, create the Expression WKT() property in the overlay.
- Click Overlays > Schema > Column.
- Select Add Expression to open the Expression Builder.
- From the Built-in Functions, select the Spatial category and double-click on the WKT value.
- Click OK.
- Now select the item (Polygon, LineString, etc) in the Map Window and display the Properties of dialog:
- Right click on the text string in the Value column for the Expression property and click Copy:
- The text is now in the clipboard and can be pasted into a text editor to be edited or pasted directly into another overlay.
This image shows the possible effect of copying the WKT describing a Polygon, editing the string and pasting it back into the same overlay without deleting the original Polygon: