<div dir="ltr">Hi Paul,<div><br></div><div>Thank you very much for the answer. But don't curse me yet :) I care, but I can probably work around it. I can modify my edge and add interior vertices that are on the wgs84 edge (tessellate) and thus reduce the error when projecting a point to the edge on the sphere.</div><div><br></div><div>--Hector</div><div><br></div><div><span style="font-size:12.8px">> Yes, you've got it right. The projected point is done in sphere world for</span><br style="font-size:12.8px"><span style="font-size:12.8px">> speed, and then the point-to-point distance is done on spheroid. Most</span><br style="font-size:12.8px"><span style="font-size:12.8px">> people don't care. Curse you for caring :)</span><br style="font-size:12.8px"><span style="font-size:12.8px">> P</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">>> Hello,</span><br style="font-size:12.8px"><span style="font-size:12.8px">>></span><br style="font-size:12.8px"><span style="font-size:12.8px">>> I am trying to verify the distance calculation (using geographies and</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> use_spheroid=true) between a line and a point.</span><br style="font-size:12.8px"><span style="font-size:12.8px">>></span><br style="font-size:12.8px"><span style="font-size:12.8px">>> I have used GeographicLib to generate a geodesic (using the wgs84</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> ellipsoid) between points 0 0 and 10 50 (lng lat). I generate a point lies</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> on the edge (at the mid point) which is 3.</span><a href="tel:91451185%2025" value="+19145118525" style="font-size:12.8px">91451185 25</a><span style="font-size:12.8px">.11977359. When I use</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> st_distance to compute the distance between the edge and the point I expect</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> the answer to be close to 0. But it is not.</span><br style="font-size:12.8px"><span style="font-size:12.8px">>></span><br style="font-size:12.8px"><span style="font-size:12.8px">>> select st_distance(st_geogfromtext('</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">SRID=4326;point( 3.91451185</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> 25.11977359 )'),st_geogfromtext('SRID=</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">4326;linestring(0.00000000</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> 0.00000000, 10 50 )'), true);</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> produces: 274.54332271 meters. If I use use_spheroid=false the answer</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> is 274.10911308.</span><br style="font-size:12.8px"><span style="font-size:12.8px">>></span><br style="font-size:12.8px"><span style="font-size:12.8px">>> Is this because the distance calculation between a point and a line is</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> done by projecting the point to the line assuming a perfect sphere? Or am I</span><br style="font-size:12.8px"><span style="font-size:12.8px">>> doing something wrong?</span><br style="font-size:12.8px"><span style="font-size:12.8px">>></span><br style="font-size:12.8px"><span style="font-size:12.8px">>> I am using Postgresql-9.5 and PostGIS-2.2 on Ubuntu 16.04.</span><br></div><div><div><br></div>
</div></div>