MySQL Forums
Forum List  »  GIS

Help: Distance calculation between two Geo coordinates
Posted by: Ritesh Ranjan
Date: November 13, 2009 04:56AM


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:
2. Ref:
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

:- 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.


Options: ReplyQuote

Written By
Help: Distance calculation between two Geo coordinates
November 13, 2009 04:56AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.