PostgreSQL point(lseg) Function

The PostgreSQL point(lseg) function calculates the center point of the specified line segment and returns it.

point(lseg) Syntax

This is the syntax of the PostgreSQL point(lseg) function:

point(lseg) -> point

Parameters

box

Required. A line segment, e.g: lseg '[(1,1),(-1,-1)]'

Return value

The PostgreSQL point(lseg) function returns the center point of the line segment specified by the parameter.

point(lseg) Examples

The following statement shows how to use the PostgreSQL point(lseg) function to return the center point of lseg '[(1,1),(-1,-1)]'.

SELECT point(lseg '[(1,1),(-1,-1)]');
 point
-------
 (0,0)

The following statement shows how to use the PostgreSQL point(lseg) function to return the center point of lseg '[(1,1),(2,2)]'.

SELECT point(lseg '[(1,1),(2,2)]');
   point
-----------
 (1.5,1.5)