coordinateGetter: coordinateGetter

Description Usage Arguments Details Value See Also Examples

View source: R/funcs.R

Description

takes an address and returns the coordinates of that point

Usage

1
coordinateGetter(address, key)

Arguments

address

physical address. Works best in this format: 13 Elm Street, Amityville, State, Country. It's most important to get the two last points correct, so either City, Country, or State, Country (since that will give us decent granularity to find the nearest airport)

key

To access the openstreetmap API you need a valid API key. You can get it for free at https://developer.mapquest.com

Details

since we are using the free api with geocode, the matching is approximate, but good enough for our purposes.

Value

returns a data frame of the address, its latitude and its longitude

See Also

geocode

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
if(interactive()){
 library(purrr);library(magrittr)
 addresses <- c("9th Street, Troy, NY, USA", "The Mall, Solan, Himachal Pradesh, India")
 purrr::map_dfr(addresses, ~coordinateGetter(.))

 }

## End(Not run)

DataStrategist/carbonFootprintR documentation built on Dec. 17, 2021, 4:07 p.m.