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 |
Batch geocode addresses
batch_geocode_addresses(df, id, street, city, state, zip, crs = 4326)
batch_geocode_addresses(df, id, street, city, state, zip, crs = 4326)
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 |
an sf object containing geocoding results
Batch geocode addresses in single line format
batch_geocode_sl(df, id, address, crs = 4326)
batch_geocode_sl(df, id, address, crs = 4326)
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 |
a dataframe containing geocoding results
Geocode an address and retrieve all candidates using the NJOGIS ArcGIS REST API
geocode_address_candidates( address = NULL, address2 = NULL, address3 = NULL, city = NULL, zip = NULL, max_results = NULL, crs = 4326 )
geocode_address_candidates( address = NULL, address2 = NULL, address3 = NULL, city = NULL, zip = NULL, max_results = NULL, crs = 4326 )
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 |
an sf object with geocoded address candidates for a single address
geocode_address_candidates(address = "33 Livingston Ave", city = "New Brunswick")
geocode_address_candidates(address = "33 Livingston Ave", city = "New Brunswick")
Download county boundaries
get_county_bounds(crs = 4326)
get_county_bounds(crs = 4326)
crs |
coordinate reference system code. This is passed to |
an sf object with boundaries for New Jersey counties
Download municipal boundaries
get_muni_bounds(crs = 4326)
get_muni_bounds(crs = 4326)
crs |
coordinate reference system code. This is passed to |
an sf object with boundaries for all New Jersey municipalities
Download state boundaries
get_state_bounds(crs = 4326)
get_state_bounds(crs = 4326)
crs |
coordinate reference system code. This is passed to |
an sf object with boundaries for the State of New Jersey
Reverse geocode a set of coordinates, an 'sf' point, or an 'sfc' point
reverse_geocode(input, distance = NULL, crs = 4326)
reverse_geocode(input, distance = NULL, crs = 4326)
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. |
Dataframe with place name and address corresponding to coordinates.
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)
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)