[postgis-users] Closest point on a POLYGON to a given POINT

Paragon Corporation lr at pcorp.us
Mon Oct 12 17:04:10 PDT 2009


Well the ideal solution would be the ST_ShortestLine that Nicklas has done
which will give you a 2 point line where the start and end points represent
the closest point on each geometry.

This is in
http://svn.osgeo.org/postgis/spike/nicklas/

And on the list here
http://trac.osgeo.org/postgis/ticket/231

I really would like to see his changes in PostGIS 1.5 since they are more
useful to me at this point than the current slated PostGIS 1.5 stuff -- HINT
HINT

Barring that I suppose you can do a 
SELECT ST_PointOnSurface(ST_Intersection(ST_Buffer(the_point,
ST_Distance(the_poly, the_point) + somemarging of error), the_poly)

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Juergen
Lorenz Simon
Sent: Monday, October 12, 2009 10:44 AM
To: PostGIS Users
Subject: [postgis-users] Closest point on a POLYGON to a given POINT

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?

Thanks in advance.

PS: Coming to think of it: is there some open source repository for PostGIS
code?

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users






More information about the postgis-users mailing list