On Tue, 26 Jan 2010 16:27:23 +0100 (CET) Roger Bivand
<Roger.Bivand at nhh.no> wrote:
For example, I need the distance between points at sea to the nearest
land area (as defined by for example the 'world' dataset).
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.
Thanks. The 'nncross' function in 'spatstat' does essentially do what I
need. Unfortunately, I work with geographical coordinates (spanning
about 15 degrees of latitude), so the results are not perfect (using
plain long/lat coordinates), but they will probably be an adequate
approximation.
BTW, for my application, I'm not interested in the distance per se, only
in the points (e.g., boats) within a certain distance from the polygon
(land). So I have also thought about a possible solution of using an
expanded polygon, expanded in a certain number of kilometers outwards,
and then using point-in-polygon (i.e., 'overlay') to find the points
that are inside this new polygon. But I couldn't find a function to
'grow' a polygon in this way.
--
Karl Ove Hufthammer