[Raster-commits] r225 - pkg/raster/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 31 07:16:18 CET 2009
Author: rhijmans
Date: 2009-01-31 07:16:18 +0100 (Sat, 31 Jan 2009)
New Revision: 225
Modified:
pkg/raster/man/PolygonsToRaster.Rd
Log:
Modified: pkg/raster/man/PolygonsToRaster.Rd
===================================================================
--- pkg/raster/man/PolygonsToRaster.Rd 2009-01-31 03:23:32 UTC (rev 224)
+++ pkg/raster/man/PolygonsToRaster.Rd 2009-01-31 06:16:18 UTC (rev 225)
@@ -8,12 +8,12 @@
Two implementations of a polygon to raster conversion (number 2 should be slowest in most cases)
}
\usage{
-polygonsToRaster(sppoly, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA")
-polygonsToRaster2(sppoly, raster, field=0, filename="", overwrite=FALSE)
+polygonsToRaster(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA")
+polygonsToRaster2(spPolys, raster, field=0, filename="", overwrite=FALSE)
}
\arguments{
- \item{sppoly}{ a SpatialPolygons or a SpatialPolygonsDataFrame object }
+ \item{spPolys}{ a SpatialPolygons or a SpatialPolygonsDataFrame object }
\item{raster}{ RasterLayer }
\item{field}{ The index of the column in the SpatialPolygonsDataFrame to be transfered to the RasterLayer }
\item{filename}{ }
@@ -42,14 +42,14 @@
r <- polygonsToRaster(polys, r)
#plot(r)
#plot(polys, add=T)
-cds4 <- rbind(c(-180,20), c(0,90), c(40,85), c(150, 45), c(180,-5), c(145,-40), c(40,-35), c(0,-25), c(-25, -15), c(-180,20))
+cds4 <- rbind(c(-180,10), c(0,40), c(40,45), c(145,-10), c(-25, -15), c(-180,0), c(-180,10))
addpoly <- SpatialPolygons(list(Polygons(list(Polygon(cds4)), 1)))
addpoly <- as(addpoly, "SpatialPolygonsDataFrame")
addpoly at data[1,1] <- 10
r2 <- polygonsToRaster(addpoly, r, field=1, updateRaster=TRUE, updateValue="NA")
-#plot(r2)
-#plot(polys, add=T)
-#plot(addpoly, add=T, border="red", lwd=2)
+plot(r2)
+plot(polys, border="blue", lwd=2, add=T)
+plot(addpoly, add=T, border="red", lwd=2)
}
More information about the Raster-commits
mailing list