MySQL Forums
Forum List  »  GIS

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

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Help: Distance calculation between two Geo coordinates
7570
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.