PostgreSQL path(polygon) Function

The PostgreSQL path(polygon) function converts the specified polygon to a closed path with the same list of points. The closed path returned by this function and the polygon specified in the parameter are the same shape.

path(polygon) Syntax

This is the syntax of the PostgreSQL path(polygon) function:

path(polygon) -> path

Parameters

polygon

Required. A polygon. For example: polygon '((0,0),(1,1),(2,0))'.

Return value

The PostgreSQL path(polygon) function returns a closed path with the same list of points as the polygon specified by the argument.

path(polygon) Examples

The following statement shows how to use the PostgreSQL path(polygon) function to convert a polygon into a closed path.

SELECT path(polygon '((0,1),(2,2),(5,3),(6,0))');
           path
---------------------------
 ((0,1),(2,2),(5,3),(6,0))