knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

citygeocoder

A simple and fast city-level geocoder and reverse geocoder for the US...

Installation

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("cjtexas/citygeocoder")

Examples

  1. Geocode
library(citygeocoder)

citygeocoder::geocode("Austin", "TX")
  1. Reverse Geocode
library(citygeocoder)

citygeocoder::reverse_geocode(lon = -98.7654321, lat = 34.56789)
  1. Batch Mode!
df1 <-
  read.table(
    text =
    "City       | State
    Scranton    | PA
    Oakland     | CA
    New York    | NY
    Columbus    | IN",
    header = T,
    sep = "|",
    stringsAsFactors = FALSE,
    strip.white = TRUE
  )

citygeocoder::geocode(df1$City, df1$State)

df2 <-
  read.table(
    text =
      "Lon    | Lat
    -95.55555 | 37.77777  
    -96.66666 | 36.66666
    -97.77777 | 35.55555  
    -98.88888 | 34.44444
    -99.99999 | 33.33333",
    header = T,
    sep = "|",
    stringsAsFactors = FALSE,
    strip.white = TRUE
  )

reverse_geocode(df2$Lon, df2$Lat)
  1. I've also included an example Shiny App that demonstrates the Package's functions - NOTE: Requires Additional Packages (leaflet, shiny, shinydashboard)

citygeocoder:::shiny_example()



cjtexas/citygeocoder documentation built on July 17, 2025, 12:05 a.m.