tidygeocoder

tidygeocoder: An R package for geocoding - Published in JOSS (2021)

https://github.com/jessecambon/tidygeocoder

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    1 of 9 committers (11.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

geocoding r rspatial rstats tidyverse
Last synced: 6 months ago · JSON representation

Repository

Geocoding Made Easy

Basic Info
Statistics
  • Stars: 294
  • Watchers: 5
  • Forks: 21
  • Open Issues: 20
  • Releases: 9
Topics
geocoding r rspatial rstats tidyverse
Created over 6 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.width = 8,
  fig.height = 5,
  fig.align = 'center'
)
options(tibble.print_min = 5, tibble.print_max = 5)
```

# tidygeocoderTidygeocoder R Package hex logo


[![JOSS](https://joss.theoj.org/papers/10.21105/joss.03544/status.svg)](https://doi.org/10.21105/joss.03544)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jessecambon/tidygeocoder/blob/master/LICENSE.md)
[![CRAN](https://www.r-pkg.org/badges/version/tidygeocoder)](https://cran.r-project.org/package=tidygeocoder)
[![CRAN Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/tidygeocoder)](https://CRAN.R-project.org/package=tidygeocoder)
[![CRAN Downloads Per Month](http://cranlogs.r-pkg.org/badges/tidygeocoder)](https://cran.r-project.org/package=tidygeocoder)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![R Build Status](https://github.com/jessecambon/tidygeocoder/workflows/R-CMD-check/badge.svg)](https://github.com/jessecambon/tidygeocoder/actions?workflow=R-CMD-check)
[![Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.15106058.svg)](https://doi.org/10.5281/zenodo.15106058)


Tidygeocoder makes getting data from geocoding services easy. A unified high-level interface is provided for a selection of [supported geocoding services](https://jessecambon.github.io/tidygeocoder/articles/geocoder_services.html) and results are returned in [tibble](https://tibble.tidyverse.org/) (dataframe) format.

Note that you should exercise due diligence when geocoding sensitive data as tidygeocoder utilizes third party web services to perform geocoding. Refer to the documentation on your selected geocoding service for information on how your data will be utilized and stored. See further information on this subject [here](https://jessecambon.github.io/tidygeocoder/articles/geocoder_services.html#data-privacy).

**Features:**

- Forward geocoding (addresses ⮕ coordinates)
- Reverse geocoding (coordinates ⮕ addresses)
- Batch geocoding (geocoding multiple addresses or coordinates in a single query) is automatically used if applicable.
- Duplicate, NA, and blank input data is handled elegantly; only unique inputs are submitted in queries, but the rows in the original data are preserved by default.
- The maximum rate of querying is automatically set according to the usage policies of the selected geocoding service.

In addition to the usage examples below, see the [Getting Started Vignette](https://jessecambon.github.io/tidygeocoder/articles/tidygeocoder.html) and [blog posts on tidygeocoder](https://jessecambon.github.io/tag/tidygeocoder).

## Installation

To install the stable version from CRAN (the official R package servers):

```{r, eval = FALSE}
install.packages('tidygeocoder')
```

Alternatively, you can install the latest development version from GitHub:

```{r, eval = FALSE}
devtools::install_github("jessecambon/tidygeocoder")
```

## Usage

In this first example we will geocode a few addresses using the `geocode()` function and plot them on a map with ggplot.

```{r}
library(dplyr, warn.conflicts = FALSE)
library(tidygeocoder)

# create a dataframe with addresses
some_addresses <- tibble::tribble(
~name,                  ~addr,
"White House",          "1600 Pennsylvania Ave NW, Washington, DC",
"Transamerica Pyramid", "600 Montgomery St, San Francisco, CA 94111",     
"Willis Tower",         "233 S Wacker Dr, Chicago, IL 60606"                                  
)

# geocode the addresses
lat_longs <- some_addresses %>%
  geocode(addr, method = 'osm', lat = latitude , long = longitude)
```

The `geocode()` function geocodes addresses contained in a dataframe. The [Nominatim ("osm")](https://nominatim.org/) geocoding service is used here, but other services can be specified with the `method` argument. Only latitude and longitude are returned from the geocoding service in this example, but `full_results = TRUE` can be used to return all of the data from the geocoding service. See the `geo()` function documentation for details.

```{r, echo = FALSE}
knitr::kable(lat_longs)
```

Now that we have the longitude and latitude coordinates, we can use ggplot to plot our addresses on a map.

```{r usamap, fig.cap = "A map of the United States with the places of interest mentioned above plotted on top of it."}
library(ggplot2)

ggplot(lat_longs, aes(longitude, latitude), color = "grey99") +
  borders("state") + geom_point() +
  ggrepel::geom_label_repel(aes(label = name)) +
  theme_void()
```

To perform reverse geocoding (obtaining addresses from geographic coordinates), we can use the `reverse_geocode()` function. The arguments are similar to the `geocode()` function, but now we specify the input data columns with the `lat` and `long` arguments. The  input dataset used here is the results of the geocoding query above. 

The single line address is returned in a column named by the `address` argument and all columns from the geocoding service results are returned because `full_results = TRUE`. See the `reverse_geo()` function documentation for more details.


```{r}
reverse <- lat_longs %>%
  reverse_geocode(lat = latitude, long = longitude, method = 'osm',
                  address = address_found, full_results = TRUE) %>%
  select(-addr, -licence)
```

```{r, echo = FALSE}
knitr::kable(reverse)
```

## In the Wild

For inspiration, here are a few articles (with code) that leverage tidygeocoder:

- [Exercises: Spatial Data Wrangling with sf](http://www2.stat.duke.edu/courses/Spring21/sta323.001/exercises/lec_12.html) - part of a [statistical computing course](http://www2.stat.duke.edu/courses/Spring21/sta323.001/) at Duke
- [Geocoding the Minard Map](https://www.jla-data.net/eng/minard-map-tidygeocoder/) - recreating a famous infographic with geocoding
- [Mapping a network of women in demography](https://www.monicaalexander.com/posts/2021-21-02-mapping/) - using rvest and tidygeocoder to map Google Scholar data
- [Mapping Routes](https://bensstats.wordpress.com/2021/10/21/robservations-15-i-reverse-engineered-atlas-co-well-some-of-it/) - mapping routes with tidygeocoder and osrm
- [Road Routing in R](https://www.jla-data.net/eng/routing-in-r-context/) - demonstration of three different routing APIs
- [Mapping Texas Ports With R](https://www.sharpsightlabs.com/blog/mapping-texas-ports-with-r-part1/) - mapping the Texas coast with rnaturalearth and sf

## Contributing

Contributions to the tidygeocoder package are welcome. File [an issue](https://github.com/jessecambon/tidygeocoder/issues) for bug fixes or suggested features. If you would like to contribute code such as adding support for a new geocoding service, reference the [developer notes](https://jessecambon.github.io/tidygeocoder/articles/developer_notes.html) for instructions and documentation.

## Citing tidygeocoder

Use the `citation()` function:

``` r
citation('tidygeocoder')
```


```{r, comment = '', echo = FALSE} citation('tidygeocoder') ```
Or refer to the [citation page](https://jessecambon.github.io/tidygeocoder/authors.html).

Owner

  • Name: Jesse Cambon
  • Login: jessecambon
  • Kind: user
  • Location: Boston, MA
  • Company: Lighthouse

JOSS Publication

tidygeocoder: An R package for geocoding
Published
September 09, 2021
Volume 6, Issue 65, Page 3544
Authors
Jesse Cambon ORCID
Independent Researcher
Diego Hernangómez ORCID
Independent Researcher
Christopher Belanger ORCID
Independent Researcher
Daniel Possenriede ORCID
Independent Researcher
Editor
Jayaram Hariharan ORCID
Tags
geocoding geospatial

GitHub Events

Total
  • Issues event: 4
  • Watch event: 11
  • Delete event: 1
  • Issue comment event: 11
  • Push event: 16
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2
Last Year
  • Issues event: 4
  • Watch event: 11
  • Delete event: 1
  • Issue comment event: 11
  • Push event: 16
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 666
  • Total Committers: 9
  • Avg Commits per committer: 74.0
  • Development Distribution Score (DDS): 0.249
Past Year
  • Commits: 16
  • Committers: 1
  • Avg Commits per committer: 16.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jesse Cambon j****n@g****m 500
dieghernan d****o@g****m 60
Jesse Cambon c****e@b****m 35
Jesse Cambon j****n@l****m 34
Daniel Possenriede p****e@g****m 16
twesleyb t****w@d****u 10
twesleyb t****0@g****m 6
ottothecow o****w@g****m 3
Christopher Belanger c****r@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 52
  • Total pull requests: 60
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 35
  • Total pull request authors: 4
  • Average comments per issue: 3.27
  • Average comments per pull request: 0.18
  • Merged pull requests: 59
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: 3 minutes
  • Average time to close pull requests: 3 days
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jessecambon (13)
  • dieghernan (2)
  • mikedolanfliss (2)
  • werkstattcodes (2)
  • ottothecow (2)
  • jonathancallahan (2)
  • groliver-pcci (1)
  • long39ng (1)
  • zozotintin (1)
  • hbnsarah (1)
  • mathesong (1)
  • Chris-Larkin (1)
  • MatthewCaseres (1)
  • simonheb (1)
  • davidkreitmeir (1)
Pull Request Authors
  • jessecambon (48)
  • dieghernan (6)
  • dpprdan (5)
  • ottothecow (1)
Top Labels
Issue Labels
enhancement (18) bug (17) help wanted (5)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 5,856 last-month
  • Total docker downloads: 59
  • Total dependent packages: 4
    (may contain duplicates)
  • Total dependent repositories: 16
    (may contain duplicates)
  • Total versions: 19
  • Total maintainers: 1
proxy.golang.org: github.com/jessecambon/tidygeocoder
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: tidygeocoder

Geocoding Made Easy

  • Versions: 9
  • Dependent Packages: 4
  • Dependent Repositories: 15
  • Downloads: 5,856 Last month
  • Docker Downloads: 59
Rankings
Stargazers count: 1.5%
Forks count: 3.5%
Downloads: 6.7%
Dependent repos count: 7.4%
Average: 9.6%
Dependent packages count: 10.9%
Docker downloads count: 27.4%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-tidygeocoder
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Stargazers count: 24.2%
Dependent repos count: 24.4%
Average: 34.0%
Forks count: 36.0%
Dependent packages count: 51.6%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.3.0 depends
  • dplyr * imports
  • httr * imports
  • jsonlite * imports
  • lifecycle * imports
  • progress * imports
  • tibble * imports
  • ggplot2 * suggests
  • ggrepel * suggests
  • knitr * suggests
  • maps * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 3.0.2 suggests
docs/articles/tidygeocoder_files/core-js-2.5.3/package.json npm
  • @babel/cli ^7.7.7 development
  • @babel/core ^7.7.7 development
  • @babel/plugin-proposal-nullish-coalescing-operator ^7.7.4 development
  • @babel/plugin-proposal-optional-catch-binding ^7.7.4 development
  • @babel/plugin-proposal-optional-chaining ^7.7.5 development
  • @babel/plugin-transform-arrow-functions ^7.7.4 development
  • @babel/plugin-transform-block-scoped-functions ^7.7.4 development
  • @babel/plugin-transform-block-scoping ^7.7.4 development
  • @babel/plugin-transform-classes ^7.7.4 development
  • @babel/plugin-transform-computed-properties ^7.7.4 development
  • @babel/plugin-transform-destructuring ^7.7.4 development
  • @babel/plugin-transform-exponentiation-operator ^7.7.4 development
  • @babel/plugin-transform-literals ^7.7.4 development
  • @babel/plugin-transform-member-expression-literals ^7.7.4 development
  • @babel/plugin-transform-parameters ^7.7.7 development
  • @babel/plugin-transform-property-literals ^7.7.4 development
  • @babel/plugin-transform-shorthand-properties ^7.7.4 development
  • @babel/plugin-transform-spread ^7.7.4 development
  • @babel/plugin-transform-template-literals ^7.7.4 development
  • babel-loader ^8.0.6 development
  • babel-plugin-transform-es2015-modules-simple-commonjs ~0.3.0 development
  • babel-plugin-transform-for-of-as-array ^1.1.1 development
  • es-observable git+https://github.com/tc39/proposal-observable.git#bf4d87144b6189e793593868e3c022eb51a7d292 development
  • eslint ^6.8.0 development
  • eslint-import-resolver-webpack ^0.12.0 development
  • eslint-plugin-import ^2.19.1 development
  • eslint-plugin-node ^10.0.0 development
  • eslint-plugin-optimize-regex ^1.1.7 development
  • eslint-plugin-qunit ^4.0.0 development
  • eslint-plugin-sonarjs ^0.5.0 development
  • eslint-plugin-unicorn ^15.0.0 development
  • grunt ^1.0.4 development
  • grunt-cli ^1.3.2 development
  • grunt-contrib-clean ^2.0.0 development
  • grunt-contrib-copy ^1.0.0 development
  • grunt-contrib-uglify ^4.0.1 development
  • grunt-karma ^3.0.2 development
  • grunt-webpack ^3.1.3 development
  • karma ^4.4.1 development
  • karma-chrome-launcher ^3.1.0 development
  • karma-phantomjs-launcher ~1.0.4 development
  • karma-qunit ^4.0.0 development
  • lerna ^3.19.0 development
  • moon-unit ^0.2.2 development
  • phantomjs-prebuilt ~2.1.16 development
  • promises-aplus-tests ^2.1.2 development
  • puppeteer ~2.0.0 development
  • qunit ~2.9.3 development
  • webpack ^4.41.4 development
.github/workflows/check-standard.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite