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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 27 08:24:54 CET 2009


Author: rhijmans
Date: 2009-01-27 08:24:54 +0100 (Tue, 27 Jan 2009)
New Revision: 189

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


Modified: pkg/raster/R/adjacency.R
===================================================================
--- pkg/raster/R/adjacency.R	2009-01-27 07:24:50 UTC (rev 188)
+++ pkg/raster/R/adjacency.R	2009-01-27 07:24:54 UTC (rev 189)
@@ -20,8 +20,17 @@
 #	return(raster)
 #}
 
-adjacency <- function(raster, fromCells, toCells, directions, outerMeridianConnect) {
+adjacency <- function(raster, fromCells, toCells, directions) {
 
+	outerMeridianConnect <- FALSE
+	if (isLatLon(raster)) {
+		tolerance <- 0.1
+		scale <- xres(raster)
+		if (all.equal(xmin(raster), -180, tolerance=tolerance, scale=scale) & all.equal(xmax(raster), 180, tolerance=tolerance, scale=scale)) {
+			outerMeridianConnect <- TRUE
+		}
+	}
+
 	if (directions=="Bishop") { return(.adjBishop(raster, fromCells, toCells, outerMeridianConnect)) }
 
 	nCols <- ncol(raster)



More information about the Raster-commits mailing list