tmaptools (version 1.0)

rev_geocode_OSM: Reverse geocodes a location using OpenStreetMap Nominatim

Description

Reverse geocodes a location (based on spatial coordinates) to an address. It uses OpenStreetMap Nominatim. For processing large amount of queries, please read the usage policy (http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy).

Usage

rev_geocode_OSM(x, y = NULL, zoom = NULL, projection = NULL, as.data.frame = NA, server = "http://nominatim.openstreetmap.org")

Arguments

x
x coordinate(s), or a SpatialPoints object
y
y coordinate(s)
zoom
zoom level
projection
projection in which the coordinates x and y are provided. Either a CRS object or a character value. If it is a character, it can either be a PROJ.4 character string or a shortcut. See get_proj4 for a list of shortcut values. By default latitude longitude coordinates.
as.data.frame
return as data.frame (TRUE) or list (FALSE). By default a list, unless multiple coordinates are provided.
server
OpenStreetMap Nominatim server name. Could also be a local OSM Nominatim server.

Value

A data frmame with all atributes that are contained in the search result

See Also

geocode_OSM

Examples

Run this code
## Not run: 
# if (require(tmap)) {
#     data(metro)
# 
#     # sample five cities from metro dataset
#     five_cities <- metro[sample(length(metro), 5), ]
# 
#     # obtain reverse geocode address information
#     addresses <- rev_geocode_OSM(five_cities, zoom = 6)
#     five_cities <- append_data(five_cities, addresses, fixed.order = TRUE)
# 
#     # change to interactive mode
#     current.mode <- tmap_mode("view")
#     tm_shape(five_cities) +
#     	tm_markers(text="city")
# 
#     # restore current mode
#     tmap_mode(current.mode)
# }
# ## End(Not run)

Run the code above in your browser using DataLab