New answers tagged linestring
ST_ClosestPoint will find the closest point on a linestring. For example, locating a point on a road that is closest to a point-of-interest off to one side: SELECT ST_AsText(ST_ClosestPoint(road, poi)) FROM (SELECT 'LINESTRING (10 10, 20 20)'::geometry AS road, 'POINT (14 10)'::geometry AS poi ) AS f; st_astext -------------- POINT(12 12) (1 row) ...
For this you need at least version 1.3.2 of Shapely, which was released 2014-05-13. The lines of code you are looking at were added in a commit "Allow LineStrings to take arrays of Points".
There actually is no difference between the two functions, which both yield 1.195 km. The problem is that in your question the axis order is flipped for trajectory, so you are seeing different answers than you expect. SELECT ST_AsLatLonText(point_a) AS point_a_latlon, ST_AsLatLonText(point_b) AS point_b_latlon, ST_Distance_Spheroid(point_a, point_b, ...
Top 50 recent answers are included