Introduction
5. Simple types of spatial data
Points
Linestrings
Polygons
Summary

Instruction

As you've already seen, the coordinates column from the sf_sights table contains a long series of characters that are hardly understandable to humans. As you may remember from Part 2 this is an internal format understood by PostGIS. Luckily, we can make it understandable with the ST_AsText function, which allows us to change the format to Well-Known Text:

SELECT
  name,
  ST_AsText(coordinates)
FROM sf_sights;

The result is quite different than before. Now, in each cell of the coordinates column we have one of three words: point, linestring, or polygon, followed by the list of coordinates in parentheses. Each word signifies a different subtype or simple type of the geometry in question. In this part of the course we will focus on explaining the purpose and usage of each of these subtypes.

Exercise

Observe that the sf_sights table has different kinds of geometry objects. For example, Coit Tower is a point, Golden Gate Bridge is a polygon, and Lombard Street is a linestring.

Click the Next exercise button to continue.

Console

Code editor

Result

TableConsole