identify.Map {TeachingDemos}R Documentation

Identify polygons within a plotted map from the maptools packages.

Description

This function allows you to click in a polygon in a map plotted using the maptools package and labels the polygon.

Usage

identify.Map(x, labels = as.character(Map$att.data$NAME), n = Inf, ...)

identify.polylist(...)

Arguments

x The map object plotted using plot.Map.
labels Vector of labels used to label the polygons.
n Maximum number of polygons to label.
... Additional arguments passed to identify.Map or text.

Details

The function identify.polylist is just a wrapper function for identify.Map which handles both types of data.

The point you click on is checked against every polygon in the map, so this function may be slow on very complicated maps.

Right click on the map to stop before n.

Value

A vector of integers corresponding to the polygons clicked on.

Note

These functions are beta level at best and will probably soon be seperceeded by functions in maptools, sp, or spproj. The plot.Map function has been depricated so use plot.polylist instead (convert Map objects to polylist objects before plotting), identify.Map works on polylist objects as well.

Author(s)

Greg Snow greg.snow@intermountainmail.org

See Also

plot.Map in the maptools package, identify

Examples

## Not run: 
library(maptools)
plot(state.vbm)
identify(state.vbm) # now click on the map a few times.

plot(state.vbm)
identify(state.vbm, state.abb, n=5)
## End(Not run)

[Package TeachingDemos version 1.4 Index]