PostgreSQL Geometry Functions
PostgreSQL supports many geometries, including: point (point
), box (box
), line segment (lseg
), line (line
), path (path
), polygon (polygon
), and circle (circle
). This page list functions and operators related to geometries in PostgreSQL.
-
area()
The PostgreSQLarea()
function to calculate the area of a specified shape. It works forbox
,path
,circle
. -
bound_box()
The PostgreSQLbound_box()
function returns the bounding box of two specified boxes. -
box(circle)
The PostgreSQLbox(circle)
function computes and returns the inscribed rectangle of a specified circle. -
box(point,point)
The PostgreSQLbox(point,point)
function converts any two points into a box and returns it. -
box(point)
The PostgreSQLbox(point)
function converts any point to an empty rectangle. -
box(polygon)
The PostgreSQLbox(polygon)
function returns the bounding rectangle of the specified polygon. -
center()
The PostgreSQLcenter()
function calculates the center point of the specified shape. It works withbox
andcircle
. -
circle()
The PostgreSQLcircle()
function constructs a circle from the center point and radius. -
circle(box)
The PostgreSQLcircle(box)
function returns the smallest circle that encloses the specified rectangle. -
circle(polygon)
The PostgreSQLcircle(polygon)
function converts the specified polygon to a circle. -
diagonal()
The PostgreSQLdiagonal()
function extracts the diagonal of the specified rectangle and returns it as a line segment. -
diameter()
The PostgreSQLdiameter()
function to extract the diameter of the specified circle. -
height()
The PostgreSQLheight()
function returns the vertical height of the specified rectangle. -
isclosed()
The PostgreSQLisclosed()
function checks whether a given path is closed. -
isopen()
The PostgreSQLisopen()
function checks whether a given path is open. -
length()
The PostgreSQLlength()
function calculates the total length of the specified line segment or path and returns it. -
line()
The PostgreSQLline()
function returns a straight line through two specified points. -
lseg(box)
The PostgreSQLlseg(box)
function extracts the diagonal of the specified rectangle and returns it as a line segment. -
lseg(point,point)
The PostgreSQLlseg(point,point)
function constructs a line segment from two specified points and returns it. -
npoints()
The PostgreSQLnpoints()
function counts the number of points on the specified path or polygon and returns it. -
path(polygon)
The PostgreSQLpath(polygon)
function converts the specified polygon to a closed path with the same list of points. -
pclose()
The PostgreSQLpclose()
function converts the specified path to a closed path. -
point()
The PostgreSQLpoint()
function constructs a point based on the coordinates specified by the parameters. -
point(box)
The PostgreSQLpoint(box)
function calculates the center point of the specified rectangle and returns that. -
point(circle)
The PostgreSQLpoint(circle)
function calculates the center point of the specified circle and returns that. -
point(lseg)
The PostgreSQLpoint(lseg)
function calculates the center point of the specified line segment and returns it. -
point(polygon)
The PostgreSQLpoint(polygon)
function calculates the center point of the specified polygon and returns that. -
polygon(box)
The PostgreSQLpolygon(box)
function converts a rectangle into a polygon represented by four points and returns. -
polygon(circle)
The PostgreSQLpolygon(circle)
function converts a circle to a polygon represented by twelve points and returns. -
polygon(integer, circle)
The PostgreSQLpolygon(integer, circle)
function converts a circle to a polygon represented by a specified number of points and returns it. -
polygon(path)
The PostgreSQLpolygon(path)
function turns a closed path into a polygon with the same number of points and returns. -
popen()
The PostgreSQLpopen()
function converts the specified path to an open path. -
radius()
The PostgreSQLradius()
function to extract the radius of the specified circle. -
slope()
The PostgreSQLslope()
function calculates and returns the slope of a line passing through two specified points. -
width()
The PostgreSQLwidth()
function returns the horizontal width of the specified rectangle.