click: Click on a map

Description Usage Arguments Value Note Author(s) See Also

Description

Click on a map (plot) to get values of a SpatialPolygons object at that location.

For SpatialPoints* and SpatialLines* objects, you need to click twice (draw a rectangle).

Usage

1
2
3
4
5
## S4 method for signature 'SpatialPolygons'
click(x, n=1, id=FALSE, xy=FALSE, type = "n", ...)

## S4 method for signature 'SpatialPoints'
click(x, ...)

Arguments

x

Raster*, or Spatial* object (or missing)

n

number of clicks on the map

id

Logical. If TRUE, a numeric ID is shown on the map that corresponds to the row number of the output

xy

Logical. If TRUE, xy coordinates are included in the output

type

One of "n", "p", "l" or "o". If "p" or "o" the points are plotted; if "l" or "o" they are joined by lines. See ?locator

...

additional graphics parameters used if type != "n" for plotting the locations. See ?locator

Value

The value(s) of object at the point(s) clicked on; and the coordinates of the center of the cell if xy==TRUE.

Note

The plot only provides the coordinates (xy pair), the values are read from the Raster* object that is passed as an argument. Thus you can extract values for an object that is not plotted, as long as it shares the coordinate system (CRS) with the layer that is plotted.

Unless the process is terminated prematurely values at at most n positions are determined. The identification process can be terminated by clicking the second mouse button and selecting 'Stop' from the menu, or from the 'Stop' menu on the graphics window.

Author(s)

Robert J. Hijmans

See Also

select, drawExtent


geovec documentation built on May 2, 2019, 6:15 p.m.