Documentation Home
MySQL 5.6 リファレンスマニュアル
Download this Manual
PDF (US Ltr) - 27.1Mb
PDF (A4) - 27.1Mb
EPUB - 7.5Mb
HTML Download (TGZ) - 7.2Mb
HTML Download (Zip) - 7.2Mb


11.5.2.9 MultiPoint クラス

MultiPoint は、Point 要素から構成される幾何図形コレクションです。点の接続や順序付けは一切行われません。

MultiPoint の例

  • 世界地図で、MultiPoint は一連の小さな島々を表すことができます。

  • 市内地図で、MultiPoint はチケットオフィスの系列店を表すことができます。

MultiPoint のプロパティー

  • MultiPoint は 0 次元の幾何図形です。

  • この 2 つの Point の値 (座標値) が等しくない場合は、MultiPoint は単純になります。

  • MultiPoint の境界は空セットになります。


User Comments
  Posted by ALEXANDER SKAKUNOV on March 26, 2013
Re comparing equality of 2 points.

Although that sounds easy, it can be counter-intuitive. The problem is the precision of coordinates. For example, in our project ( http://dobrotvor.com/ ) we bumped into this due to the fact that the precision of geo coordinates incapsulates the zoom value of Google Maps points. It's not right just to compare (X1 == X2) AND (Y1 == Y2) since the results can be wrong in many cases.

To make it work right, it's better to use special function (couldn't find anything better built-in):

[code]
DELIMITER //

DROP FUNCTION IF EXISTS ArePointsEqual; //
CREATE FUNCTION ArePointsEqual(p1 POINT, p2 POINT) RETURNS BOOLEAN NO SQL DETERMINISTIC
BEGIN
RETURN IsZero(X(p1) - X(p2)) AND IsZero(Y(p1) - Y(p2));
END; //

DROP FUNCTION IF EXISTS IsZero; //
CREATE FUNCTION IsZero(n DOUBLE) RETURNS BOOLEAN NO SQL DETERMINISTIC
BEGIN
DECLARE epsilon DOUBLE DEFAULT 0.00000000001;
RETURN (ABS(n) <= epsilon);
END; //
[/code]

The trick is not to use 0 as "zero value", but to use a very small difference (called "epsilon") instead for comparison.
  Posted by Shane Bester on December 8, 2013
The above IsZero function is needed due to the explanations give in the manual:
http://dev.mysql.com/doc/refman/5.6/en/problems-with-float.html
Sign Up Login You must be logged in to post a comment.