{"id":13400515,"url":"https://github.com/jessecambon/tidygeocoder","last_synced_at":"2025-07-21T20:02:44.507Z","repository":{"id":35397198,"uuid":"209649346","full_name":"jessecambon/tidygeocoder","owner":"jessecambon","description":"Geocoding Made Easy","archived":false,"fork":false,"pushed_at":"2024-04-06T14:25:19.000Z","size":19960,"stargazers_count":283,"open_issues_count":18,"forks_count":20,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-09-20T07:36:05.330Z","etag":null,"topics":["geocoding","r","rspatial","rstats","tidyverse"],"latest_commit_sha":null,"homepage":"https://jessecambon.github.io/tidygeocoder","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jessecambon.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-19T21:11:45.000Z","updated_at":"2024-08-31T15:57:32.000Z","dependencies_parsed_at":"2024-06-21T16:41:53.810Z","dependency_job_id":"d46a2a18-7238-48e1-ab0b-5fbb094035fa","html_url":"https://github.com/jessecambon/tidygeocoder","commit_stats":{"total_commits":650,"total_committers":11,"mean_commits":59.09090909090909,"dds":0.3338461538461538,"last_synced_commit":"bd517945827cf6fd949fdee76f6d6d42ee3a0648"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessecambon%2Ftidygeocoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessecambon%2Ftidygeocoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessecambon%2Ftidygeocoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessecambon%2Ftidygeocoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jessecambon","download_url":"https://codeload.github.com/jessecambon/tidygeocoder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221440193,"owners_count":16821599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geocoding","r","rspatial","rstats","tidyverse"],"created_at":"2024-07-30T19:00:52.833Z","updated_at":"2025-07-21T20:02:44.476Z","avatar_url":"https://github.com/jessecambon.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file directly and reknit --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  fig.width = 8,\n  fig.height = 5,\n  fig.align = 'center'\n)\noptions(tibble.print_min = 5, tibble.print_max = 5)\n```\n\n# tidygeocoder\u003ca href='https://jessecambon.github.io/tidygeocoder/'\u003e\u003cimg src=\"man/figures/tidygeocoder_hex.png\" alt=\"Tidygeocoder R Package hex logo\" align=\"right\" width=\"150\"/\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![JOSS](https://joss.theoj.org/papers/10.21105/joss.03544/status.svg)](https://doi.org/10.21105/joss.03544)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jessecambon/tidygeocoder/blob/master/LICENSE.md)\n[![CRAN](https://www.r-pkg.org/badges/version/tidygeocoder)](https://cran.r-project.org/package=tidygeocoder)\n[![CRAN Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/tidygeocoder)](https://CRAN.R-project.org/package=tidygeocoder)\n[![CRAN Downloads Per Month](http://cranlogs.r-pkg.org/badges/tidygeocoder)](https://cran.r-project.org/package=tidygeocoder)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![R Build Status](https://github.com/jessecambon/tidygeocoder/workflows/R-CMD-check/badge.svg)](https://github.com/jessecambon/tidygeocoder/actions?workflow=R-CMD-check)\n[![Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.15106058.svg)](https://doi.org/10.5281/zenodo.15106058)\n\u003c!-- badges: end --\u003e\n\nTidygeocoder 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.\n\nNote 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).\n\n**Features:**\n\n- Forward geocoding (addresses ⮕ coordinates)\n- Reverse geocoding (coordinates ⮕ addresses)\n- Batch geocoding (geocoding multiple addresses or coordinates in a single query) is automatically used if applicable.\n- 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.\n- The maximum rate of querying is automatically set according to the usage policies of the selected geocoding service.\n\nIn 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).\n\n## Installation\n\nTo install the stable version from CRAN (the official R package servers):\n\n```{r, eval = FALSE}\ninstall.packages('tidygeocoder')\n```\n\nAlternatively, you can install the latest development version from GitHub:\n\n```{r, eval = FALSE}\ndevtools::install_github(\"jessecambon/tidygeocoder\")\n```\n\n## Usage\n\nIn this first example we will geocode a few addresses using the `geocode()` function and plot them on a map with ggplot.\n\n```{r}\nlibrary(dplyr, warn.conflicts = FALSE)\nlibrary(tidygeocoder)\n\n# create a dataframe with addresses\nsome_addresses \u003c- tibble::tribble(\n~name,                  ~addr,\n\"White House\",          \"1600 Pennsylvania Ave NW, Washington, DC\",\n\"Transamerica Pyramid\", \"600 Montgomery St, San Francisco, CA 94111\",     \n\"Willis Tower\",         \"233 S Wacker Dr, Chicago, IL 60606\"                                  \n)\n\n# geocode the addresses\nlat_longs \u003c- some_addresses %\u003e%\n  geocode(addr, method = 'osm', lat = latitude , long = longitude)\n```\n\nThe `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.\n\n```{r, echo = FALSE}\nknitr::kable(lat_longs)\n```\n\nNow that we have the longitude and latitude coordinates, we can use ggplot to plot our addresses on a map.\n\n```{r usamap, fig.cap = \"A map of the United States with the places of interest mentioned above plotted on top of it.\"}\nlibrary(ggplot2)\n\nggplot(lat_longs, aes(longitude, latitude), color = \"grey99\") +\n  borders(\"state\") + geom_point() +\n  ggrepel::geom_label_repel(aes(label = name)) +\n  theme_void()\n```\n\nTo 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. \n\nThe 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.\n\n\u003c!-- \nRemoving the licence column is done just to prevent a note from \noccurring in automated CRAN checks for an improper/old link.\n--\u003e\n```{r}\nreverse \u003c- lat_longs %\u003e%\n  reverse_geocode(lat = latitude, long = longitude, method = 'osm',\n                  address = address_found, full_results = TRUE) %\u003e%\n  select(-addr, -licence)\n```\n\n```{r, echo = FALSE}\nknitr::kable(reverse)\n```\n\n## In the Wild\n\nFor inspiration, here are a few articles (with code) that leverage tidygeocoder:\n\n- [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\n- [Geocoding the Minard Map](https://www.jla-data.net/eng/minard-map-tidygeocoder/) - recreating a famous infographic with geocoding\n- [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\n- [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\n- [Road Routing in R](https://www.jla-data.net/eng/routing-in-r-context/) - demonstration of three different routing APIs\n- [Mapping Texas Ports With R](https://www.sharpsightlabs.com/blog/mapping-texas-ports-with-r-part1/) - mapping the Texas coast with rnaturalearth and sf\n\n## Contributing\n\nContributions 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.\n\n## Citing tidygeocoder\n\nUse the `citation()` function:\n\n``` r\ncitation('tidygeocoder')\n```\n\n\u003c/br\u003e\n\n\u003cblockquote\u003e\n```{r, comment = '', echo = FALSE}\ncitation('tidygeocoder')\n```\n\u003c/blockquote\u003e\n\nOr refer to the [citation page](https://jessecambon.github.io/tidygeocoder/authors.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessecambon%2Ftidygeocoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjessecambon%2Ftidygeocoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessecambon%2Ftidygeocoder/lists"}