Learn R Programming

mapsapi (version 0.5.4)

mp_get_points: Extract geocoded points from Google Maps Geocode API response

Description

Extract geocoded points from Google Maps Geocode API response

Usage

mp_get_points(doc, all_results = FALSE)

Value

sf Point layer representing geocoded locations

Arguments

doc

XML document with Google Maps Geocode API response

all_results

The geocoder may return several results when address queries are ambiguous. Should all results be returned (TRUE), or just the first one (FALSE, default)?

Examples

Run this code
library(xml2)
doc = list("Tel-Aviv" = as_xml_document(response_geocode))
pnt = mp_get_points(doc)
if (FALSE) {
key = readLines("~/key")
doc = mp_geocode(addresses = c("Rehovot", "Beer-Sheva", "New-York"), key = key)
pnt = mp_get_points(doc)
}

Run the code above in your browser using DataLab