Geocoding addresses in R

The tidygeocoder package

R
Author

Nick Twort

Published

04 Oct 2023

If you need to geocode addresses (ie, get the longitude and latitude from an address), I’ve had great luck with the tidygeocoder package:

library(tidygeocoder)

addresses <- data.frame(
  address = "250 Northern Avenue, Boston, Massachusetts, 02210 US",
  id = 1L
)

geocode(
    addresses,
    address = address,
    method = "arcgis"
  )
Passing 1 address to the ArcGIS single address geocoder
Query completed in: 1.2 seconds
# A tibble: 1 × 4
  address                                                 id   lat  long
  <chr>                                                <int> <dbl> <dbl>
1 250 Northern Avenue, Boston, Massachusetts, 02210 US     1  42.3 -71.0