Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
GEOGRAPHY_ AREA
On this page
The GEOGRAPHY_ function measures the square meter area of a given polygon.
Syntax
GEOGRAPHY_AREA ( polygon )Arguments
-
polygon: any valid geospatial object or WKT string.
Important
If an argument is a point or line, the area is zero.
Return Type
A double.
Examples
CREATE ROWSTORE TABLE neighborhoods (id INT UNSIGNED NOT NULL PRIMARY KEY,name VARCHAR(64) NOT NULL,population INT UNSIGNED NOT NULL,shape GEOGRAPHY NOT NULL,centroid GEOGRAPHYPOINT NOT NULL,index (shape) WITH (resolution = 8),index (centroid));INSERT INTO neighborhoods VALUES(1, "Hamilton", 12346, "POLYGON((1 1,2 1,2 2, 1 2, 1 1))","POINT(1.5 1.5)"),(2, "Probability Bay", 263951, "POLYGON((5 1,6 1,6 2,5 2,5 1))", "POINT(5.5 1.5)"),(3, "Decentralized Park", 29265, "POLYGON((5 5,6 5,6 6,5 6,5 5))", "POINT(5.5 5.5)"),(4, "Axiom Township", 845696, "POLYGON((1 5,2 5,2 6,1 6,1 5))", "POINT(1.5 5.5)"),(5, "Elegant Island ", 987654, "POLYGON((3 3,4 3,4 4,3 4,3 3))", "POINT(3.5 3.5)");
SELECT name, ROUND(geography_area(shape), 0) AS sqmFROM neighborhoods ORDER BY 2;
+----------------------+------------+
| name | sqm |
+----------------------+------------+
| Axiom Township. | 12293803823|
| Decentralized Park | 12293803823|
| Elegant Island | 12327632477|
| Probability Bay | 12346439558|
| Hamilton. | 12346439558|
+----------------------+------------+Related Topics
For more information about working with geospatial data, see Working with Geospatial Features.
Last modified: