The boxgooglemap package is connected with the google geocode API to convert location and coordination by two function:

package httr is required to be installed

Functions

address

The 'address' function retrive the address of a given coordinate. The funtion uses the google geocode API to retrieve the result.

The input latlong is a character string that includes the latitude and the longitude.

The function returns a dataframe cointaining full address names as well as the coordinates:

library(boxgooglemap)
head(address("41.40450 76"), n = 5)
tail(address("67 115"), n = 5)

coord

The 'coord' function is a function that provides the user with the coordinates of a given address. The function uses the google geocode API to retrieve the result.

Please input address, a character string that includes address components.

If the address has partial match, different locations with their full names and coordinates will be retrieved as a dataframe:

library(boxgooglemap)
coord("chang sha, china")

coord("milan")


boxizhang/boxgooglemap documentation built on May 7, 2019, 2:54 a.m.