An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101104/ffd9d3f4/attachment.pl>
how to dismiss points outside of my area of interest in a raster
3 messages · Manuel Spínola, Robert J. Hijmans
Manuel, library(raster) # Assuming you have matrix of points (or SpatialPoints*) pt <- (cbind(runif(100), runif(100)) -0.5) * 500 spt <- SpatialPoints(pt) # and a RasterLayer r <- raster() # you can do e <- polygonFromExtent(r) o <- overlay(e, spt) o <- which(!is.na(o)) pts <- pt[o,] # show that it worked plot(pt) r[] = 1 plot(r, add=TRUE, legend=FALSE) points(pt, col='blue') points(pts, col='red', pch=20) Robert
On Thu, Nov 4, 2010 at 5:43 AM, Manuel Sp?nola <mspinola10 at gmail.com> wrote:
Dear list members, How can eliminate or dismiss points that do not "touch" my raster file? This mean those points that are outside of the raster area. When I have my plot of the rester and I draw the points: points (villages) some of them are outside of the raster not because an error but just because the point file is bigger in extent than the raster. Thank you very much in advance. Best, Manuel -- *Manuel Sp?nola, Ph.D.* Instituto Internacional en Conservaci?n y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola at una.ac.cr mspinola10 at gmail.com Tel?fono: (506) 2277-3598 Fax: (506) 2237-7036 Personal website: Lobito de r?o <https://sites.google.com/site/lobitoderio/> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/> ? ? ? ?[[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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101104/11769278/attachment.pl>