map.where {maps}R Documentation

Locate points on a map

Description

Returns the region names containing given locations.

Usage

map.where(database = "world", x, y)

Arguments

database character string naming a geographical database, or a list of x, y, and names. See the documentation for map for more details.
x vector of longitudes.
y vector of latitudes.

Value

A list of character strings, naming the map region that each (longitude, latitude) pair falls into.

Note

Because maps are currently organized as flat files, this function can be slow.

Author(s)

Tom Minka

See Also

in.polygon

Examples

# NYC
map.where("state", -73.8, 41)
# Auckland
map.where("nz", 174.6, -36.92)
# find both in the world (takes a while)
map.where(x = c(174.6, -73.8), y = c(-36.92, 41))
# with a map object:
m = map("state", "new york", fill = TRUE, plot = FALSE)
map.where(m, -73.8, 41)

[Package maps version 2.0-35 Index]