WKT (Well-Known Text) is a great way to represent points, lines and polygons. It treats them as points, strings-of-points and strings-of-points-in-a-loop, respectively.
The rules for building WKT representations are simple. Points are longitude first, latitude second. There is a single space between numbers, and a single comma between points. There are parentheses around points and linestrings, and parentheses around each individual polygon as well. The last point in a polygon is the same as the first point. The following three examples of WKT geometry from a well-known location in Copenhagen are illustrated here.
POINT (12.559220 55.702230)
LINESTRING (12.559245 55.702060,12.559479 55.702275,12.559272 55.702346,12.559031 55.702122)
POLYGON ((12.559245 55.702060,12.559479 55.702275,12.559272 55.702346,12.559031 55.702122,12.559245 55.702060))
In my data auditing for Pensoft Publishers, I’ve recently seen what seems to be a fault in software used to generate WKT data for Darwin Core tables. Here’s an example:
decimalLatitude = 43.32552
decimalLongitude = 6.35002
footprintWKT = POINT(6.350019999900324 43)
I don’t know what program was used to build the WKT, but it has rounded or truncated the decimal latitude to a whole number of degrees, which is a serious error. (It may also have expanded the original decimal longitude - see this community forum post - but that isn’t a mistake.)
Please check for this latitude problem if you are using the footprintWKT field in your Darwin Core tables.
Because the WKT format is simple, you might consider building your own WKT from latitude/longitude data. In a spreadsheet, a point WKT is easily built from latitude and longitude entries using a formula. Linestring and polygon WKT can also be built in a spreadsheet, but might be more easily constructed on the command line.
Suppose I have these 5 latitude/longitude points from a marine transect in the North Atlantic Ocean:
Saving the points as the file “transect.txt”, I would use AWK and sed to build the linestring WKT:
For checking WKT representations on a map, I highly recommend Clyde D’Cruz’s OpenStreetMap WKT Playground, which displays my 5-point transect this way:
Robert Mesibov (“datafixer”); email@example.com