Gareth
That one is exactly what I am looking for. Thanks.
Juan

On Tue, Apr 10, 2012 at 6:30 AM, Gareth Davies <grothered@gmail.com> wrote:

> Hi,
> You can do something like the following:
>
> # Make some points
> tmp = matrix(runif(20),ncol=2)
> pts=SpatialPoints(tmp) # These are the points
>
> library(rgeos)
> pts_buffer=gBuffer(pts,width=**0.1,byid=T) # This is the points with a
> buffer
>
>
> # Make a 'river'
> tmp = matrix(c(0,1, 0,2) ,ncol=2)
> tmp2 = Lines( list(Line(tmp)), ID="0")
> lne = SpatialLines(list(tmp2)) # This is the river 'line'
> lne_buffer=gBuffer(lne,width=**0.02) # This is the buffered river
>
> # Plot everything
> plot(pts_buffer,col='green')
> plot(lne_buffer,add=T,col='**blue')
> plot(lne,add=T,col='black')
> plot(pts,add=T,col='red')
>
> # Find overlaps -- TRUE denotes overlap
> # There are various things you could do
> point_buffer_intersect_river=**over(pts_buffer,lne)
> point_intersect_river_buffer=**over(pts,lne_buffer)
> point_buffer_intersect_river_**buffer=over(pts_buffer,lne_**buffer)
>
> # Then to get the points that intersect, you can do e.g.
> pts[!is.na(point_buffer_**intersect_river_buffer)]
> # assuming some points do actually intersect
>
>


-- 
Juan Tomás Sayago Gómez
Graduate Research Assistant
West Virginia University - RRI
886 Chestnut Ridge Road, Room 520
P.O. Box 6825
Morgantown, WV 26506-6825

	[[alternative HTML version deleted]]

