Dave,

You can turn your polygon into a line that is the boundary and then use the
linear referencing functions to return the nearest point along that line to
your input point.

select
  st_line_interpolate_point(
    st_exteriorring(polygongeometry),
    st_line_locate_point(
       st_exteriorring(polygongeometry),
       pointgeometry
    )
  )

David

On Tue, Sep 7, 2010 at 6:55 AM, David Potts <[email protected]> wrote:

>
> I have a series of x/y values that represent towns and a coastline that
> that is encoded as a Polygon.
>
> I want to return the nearest point on the polygon to a town.  I have seen
> the item
>
> http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor_generic
>
> Which seems to be fine if you both objects that your are searching  are
> point data or have a centroid of some type.
>
> What is the best solution, turn my coastal outline polygon in to a series
> of x/y values and use the solution from postgis_nearest_neighbor_generic,
> or is there some better way?
>
> regards
>
>
> Dave.
>
> --
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of the
> Pinan Software
>
>
> _______________________________________________
> postgis-users mailing list
> [email protected]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
************************************
David William Bitner
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to