Description Usage Arguments Value Note Author(s) See Also
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).
1 2 3 4 5 |
x |
Raster*, or Spatial* object (or missing) |
n |
number of clicks on the map |
id |
Logical. If |
xy |
Logical. If |
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 |
The value(s) of object
at the point(s) clicked on; and the coordinates of the center of the cell if xy==TRUE
.
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.
Robert J. Hijmans
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.