https://github.com/jrosell/rreversegeocoder
The goal of rreversegeocoder is to, given latitude and longitude, find the nearest city.
https://github.com/jrosell/rreversegeocoder
geocoder geocoding geonames r r-geocoding-geocoder reverse-geocoding
Last synced: 7 days ago
JSON representation
The goal of rreversegeocoder is to, given latitude and longitude, find the nearest city.
- Host: GitHub
- URL: https://github.com/jrosell/rreversegeocoder
- Owner: jrosell
- License: cc-by-4.0
- Created: 2023-02-14T18:25:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-07T10:03:47.000Z (8 months ago)
- Last Synced: 2025-06-07T10:27:55.568Z (8 months ago)
- Topics: geocoder, geocoding, geonames, r, r-geocoding-geocoder, reverse-geocoding
- Language: R
- Homepage: https://jrosell.github.io/rreversegeocoder/
- Size: 688 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# rreversegeocoder
The goal of rreversegeocoder is to, given latitude and longitude, find
the nearest city in US.
Why? We get new features for feature engineering that can improve the
performance of machine learning models.
## Installation
You can install the development version of rreversegeocoder from
[GitHub](https://github.com/jrosell/rreversegeocoder) with:
``` r
pak::pak("jrosell/rreversegeocoder")
```
## Example
This is a basic example which shows you how to get all the geoname
information from a given latitude and longitude in US:
``` r
library(tidyverse)
library(tidymodels)
library(rreversegeocoder)
cites <- download_cities_with_population_5000()
input <- tribble(
~latitude, ~longitude,
34.6, -120,
34.1, -100
)
output <- input |>
bind_cols(reverse_geocoder_us_cities_with_population_5000(input)) |>
left_join(cites, by = "geonameid")
glimpse(output)
```
Rows: 2
Columns: 21
$ latitude 34.6, 34.1
$ longitude -120, -100
$ geonameid "5397059", "4739078"
$ name "Solvang", "Vernon"
$ asciiname "Solvang", "Vernon"
$ alternatenames "Solvang,Solvang i California,Solvanq,Solveng,solbhya…
$ geoname_latitude 34.59582, 34.15536
$ geoname_longitude -120.13765, -99.26628
$ feature_class "P", "P"
$ feature "PPL", "PPLA2"
$ country "US", "US"
$ cc2 NA, NA
$ admin1 "CA", "TX"
$ admin2 "083", "487"
$ admin3 NA, NA
$ admin4 NA, NA
$ population 5741, 10573
$ elevation 154, 361
$ dem 152, 361
$ timezone "America/Los_Angeles", "America/Chicago"
$ mdate 2017-03-09, 2017-03-09