Introduction
Points
Linestrings
Polygons
30. ST_Area
Summary

Instruction

Great! Another interesting function when working with polygons is ST_Area. It returns the area of a given polygon. We can use it in a very similar way to ST_Perimeter:

SELECT 
  ST_Area(
    ST_Transform(boundaries,26910))
FROM sf_hotels
WHERE id = 1;

One thing you should keep in mind is that with SRID = 26910, the default unit is meters, so the result of the ST_Area is (obviously) presented in square meters.

Exercise

Find the area (in square meters) of the planning district under the name of 'Buena Vista'.

Stuck? Here's a hint!

Use ST_Area combined with ST_Transform. Remember that the SRID should be 26910.

Console

Code editor

Result

TableConsole