Skip to content

Construct a point, line, or polygon

Use the ST_Point(6, 10) function to construct a point. Use the ST_LineFromText('linestring (10 10, 20 20)') function to construct a line. Use the ST_Polygon('polygon ((10 10, 10 20, 20 20, 20 15, 10 10))') function to construct a polygon. The results are displayed in a table.

SQL
|
SELECT
  ST_Point(6, 10) as "Point",
  ST_LineFromText('linestring (10 10 , 20 20 )') as "Line",
  ST_Polygon('polygon ((10 10, 10 20, 20 20, 20 15, 10 10))') as "Polygon"