[postgis-users] Closest point on a POLYGON to a given POINT
strk
strk at keybit.net
Mon Oct 12 07:57:27 PDT 2009
On Mon, Oct 12, 2009 at 04:43:39PM +0200, Juergen Lorenz Simon wrote:
> Hi,
>
> I have a nut to crack and i'm not finding anything suitable in the
> PostGIS documentation. The problem is as follows:
>
> I have a POLYGON G and a POINT P. I'd like to find the closest point
> to P on G (not in, ON). Is there a quick way of doing this with the
> build-in functions? Or is there some plsql routine I can use?
Try with ST_Line_Locate_Point [1] against the polygon boundary
(I'm assuming you mean ON as in "on boundary").
It'll take some looping and distance comparison if your polygon
has holes.
[1] http://postgis.refractions.net/documentation/manual-svn/ST_Line_Locate_Point.html
--strk;
Free GIS & Flash consultant/developer () ASCII Ribbon Campaign
http://foo.keybit.net/~strk/services.html /\ Keep it simple!
More information about the postgis-users
mailing list