[postgis-users] list of the closest borders

Kevin Neufeld kneufeld at refractions.net
Wed Sep 10 08:34:35 PDT 2008


Yes.  Experiment with

- ST_Line_Locate_Point(linestring, Point) - which returns a percentage 
along the linestring the point occurs.

- ST_Line_Interpolate_Point(linestring, location) - which accepts a 
"percentage along" and returns the interpolated point along the 
linestring.

Since these functions accept a linestring, you could extract the 
exterior ring of your country polygon.

Something like:
SELECT
   ST_Line_Interpolate_Point(
     ST_Exterior_Ring(the_geom),
     ST_Line_Locate_Point(ST_Exterior_Ring(the_geom), gps_pt)
   )
FROM ...

Cheers,
Kevin

Doug Fischer wrote:
> ...
> Is there some way to determine the closest point in the border of the 
> country to the point collected by the GPS in order to use the 
> distance_sphere() or distance_spheroid() functions for a more precise 
> measurement?
> 
> Thank you very much for any help.
> 



More information about the postgis-users mailing list