[R-sig-Geo] Distance to (nearest) polygon

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 26 16:27:23 CET 2010


On Tue, 26 Jan 2010, Karl Ove Hufthammer wrote:

> Dear list members
>
> Is there an easy and preferably fast way to measure the distance from a
> of (large) number of points to the nearest polygon? spDistsN1 seems to
> only want to measure the distance between points.
>
> For example, I need the distance between points at sea to the nearest
> land area (as defined by for example the 'world' dataset).
>
> It's not very important which polygon, e.g., country, the given distance
> is to. It would be nice if the 'distance' from points that are inside
> the polygons were zero or negative, but it's not required -- distance to
> the polygon border, e.g., shoreline, would be OK.

There are methods for point to line segment distances in spatstat. 
Further, for projected (planar) coordinates, this could be added to 
R-Forge rgeos; for geographical coordinates Boost ggl would be needed.

Roger

>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list