Spatial Analysis Functions
995
mysql>
SET @poly =
->
GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))');
mysql>
SELECT GeometryType(@poly),AsText(Centroid(@poly));
+---------------------+--------------------------------------------+
| GeometryType(@poly) | AsText(Centroid(@poly)) |
+---------------------+--------------------------------------------+
| POLYGON | POINT(4.958333333333333 4.958333333333333) |
+---------------------+--------------------------------------------+
The OpenGIS specification also defines the following function, which MySQL does not implement:
•
PointOnSurface(mpoly)
Returns a
Point
value that is guaranteed to be on the
MultiPolygon
value
mpoly
.
12.16.5.2.7.
GeometryCollection
Functions
These functions return properties of
GeometryCollection
values.
•
GeometryN(gc,N)
[995]
Returns the
N
-th geometry in the
GeometryCollection
value
gc
. Geometries are numbered
beginning with 1.
mysql>
SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
mysql>
SELECT AsText(GeometryN(GeomFromText(@gc),1));
+----------------------------------------+
| AsText(GeometryN(GeomFromText(@gc),1)) |
+----------------------------------------+
| POINT(1 1) |
+----------------------------------------+
•
NumGeometries(gc)
[995]
Returns the number of geometries in the
GeometryCollection
value
gc
.
mysql>
SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
mysql>
SELECT NumGeometries(GeomFromText(@gc));
+----------------------------------+
| NumGeometries(GeomFromText(@gc)) |
+----------------------------------+
| 2 |
+----------------------------------+
12.16.5.3. Functions That Create New Geometries from Existing Ones
The following sections describe functions that take geometry values as arguments and return new
geometry values.
12.16.5.3.1. Geometry Functions That Produce New Geometries
Section 12.16.5.2, “
Geometry
Property Functions”
, discusses several functions that construct new
geometries from existing ones. See that section for descriptions of these functions:
•
Envelope(g)
[990]
•
StartPoint(ls)
[993]
•
EndPoint(ls)
[992]
•
PointN(ls,N)
[992]
•
ExteriorRing(poly)
[994]
•
InteriorRingN(poly,N)
[994]
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...