Hello
The distance calculation between two points in can be done using GLength function as mentioned in the documentation. Eg:-
SET @lat1 =40.756054, @lon1 = -73.986951, /** NEW YORK */
@lat2 =51.5001524, @lon2 = 0.1262362; /** London */
SELECT GLength(LineStringFromWKB(LineString(ASBINARY(GeomFromText(CONCAT('POINT(',@lat1,' ', @lon1,')'))) as Distance
But the distance here calculated is not based on geo model. So I tried to correct it putting the SRID VALUE for the co-ordinate system used here as 4326 - for WGS84 — SRID 4326 at the time of creation of table.
1. Ref:
http://en.wikipedia.org/wiki/SRID
2. Ref:
http://dev.mysql.com/doc/refman/5.1/en/creating-spatial-values.html
Quote form Ref 2:- GeomFromText(wkt[,srid]),
But the results are not correct. I assume that SRID is not used in MYSQL spatial functions as written in
http://dev.mysql.com/doc/refman/5.0/en/gis-class-geometry.html
:- All calculations are done assuming Euclidean (planar) geometry.
So please anybody enlighten me that SRID can be used in MYSQL for calculating distance in other coordinate system or not.
Thanks