[R-sig-Geo] help to creating a points subset with R: Cut points shapefaile with a buffer polygon shapefile

Roger Bivand Roger.Bivand at nhh.no
Thu Feb 26 08:13:57 CET 2009


On Wed, 25 Feb 2009, Paul Hiemstra wrote:

> Hi,
>
> Have you tried the overlay command in the sp package?

Exactly. The questioner had asked me offlist (the list is a much better 
choice, it does 24/7, which I don't), and the answer is:

library(rgdal)
buff <- readOGR(".", "buff_canopy_subset")
canopy <- readOGR(".", "canopy_subset")
plot(buff, axes=TRUE)
plot(canopy, add=TRUE, pch=".")
o <- overlay(canopy, buff)
plot(canopy, add=TRUE, pch=".", col=o+1)

The overlay methods are so simple that they really deserve to be among the 
the first things people learn.

Roger

>
> cheers,
> Paul
>
> Alessandro schreef:
>> Hi All Researcher,
>> 
>> Thanks for help and suggestions.
>> 
>> I have a points shapefile (soil) with one column [H] and a circular buffer
>> polygons (plots) with a column [ID identify. Ex: 1,2,3 etc etc]. I wish to
>> clip the points shapefile with the buffer and obtain a new points shape 
>> file
>> (only the points inside the buffer) with two columns [ID of buffer and H).
>>
>> 
>> I have with maptools problem with memory because every time my R 
>> crash-down.
>> 
>>
>>
>>  Any suggestions would be appreciated.
>> 
>> Thanks again
>>
>> 
>> Ale
>> 
>>
>> 	[[alternative HTML version deleted]]
>> 
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
>
>
>

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