[Raster-commits] r257 - pkg/raster/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 8 04:09:33 CET 2009


Author: rhijmans
Date: 2009-02-08 04:09:32 +0100 (Sun, 08 Feb 2009)
New Revision: 257

Modified:
   pkg/raster/R/polygonToRaster.R
Log:


Modified: pkg/raster/R/polygonToRaster.R
===================================================================
--- pkg/raster/R/polygonToRaster.R	2009-02-07 16:02:24 UTC (rev 256)
+++ pkg/raster/R/polygonToRaster.R	2009-02-08 03:09:32 UTC (rev 257)
@@ -125,9 +125,10 @@
 					} else {
 						mypoly <- spPolys at polygons[[i]]@Polygons[[j]]
 						intersection <- .intersectLinePolygon(myline, mypoly at coords)
+						x <- sort(intersection[,1])
 						
-						if (nrow(intersection) > 0) {
-							if ( sum(intersection[-length(intersection)] == intersection[-1]) > 0 ) {
+						if (length(x) > 0) {
+							if ( sum(x[-length(x)] == x[-1]) > 0 ) {
 #								line1 <- myline
 #								line2 <- myline
 #								line1[,2] <-  myline[,2] + 0.1 * yres(raster)



More information about the Raster-commits mailing list