location

Minimal geocoding for R via Nominatim (OpenStreetMap). No API key required.

Installation

# pak::pak("hypertidy/location")
install.packages("location", repos = c('https://hypertidy.r-universe.dev', 'https://cloud.r-project.org'))

Usage

library(location)

# Single place
loc("Hobart, Tasmania")
#>        lon       lat                                        name
#> 1 147.3281 -42.88251 Hobart, City of Hobart, Tasmania, Australia
#>              query osm_type
#> 1 Hobart, Tasmania relation

# Multiple places - one request per second (Nominatim policy)
loc(c("Davis Station, Antarctica", "Casey Station", "Mawson Station"))
#>         lon       lat           name                     query osm_type
#> 1        NA        NA           <NA> Davis Station, Antarctica     <NA>
#> 2 110.52408 -66.28209  Casey Station             Casey Station     node
#> 3  62.87375 -67.60290 Mawson Station            Mawson Station     node

# Straight to timezone (requires lutz)
loc_tz("Crystal Lake, TN")
#> [1] "America/New_York"

loc_tz(c("Hobart", "McMurdo Station", "Rothera"))
#> [1] "Australia/Hobart"   "Antarctica/McMurdo" "Antarctica/Rothera"

Design

Used by

Dependencies

Code of Conduct

Please note that the location project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.