[postgis-users] st_distance between a point and an edge using GeographicLib.
Hector Gonzalez
hagonzal at gmail.com
Tue Mar 28 16:36:56 PDT 2017
Hello,
I am trying to verify the distance calculation (using geographies and
use_spheroid=true) between a line and a point.
I have used GeographicLib to generate a geodesic (using the wgs84
ellipsoid) between points 0 0 and 10 50 (lng lat). I generate a point lies
on the edge (at the mid point) which is 3.91451185 25.11977359. When I use
st_distance to compute the distance between the edge and the point I expect
the answer to be close to 0. But it is not.
select st_distance(st_geogfromtext('SRID=4326;point( 3.91451185 25.11977359
)'),st_geogfromtext('SRID=4326;linestring(0.00000000 0.00000000, 10 50
)'), true);
produces: 274.54332271 meters. If I use use_spheroid=false the answer
is 274.10911308.
Is this because the distance calculation between a point and a line is done
by projecting the point to the line assuming a perfect sphere? Or am I
doing something wrong?
I am using Postgresql-9.5 and PostGIS-2.2 on Ubuntu 16.04.
Thanks
--
Hector
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170328/8bdcb0e6/attachment.html>
More information about the postgis-users
mailing list