MySQL Forums
Forum List  »  GIS

ST_Distance_Sphere wrong values
Posted by: Thomas Schlage
Date: March 19, 2015 03:38AM

Hey guys.

I checked out the new ST_Distance_Sphere function in MySql 5.7.6 release because it's may solving my issues.
I figured out that these function returns me wrong values.

I went to Google Maps, selected two points on a line and get the lat long of them. Then I calculate the distance with mysql and compare it with the Distance on Google Maps.

The following query results in 2492.2964085726285 meters. But Google Maps tells me this are 1,5 km. Whats wrong here?
SELECT ST_Distance_sphere(GeomFromText('POINT(52.515802 13.452965)', 3857), GeomFromText('POINT(52.518139 13.430692)', 3857), 6378137);

Also i figured out that the ST_Distance function seems to use Pythagoras to calculate the distance which is more than just inaccurate.

Can some one help me or tell me what I did wrong or approve that there is something wrong in MySql?

Thanks in Advance.

Options: ReplyQuote

Written By
ST_Distance_Sphere wrong values
March 19, 2015 03:38AM

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.