These functions return properties of
MultiLineString
values.
Returns as a double-precision number the length of the
MultiLineString
value
mls
. The length of
mls
is equal to the sum of the
lengths of its elements.
mysql>SET @mls = 'MultiLineString((1 1,2 2,3 3),(4 4,5 5))';
mysql>SELECT GLength(GeomFromText(@mls));
+-----------------------------+ | GLength(GeomFromText(@mls)) | +-----------------------------+ | 4.2426406871193 | +-----------------------------+
GLength()
is a nonstandard
name. It corresponds to the OpenGIS
Length()
function.
Returns 1 if the MultiLineString
value
mls
is closed (that is, the
StartPoint()
and
EndPoint()
values are the
same for each LineString
in
mls
). Returns 0 if
mls
is not closed, and –1
if it is NULL
.
mysql>SET @mls = 'MultiLineString((1 1,2 2,3 3),(4 4,5 5))';
mysql>SELECT IsClosed(GeomFromText(@mls));
+------------------------------+ | IsClosed(GeomFromText(@mls)) | +------------------------------+ | 0 | +------------------------------+
User Comments
The result of GLength() depends on the type of Spatial Reference (SRID).
The value above is based on euclidian geometry.
The length of a line (and hence of a LineString and MultiLineString) is given by
SQRT ( (x2-x1)^2 + (y2-y1)^2 )
only in planar (euclidian) geometry.
If x & y are spherical lattitude and longitude then the distance between 2 points of coordinates (lng1,lat1) and (lng2,lat2) is given by
distInRadians = acos ( sin(lat1)*sin(lat2) +cos(lat1)*cos(lat2)*cos(lng2-lng1) )
distInMeters = distInRadians * RadiusOfSphere
See also My comment on 19.5.2.6 MultiPolygon Functions
Add your own comment.