Boost logo

Geometry :

Subject: [ggl] nearest neighbor/segment
From: Barend Gehrels (barend.gehrels)
Date: 2010-09-10 06:04:37

  hi Matt,

Welcome to the list.

> When a point is found to be within a polygon, is there a GGL method
> already in place to find the polygon segment and corresponding anchor
> nodes closest to that point within the polygon?
> [...] Does a method similar to above illustrated 'unkown_method'
> exist which would return the nodes in question?

I once created a "nearest_neighbor" function which calculates exactly
this point. Because it was in draft and not completely finished, I
didn't add it yet. For this function it is not important if it lies
inside or outside, and can be used for a linestring, or even
multi-point, as well.
I was not sure about the name, and I believe in PostGIS it is called
ST_ClosestPoint, which is better. But (AFAIK) in PostGIS it will return
zero for a point within a polygon, so it is not completely similar. So
if anyone has a suggestion for the best name, it is welcome.

I'll try to add it next weekend to the sandbox.

Regards, Barend

Geometry list run by mateusz at