CENTROID()

Documentation

VoltDB Home » Documentation » Using VoltDB

CENTROID()

CENTROID() — Returns the central point of a polygon.

Synopsis

CENTROID( polygon )

Description

The CENTROID() returns the central point of a GEOGRAPHY polygon. The centroid is the point where any line passing through the centroid divides the polygon into two segments of equal area. The return value of the CENTROID() function is a GEOGRAPHY_POINT value.

Note that the centroid may fall outside of the polygon itself. For example, if the polygon is a ring (that is, a circle with an inner circle removed) or a horseshoe shape.

Example

The following example uses the CENTROID() and LATITUDE() functions to return a list of countries where the majority of the land mass falls above the equator.

SELECT name, capital FROM country
   WHERE LATITUDE(CENTROID(outline)) > 0 
   ORDER BY name, capital;