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

njgeo

R-CMD-check

Tools for geocoding addresses using the State of New Jersey's official geocoding service & accessing spatial data.

Installation

You can install njgeo from CRAN using

install.packages("njgeo")

You can install the development version of njgeo from GitHub with:

# install.packages("devtools")
devtools::install_github("gavinrozzi/njgeo")

Usage

Geocoding

This package supports freely geocoding addresses in New Jersey. No API keys are required and this does not depend on any commercial services.

Find all matching address candidates for an address

geocode_address_candidates("33 Livingston Ave. New Brunswick, NJ")

The geocoding output defaults to EPSG:4326 but another CRS can be specified via arguments:

geocode_address_candidates("33 Livingston Ave. New Brunswick, NJ", crs = 3424)

Batch Geocoding

It is possible to batch geocode up to 1000 addresses at once using the two batch geocoding functions provided by the package.

The batch_geocode_addresses() and batch_geocode_sl() functions can batch geocode up to 1000 addresses at a time. The first function expects multiple columns of data to geocode the address, while the sl version requires an address in single column format.

Reverse Geocoding

Provide a point to get matching addresses:

point <- st_point(c(-74.44513, 40.49297))

reverse_geocode(point)

Shape and boundary files

You can easily obtain spatial boundary data for use in projects via this package. All objects are returned as an {sf} object and a coordinate reference system can be specified via arguments to repoject the shape into a different CRS.

State

get_state_bounds()

Counties

get_county_bounds()

Municipalities

get_muni_bounds()


gavinrozzi/njgeo documentation built on Feb. 10, 2024, 11:40 a.m.