nyc_point_poly: Find which administrative districts a set of points are...

Description Usage Arguments Details Value Examples

Description

Point-in-polygon operation for NYC administrative boundaries. Use nyc_point_poly() on a set of points to determine which administrative district each point lies within.

Usage

1
2
nyc_point_poly(points, geography = c("borough", "puma", "nta", "cd",
  "tract", "block", "school", "police", "council", "cong"))

Arguments

points

An sf object containing only point features.

geography

A character vector of administrative boundaries to append to points. Possible values are "borough", "puma", "cd", "nta", "school", "council", "police", "cong", "tract" and "block". If more than one geography is selected, names and codes for each geography is appended.

Details

Using nyc_point_poly() requires installing the sf package.

Value

An sf object of point features with administrative district names and and codes appended.

Examples

1
2
3
4
5
6
7
if (require(sf)) {

  # generate 100 random points in nyc
  points <- st_sf(geometry = st_sample(nyc_boundaries(), 100))

  nyc_point_poly(points = points, geography = c("borough", "nta", "cd"))
}

mfherman/nycgeo documentation built on May 3, 2019, 1:34 p.m.