Creating a Spatially Enabled MySQL Database
987
Constructs a
Polygon
value from a
MultiLineString
value in WKB format containing an arbitrary
collection of closed
LineString
values.
12.16.4.2.3. Creating Geometry Values Using MySQL-Specific Functions
MySQL provides a set of useful nonstandard functions for creating geometry values. The functions
described in this section are MySQL extensions to the OpenGIS specification.
As of MySQL 5.0.82, these functions produce geometry objects from either WKB values or geometry
objects as arguments. If any argument is not a proper WKB or geometry representation of the proper
object type, the return value is
NULL
.
Before MySQL 5.0.82, these functions produce
BLOB
values containing WKB representations of
geometry values with no SRID from WKB arguments. The WKB value returned from these functions
can be converted to geometry arguments by using them as the first argument to functions in the
GeomFromWKB()
[986]
function family.
For example, as of MySQL 5.0.82, you can insert the geometry return value from
Point()
[987]
directly into a
Point
column:
INSERT INTO t1 (pt_col) VALUES(Point(1,2));
Prior to MySQL 5.0.82, convert the WKB return value to a
Point
before inserting it:
INSERT INTO t1 (pt_col) VALUES(GeomFromWKB(Point(1,2)));
•
GeometryCollection(g1,g2,...)
[987]
Constructs a
GeometryCollection
.
•
LineString(pt1,pt2,...)
[987]
Constructs a
LineString
value from a number of
Point
or WKB
Point
arguments. If the number
of arguments is less than two, the return value is
NULL
.
•
MultiLineString(ls1,ls2,...)
[987]
Constructs a
MultiLineString
value using
LineString
or WKB
LineString
arguments.
•
MultiPoint(pt1,pt2,...)
[987]
Constructs a
MultiPoint
value using
Point
or WKB
Point
arguments.
•
MultiPolygon(poly1,poly2,...)
[987]
Constructs a
MultiPolygon
value from a set of
Polygon
or WKB
Polygon
arguments.
•
Point(x,y)
[987]
Constructs a
Point
using its coordinates.
•
Polygon(ls1,ls2,...)
[987]
Constructs a
Polygon
value from a number of
LineString
or WKB
LineString
arguments. If
any argument does not represent a
LinearRing
(that is, not a closed and simple
LineString
),
the return value is
NULL
.
12.16.4.3. Creating Spatial Columns
MySQL provides a standard way of creating spatial columns for geometry types, for example, with
CREATE TABLE
or
ALTER TABLE
. Currently, spatial columns are supported for
MyISAM
,
InnoDB
,
NDB
,
BDB
, and
ARCHIVE
tables. (Support for storage engines other than
MyISAM
was added in MySQL
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 ...