Postgis ST_Distance query returning inaccurate results

المشرف العام

Administrator
طاقم الإدارة
I am using the following query to retrieve records from a postgresql DB

@services = Service.select("*, ST_Distance(services.lon_lat, ST_GeomFromText('POINT (lat lon)', 4326)) as st_distance").order("st_distance").limit(10)services.lon_lat is a geography type.

After implementing a "get directions" aspect to my app I have noticed a inaccuracy in the distances returned from the above query and the directions in google maps.

It's important to note I did expect a slight discrepancy taking into account the roads to the destination may not be a straight line but it seems the inaccuracy is the other way, for example the 1st returned item in this query says its 216km away where google maps says 181km, the 10th says 247km compared to google maps 203km...the further the distance the larger the inaccuracy...the 46th item returned if I choose to return that many says 424km compared to 298km.



أكثر...
 
أعلى