[R-sig-Geo] compute buffer from point shapefile to have shapefile

Robert J. Hijmans r.hijmans at gmail.com
Mon Feb 15 21:53:43 CET 2010


Gianni,

Here is an example for longitude/latitude data using (together with
the more usual suspects) the geosphere package (recently released to
CRAN).

xy <- cbind(0, seq(-80, 80, by=20))
dist = 1000000  # 500 km
angles = seq(1,360, by=5)

library(geosphere)
crds = list()
for (i in 1:nrow(xy)) {
	d = destPoint(xy[i,], angles, dist)
	crds[[i]] = rbind(d, d[1,])
}

library(sp)
p = lapply(crds, Polygon)
pp = list()
for (i in 1:length(p)) pp[i] = Polygons(p[i], i)
spdf = SpatialPolygonsDataFrame(SpatialPolygons(pp), data.frame(id=1:length(p)))

library(maptools)
data(wrld_simpl)
plot(wrld_simpl)
plot(spdf, add=TRUE, border='red', lwd=2)
points(xy, pch=20, col='blue')






On Mon, Feb 15, 2010 at 5:39 AM, gianni lavaredo
<gianni.lavaredo at gmail.com> wrote:
> Dear Researchers,
>
> I am looking for a library to compute buffer (Ex: 10 m radius) around a
> shapefile point file. I find buffer {adehabitat} but I wish to know if there
> is another library to compute buffer.
>
> Thanks for helps
> gianni
>
>        [[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
>



More information about the R-sig-Geo mailing list