If you look into the json google produces, you should see that the start- and endpoints are identical - and they are neither equal to neigher your start- nor endpoint I would guess there are some rounding going on somewhere - that the google api just is not able to distinguish between points so close together.
Morten James David Smith skrev: > Hi there everyone, > > I've been messing about using the Google Directions API thing > recently, and came across some odd results. Code to demonstrate is > below. > > Essentially the distance between two points using PostGIS is 18 > metres, yet when I translate the points to Lat/Long and then stick > them in the Google API the distance comes out as 1 metre. > > Does anyone have any thoughts on this? > > Thanks > > James > > -------------------------------------------------------------------- > -- Calculate a distance between two points using SRID 27700 (OSGB36): > > SELECT St_Distance( > St_SetSRID(ST_makePoint(531058, 178463), 27700) , > St_SetSRID(ST_makePoint(531041, 178455), 27700) > ) > > RESULT = 18.7882942280559 (I presume metres) > --------------------------------------------------------------------- > -- Now calculte a distance between two points using SRID 4326 (WGS84): > > SELECT St_Distance( > St_Transform(St_SetSRID(ST_makePoint(531058, 178463), 27700), 4326), > St_Transform(St_SetSRID(ST_makePoint(531041, 178455), 27700), 4326) > ) > > RESULT = 0.000256838311729703 (I presume degrees) > > --------------------------------------------------------------------- > -- Now calculate the distance using the Google Directions API using > the Lat/Lon values: > > http://maps.googleapis.com/maps/api/directions/json?origin=51.4899343224464%20-0.113689479559085&destination=51.4898663658699%20-0.113937164484113&mode=walking&sensor=false&units=metric > > RESULT = "1 m" > _______________________________________________ > postgis-users mailing list > [email protected] > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
