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

Juergen Lorenz Simon simon at webtecc.com
Tue Oct 13 02:09:25 PDT 2009


Hi,

i'm inclined to go with Regina's solution as a starting point (since  
it won't involve any looping etc). I'm beginning to see how the  
PostGIS 'thinking' works. Could it be that the ST_Buffer() function is  
one of the most ... 'used' functions in PostGIS?

Anyways, in the long run I probably have little choice but to write a  
real function, since my Poly's do have holes. I will have to take care  
of this fact eventually.

Thanks all for the useful answers!

J.


On 13.10.2009, at 02:04, Paragon Corporation wrote:

> 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
>
>
>
> _______________________________________________
> 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