These functions return properties of
MultiPolygon
values.
Returns as a double-precision number the area of the
MultiPolygon
value
mpoly
, as measured in its
spatial reference system.
mysql>SET @mpoly =
->'MultiPolygon(((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1)))';
mysql>SELECT Area(GeomFromText(@mpoly));
+----------------------------+ | Area(GeomFromText(@mpoly)) | +----------------------------+ | 8 | +----------------------------+
The OpenGIS specification also defines the following functions, which MySQL does not implement:
Returns the mathematical centroid for the
MultiPolygon
value
mpoly
as a
Point
. The result is not guaranteed to
be on the MultiPolygon
.
Returns a Point
value that is
guaranteed to be on the MultiPolygon
value mpoly
.
User Comments
The result of Area() depends on the type of Spatial Reference (SRID).
The value above is based on euclidian geometry.
The area of a triangle (and hence of a Polygon and MultiPolygon) is given by Heron's formula
SQRT ( s * (s-a) * (s-b) * (s-c) )
only in planar (euclidian) geometry.
Here a, b and c are the lengths of the sides of a triangle as given by GLength() (see also comment on MultiLineString functions) and s=(a+b+c)/2.
On a sphere where coordinates are lattitude and longitude and the lengths of the sides are measured in radians the formula to use for the area is
AreaInSteradians = 4*atan(sqrt( tan(s/2) * tan((s-a)/2) * tan((s-b)/2) * tan((s-c)/2) ))
AreaInSqMeters = AreaInSteradians * RadiusOfSphere^2
See also my comment on 19.5.2.4 MultiLineString Functions
Add your own comment.