[Raster-commits] r244 - in pkg/raster: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 4 08:03:24 CET 2009


Author: rhijmans
Date: 2009-02-04 08:03:23 +0100 (Wed, 04 Feb 2009)
New Revision: 244

Added:
   pkg/raster/man/click.Rd
Modified:
   pkg/raster/R/click.R
   pkg/raster/man/bbox.Rd
   pkg/raster/man/map.Rd
Log:


Modified: pkg/raster/R/click.R
===================================================================
--- pkg/raster/R/click.R	2009-02-04 05:14:29 UTC (rev 243)
+++ pkg/raster/R/click.R	2009-02-04 07:03:23 UTC (rev 244)
@@ -6,13 +6,18 @@
 # Version 0.8
 # Licence GPL v3
 
-clickBbox <- function(show=TRUE, border="red") {
+BboxToPolygon <- function(bbox) {
+	p <- rbind(c(bbox at xmin, bbox at ymin), c(bbox at xmin, bbox at ymax), c(bbox at xmax, bbox at ymax), c(bbox at xmax, bbox at ymin), c(bbox at xmin, bbox at ymin) )
+	pol <- SpatialPolygons(list(Polygons(list(Polygon(p)), 1)))
+	return(pol)
+}
+
+clickBbox <- function(show=TRUE, col="red") {
 	loc <- locator(n=2, type="p")
 	bb <- newBbox(min(loc$x), max(loc$x), min(loc$y), max(loc$y))
 	if (show) {
 		p <- rbind(c(bb at xmin, bb at ymin), c(bb at xmin, bb at ymax), c(bb at xmax, bb at ymax), c(bb at xmax, bb at ymin), c(bb at xmin, bb at ymin) )
-		pol <- SpatialPolygons(list(Polygons(list(Polygon(p)), 1)))
-		plot(pol, add=TRUE, border=border)
+		lines(p, col=col)
 	}
 	return(bb)
 }

Modified: pkg/raster/man/bbox.Rd
===================================================================
--- pkg/raster/man/bbox.Rd	2009-02-04 05:14:29 UTC (rev 243)
+++ pkg/raster/man/bbox.Rd	2009-02-04 07:03:23 UTC (rev 244)
@@ -47,6 +47,9 @@
 }
   
 \author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{clickBbox}} }
+
 \examples{
 r <- raster()
 bb <- newBbox(-10, 10, -20, 20)

Added: pkg/raster/man/click.Rd
===================================================================
--- pkg/raster/man/click.Rd	                        (rev 0)
+++ pkg/raster/man/click.Rd	2009-02-04 07:03:23 UTC (rev 244)
@@ -0,0 +1,32 @@
+\name{click}
+\alias{click}
+\alias{clickBbox}
+
+\title{ Click on map }
+\description{
+  Click on a map to get values, coordinates or a bounding box
+}
+\usage{
+click(object, n=1, xy=FALSE, type = "n", ...)
+clickBbox(show = TRUE, col = "red") 
+}
+
+\arguments{
+  \item{n}{number of clicks on the map}
+  \item{xy}{show xy coordinates}
+  \item{type}{see under ?locator}
+  \item{show}{logical. If \code{TRUE}, the bounding box will be drawn on the map}  
+  \item{col}{the color of the bounding box lines}    
+ }
+ 
+\details{
+forthcoming
+}
+
+
+\author{ Robert J. Hijmans }
+
+\examples{ 
+ }
+
+\keyword{ spatial }

Modified: pkg/raster/man/map.Rd
===================================================================
--- pkg/raster/man/map.Rd	2009-02-04 05:14:29 UTC (rev 243)
+++ pkg/raster/man/map.Rd	2009-02-04 07:03:23 UTC (rev 244)
@@ -1,11 +1,10 @@
-\name{map}
+\name{plot}
 \alias{map}
 \alias{plot}
 \alias{plot,RasterLayer,missing-method}
 \alias{plot,RasterLayer,RasterLayer-method}
 \alias{plot,RasterStack,numeric-method}
 \alias{plot,RasterStack,missing-method}
-\alias{click}
 
 \title{ Map a raster layer }
 \description{
@@ -13,7 +12,6 @@
 }
 \usage{
 map(object, index=1, col=rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...)
-click(object, n=1, xy=FALSE, type = "n", ...)
 }
 
 \arguments{
@@ -27,11 +25,7 @@
   \item{xlab}{see "?image"}
   \item{ylab}{see "?image"}
   \item{...}{For plot/map: Any argument that can be passed to image.plot(fields) and to image(graphics)} 
-  
-  \item{n}{number of clicks on the map}
-  \item{xy}{show xy coordinates}
-  \item{type}{see under ?locator}
- }
+   }
 \details{
   If \code{subsample=FALSE}, then \code{maxdim} is ingored. Subsampled maps are made by skipping rows and columns. This is always 
   done in a regular pattern (e.g. skip every second row). For this reason, the actual number of pixels when \code{subsample = TRUE}



More information about the Raster-commits mailing list