Package 'njgeo'

Title: Tools for Geocoding Addresses in New Jersey using the 'NJOGIS' API
Description: Provides an R interface to free geocoding REST APIs maintained by the New Jersey Office of GIS <https://njgin.nj.gov/njgin/edata/geocoding/index.html#!/> and commonly used shapefiles.
Authors: Gavin Rozzi [aut, cre]
Maintainer: Gavin Rozzi <[email protected]>
License: GPL (>= 3)
Version: 0.2.0
Built: 2025-02-25 06:02:05 UTC
Source: https://github.com/gavinrozzi/njgeo

Help Index


Batch geocode addresses

Description

Batch geocode addresses

Usage

batch_geocode_addresses(df, id, street, city, state, zip, crs = 4326)

Arguments

df

dataframe with addresses to be geocoded

id

primary key that uniquely identifies rows

street

street address column

city

city column

state

state column

zip

zip code column, expects a 5-digit zip code

crs

coordinate reference system to use for output

Value

an sf object containing geocoding results


Batch geocode addresses in single line format

Description

Batch geocode addresses in single line format

Usage

batch_geocode_sl(df, id, address, crs = 4326)

Arguments

df

dataframe with addresses to be geocoded

id

primary key that uniquely identifies rows

address

street address column

crs

coordinate reference system to use for output

Value

a dataframe containing geocoding results


Geocode an address and retrieve all candidates using the NJOGIS ArcGIS REST API

Description

Geocode an address and retrieve all candidates using the NJOGIS ArcGIS REST API

Usage

geocode_address_candidates(
  address = NULL,
  address2 = NULL,
  address3 = NULL,
  city = NULL,
  zip = NULL,
  max_results = NULL,
  crs = 4326
)

Arguments

address

First line of address. Don't use the other address arguments if geocoding a single line address

address2

Second line of address

address3

Third line of address

city

Name of city or municipality

zip

5-digit ZIP code of city

max_results

Max number of address candidates to return

crs

Four digit coordinate reference system code. Defaults to 4326, 3424 and 4269 are also supported

Value

an sf object with geocoded address candidates for a single address

Examples

geocode_address_candidates(address = "33 Livingston Ave", city = "New Brunswick")

Download county boundaries

Description

Download county boundaries

Usage

get_county_bounds(crs = 4326)

Arguments

crs

coordinate reference system code. This is passed to sf::st_transform()

Value

an sf object with boundaries for New Jersey counties


Download municipal boundaries

Description

Download municipal boundaries

Usage

get_muni_bounds(crs = 4326)

Arguments

crs

coordinate reference system code. This is passed to sf::st_transform()

Value

an sf object with boundaries for all New Jersey municipalities


Download state boundaries

Description

Download state boundaries

Usage

get_state_bounds(crs = 4326)

Arguments

crs

coordinate reference system code. This is passed to sf::st_transform()

Value

an sf object with boundaries for the State of New Jersey


Reverse geocode a set of coordinates, an 'sf' point, or an 'sfc' point

Description

Reverse geocode a set of coordinates, an 'sf' point, or an 'sfc' point

Usage

reverse_geocode(input, distance = NULL, crs = 4326)

Arguments

input

Either a 2-element numeric vector (longitude, latitude), an 'sf' point object, or an 'sfc' object.

distance

Max distance to search around coordinates (in feet). Default is NULL.

crs

Coordinate reference system code of points. Default is 4326.

Value

Dataframe with place name and address corresponding to coordinates.

Examples

reverse_geocode(c(-74.44513, 40.49297)) # Using longitude and latitude
# Or using an sf point object:
library(sf)
point_sf <- st_sfc(st_point(c(-74.44513, 40.49297)), crs = 4326)
reverse_geocode(point_sf)
# Or using an sfc object:
point_sfc <- st_point(c(-74.44513, 40.49297))
reverse_geocode(point_sfc)