Related Documentation Download this Manual
PDF (US Ltr) - 31.4Mb
PDF (A4) - 31.5Mb
PDF (RPM) - 30.0Mb
EPUB - 7.7Mb
HTML Download (TGZ) - 7.5Mb
HTML Download (Zip) - 7.5Mb
HTML Download (RPM) - 6.5Mb
Eclipse Doc Plugin (TGZ) - 8.2Mb
Eclipse Doc Plugin (Zip) - 10.1Mb
Man Pages (TGZ) - 181.3Kb
Man Pages (Zip) - 292.3Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual

geometry-property-functions

This page has moved or been replaced. The new page is located here:

http://dev.mysql.com/doc/refman/5.6/en/gis-property-functions.html

Please update any bookmarks that point to the old page.


User Comments
  Posted by Ritesh Ranjan on November 12, 2009
The GLength function can not be used for calculating the distance on a sphere ... like earth. correct me if i m wrong.
  Posted by Ben Griffin on April 20, 2010
Yes, IIRC mysql's geometry calculations are limited to the cartesian plane. This is important when needing to make calculations that involve non-cartesian coordinates (such as mercator coordinates)
  Posted by ALEXANDER SKAKUNOV on July 1, 2012
In case you want to get a center point of any geometry, consider the function I created:

DELIMITER //
DROP FUNCTION IF EXISTS GetCenterPoint; //
CREATE FUNCTION GetCenterPoint(g GEOMETRY) RETURNS POINT NO SQL DETERMINISTIC
BEGIN
DECLARE envelope POLYGON;
DECLARE sw, ne POINT; #South-West and North-East points
DECLARE lat, lng DOUBLE;

SET envelope = ExteriorRing(Envelope(g));
SET sw = PointN(envelope, 1);
SET ne = PointN(envelope, 3);
SET lat = X(sw) + (X(ne)-X(sw))/2;
SET lng = Y(sw) + (Y(ne)-Y(sw))/2;
RETURN POINT(lat, lng);
END; //

We use it a lot in our project http://www.sunnyrentals.com to distinguish coordinates to center a map to.
Sign Up Login You must be logged in to post a comment.