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.

  1. area()

    The PostgreSQL area() function to calculate the area of ​​a specified shape. It works for box, path, circle.
  2. bound_box()

    The PostgreSQL bound_box() function returns the bounding box of two specified boxes.
  3. box(circle)

    The PostgreSQL box(circle) function computes and returns the inscribed rectangle of a specified circle.
  4. box(point,point)

    The PostgreSQL box(point,point) function converts any two points into a box and returns it.
  5. box(point)

    The PostgreSQL box(point) function converts any point to an empty rectangle.
  6. box(polygon)

    The PostgreSQL box(polygon) function returns the bounding rectangle of the specified polygon.
  7. center()

    The PostgreSQL center() function calculates the center point of the specified shape. It works with box and circle.
  8. circle()

    The PostgreSQL circle() function constructs a circle from the center point and radius.
  9. circle(box)

    The PostgreSQL circle(box) function returns the smallest circle that encloses the specified rectangle.
  10. circle(polygon)

    The PostgreSQL circle(polygon) function converts the specified polygon to a circle.
  11. diagonal()

    The PostgreSQL diagonal() function extracts the diagonal of the specified rectangle and returns it as a line segment.
  12. diameter()

    The PostgreSQL diameter() function to extract the diameter of the specified circle.
  13. height()

    The PostgreSQL height() function returns the vertical height of the specified rectangle.
  14. isclosed()

    The PostgreSQL isclosed() function checks whether a given path is closed.
  15. isopen()

    The PostgreSQL isopen() function checks whether a given path is open.
  16. length()

    The PostgreSQL length() function calculates the total length of the specified line segment or path and returns it.
  17. line()

    The PostgreSQL line() function returns a straight line through two specified points.
  18. lseg(box)

    The PostgreSQL lseg(box) function extracts the diagonal of the specified rectangle and returns it as a line segment.
  19. lseg(point,point)

    The PostgreSQL lseg(point,point) function constructs a line segment from two specified points and returns it.
  20. npoints()

    The PostgreSQL npoints() function counts the number of points on the specified path or polygon and returns it.
  21. path(polygon)

    The PostgreSQL path(polygon) function converts the specified polygon to a closed path with the same list of points.
  22. pclose()

    The PostgreSQL pclose() function converts the specified path to a closed path.
  23. point()

    The PostgreSQL point() function constructs a point based on the coordinates specified by the parameters.
  24. point(box)

    The PostgreSQL point(box) function calculates the center point of the specified rectangle and returns that.
  25. point(circle)

    The PostgreSQL point(circle) function calculates the center point of the specified circle and returns that.
  26. point(lseg)

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

    The PostgreSQL point(polygon) function calculates the center point of the specified polygon and returns that.
  28. polygon(box)

    The PostgreSQL polygon(box) function converts a rectangle into a polygon represented by four points and returns.
  29. polygon(circle)

    The PostgreSQL polygon(circle) function converts a circle to a polygon represented by twelve points and returns.
  30. polygon(integer, circle)

    The PostgreSQL polygon(integer, circle) function converts a circle to a polygon represented by a specified number of points and returns it.
  31. polygon(path)

    The PostgreSQL polygon(path) function turns a closed path into a polygon with the same number of points and returns.
  32. popen()

    The PostgreSQL popen() function converts the specified path to an open path.
  33. radius()

    The PostgreSQL radius() function to extract the radius of the specified circle.
  34. slope()

    The PostgreSQL slope() function calculates and returns the slope of a line passing through two specified points.
  35. width()

    The PostgreSQL width() function returns the horizontal width of the specified rectangle.