WKT Viewer: Draw Well Known Text Geometry

All tools
Report

Heading to the field? Install this site from your browser menu and this tool works with no signal. See how

Converter

Nothing is uploaded. The file is converted on your own device, so it works with no signal.

Drop a file here or

Nothing leaves your device.

No file to hand?

Waiting for a file.

Features in this file

NameTypeFolderVerticesLengthArea

A table of WKT geometry types with an example of each and a bracket nesting depth. POINT and LINESTRING are depth zero with one opening bracket. POLYGON and MULTIPOINT and MULTILINESTRING are depth one, because rings and members are wrapped. MULTIPOLYGON is highlighted at depth two, because it is a list of polygons each of which is a list of rings. A band explains that a MULTIPOLYGON holding one polygon looks almost identical to a POLYGON, so pasting one where the other is expected produces either an error you cannot place or a shape that parses and is wrong.
Counting the opening brackets before the first digit tells you the type without reading the name, and resolves nearly every WKT confusion in one step.

How to use this tool

Paste or drop a file of Well Known Text above. One geometry per line, and an optional label before a semicolon or a tab if you want the shapes named. Lines starting with a hash are treated as comments and skipped, and anything unreadable is skipped rather than stopping the whole file.

Everything readable is drawn on the map and listed with its length or area. This is the quickest way to answer the question you usually have about WKT, which is where on Earth this string actually is.

Where WKT comes from, and why it looks like this

WKT is the text form defined by the OGC Simple Feature Access standard, and in practice it is what comes out of a database. Select a geometry column in PostGIS, SQL Server or Oracle Spatial and you get WKT back. It is also what people paste into bug reports and support tickets, because it is the only geometry format you can send in a chat message.

It is compact and readable, and it carries no coordinate system, no attributes and no styling. Just a type and some numbers.

You will also meet EWKT, an extension that prefixes an SRID, so a string may begin SRID=4326 followed by a semicolon. This tool strips it and reads the geometry. Be aware that SRID 4326 means WGS84 longitude and latitude, and any other value means the numbers are in some other system that this page cannot interpret.

The bracket depth is the whole trick

Every WKT type holds the same two numbers per point. The only thing that changes between them is how deeply the brackets nest, and that is where reading errors come from.

A POINT has no inner brackets at all. A LINESTRING is a flat list of pairs, also with no inner brackets. A POLYGON adds one level, because it is a list of rings and each ring is a list of pairs. A MULTIPOLYGON adds one more, because it is a list of polygons, each of which is a list of rings.

So a MULTIPOLYGON containing a single polygon looks almost exactly like a POLYGON, distinguished only by an extra pair of brackets and the type name. Paste one where the other is expected and you get either an error you cannot place or, worse, something that parses and is subtly wrong.

A worked check you can repeat on paper

Count the opening brackets before the first digit. That single habit resolves nearly every WKT confusion.

  • POINT (30 10) has one opening bracket before the 3. Depth zero.
  • LINESTRING (30 10, 10 30) also has one. Depth zero, it is just a longer list.
  • POLYGON ((30 10, 40 40, 20 40, 30 10)) has two. Depth one, because rings are wrapped.
  • MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20))) has three. Depth two.

Now apply it to the sample on this page. The permit area reads POLYGON followed by two opening brackets, then minus 109.10 and 36.95. Two brackets, so depth one, so it is a single polygon with one ring. The ring has five coordinate pairs and the fifth repeats the first, which is how a ring closes.

Check that closure whenever you are handed a polygon. An unclosed ring is accepted by some readers, silently closed by others, and rejected by a few. The tool above closes it and tells you the vertex count, so if you expected five and see six, somebody closed it twice.

What WKT does not carry

No coordinate system, unless somebody used EWKT and you trust the SRID. No attribute values. No names, unless you added a label yourself before a semicolon, which is a convention rather than part of the standard. No styling of any kind.

That makes WKT excellent for one job and poor for others. It is the right way to move a single geometry between two systems, or to paste a shape into a message. It is the wrong way to hand over a dataset, because everything that made the dataset useful lives outside the geometry.

Mistakes that catch people out

Assuming the numbers are longitude and latitude. WKT states no coordinate system. A pair reading 673513 and 4096742 is metres on some grid, and the string itself cannot tell you which.

Reversing the pair. WKT writes x then y, which for geographic coordinates means longitude then latitude, the same order as GeoJSON and the opposite of how people speak.

Copying a geometry out of a database and losing the SRID. The geometry column knew its coordinate system. The text you pasted does not.

Pasting a very long geometry into a query and hitting a length limit. A detailed boundary can run to hundreds of kilobytes as WKT, and many tools truncate rather than refuse.

Confusing WKT geometry with WKT projection strings. Confusingly, the same three letters name the coordinate system format inside a .prj file, which begins PROJCS or GEOGCS. That is a different thing that happens to share a name.

Related Calculators and Reference

WKT usually arrives from a database and leaves as something a map can hold.