[R-sig-Geo] Selecting polygons into buffer given center

Tom Gottfried tom.gottfried at tum.de
Wed Sep 7 13:41:10 CEST 2011


Hi Luca,

have a look at the functions in package rgeos.

regards,
Tom

Am 07.09.2011 13:12, schrieb luca candeloro:
> Hello,
> I'd like to select, given a SpatialPolygonDataframe and a point (of known
> coordinates), which are the polygons into the buffer (of a given distance)
> around the point.
> I tried the following code, but I don't know how to end it...
>
> UTM32WGS84<- CRS("+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +no_defs")
> comuniUTM=spTransform(comuni, UTM32WGS84) #where comuni is a
> SpatialPolygonDataFrame
> puntoUTM<- spTransform(punto, UTM32WGS84) #where punto is a
> SpatialPointDataFrame
> #I create the spatial polygon whit the buffer of 4 km around the point using
> function disc() and converting it into a SpatialPolygons...
> discbuff<-disc(radius=4000, centre=puntoUTM at coords[,])
> discpoly<-Polygon(rbind(cbind(discbuff$bdry[[1]]$x,
> y=discbuff$bdry[[1]]$y), c(discbuff$bdry[[1]]$x[1],
> y=discbuff$bdry[[1]]$y[1])))
> discpoly=list(discpoly)
> discbuff<-Polygons(list(discpoly[[1]]), ID=1)
> discbuffSP=SpatialPolygons(list(discbuff))
> proj4string(discbuffSP)=UTM32WGS84
>
> #Does anyone konw how can I get the polygons in comuniUTM intersecting the
> discbuffSP?
>
> Thanks a lot,
> Luca.
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Technische Universität München
Department für Pflanzenwissenschaften
Lehrstuhl für Grünlandlehre
Alte Akademie 12
85350 Freising / Germany
Phone: ++49 (0)8161 715324
Fax:   ++49 (0)8161 713243
email: tom.gottfried at wzw.tum.de
http://www.wzw.tum.de/gruenland



More information about the R-sig-Geo mailing list