Skip to contents

Takes a data frame (typically from nyc_pluto() after filtering and collecting) and converts it to an sf object, with either the lot polygons or points at the lots' approximate locations.

Usage

nyc_pluto_to_sf(df, geometry = c("polygon", "point"), crs = 2263)

Arguments

df

A data frame with a geometry column of WKB (for polygons) or latitude and longitude columns (for points).

geometry

"polygon" (the default) for lot polygons, or "point" for points from latitude and longitude.

crs

Target CRS. Default is EPSG:2263 (NAD83 / New York Long Island, ftUS).

Value

An sf object. Rows without the requested geometry are dropped, with a message.

Examples

if (FALSE) { # \dontrun{
library(dplyr)

nyc_pluto() |>
  filter(borough == "BK", cd == 306) |>
  collect() |>
  nyc_pluto_to_sf()

nyc_pluto() |>
  filter(landuse == "03") |>
  select(bbl, unitsres, latitude, longitude) |>
  collect() |>
  nyc_pluto_to_sf(geometry = "point")
} # }