[postgis-users] Nearest Neighbour on a polygon gemeotry to a given point

David Potts dave.potts at pinan.co.uk
Tue Sep 7 05:27:21 PDT 2010


hi

Thank you, I will have a play with this.


> 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 <dave.potts at pinan.co.uk>
> 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
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
>
>
> --
> ************************************
> David William Bitner
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


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





More information about the postgis-users mailing list