Introduction
Points
Linestrings
Polygons
28. WKT for polygons
Summary

Instruction

Now that you're familliar with the new tables, let's check what our favorite ST_AsText(geometry) function returns for polygons.

ST_Overlaps

A polygon starts with the word POLYGON, followed by a pair of parentheses. Inside the parentheses, the linestrings that form the polygon are listed, each in a separate pair of parentheses. The first linestring defines the outside bounds of the polygon. The linestrings that follow - if any - define "holes" in the polygon.

Exercise

Show the WKT representation of the boundaries of the hotel in sf_hotels with an id equal to 1.

Stuck? Here's a hint!

Use the ST_AsText function on the boundaries column.

Console

Code editor

Result

TableConsole