## ----echo = FALSE-------------------------------------------------------------
example <- paste0(
  rprojroot::find_package_root_file(),
  "/inst/examples/deckgl-api-reference/polygon-layer.R"
)
do.call(knitr::read_chunk, list(path = example))

## ----polygon-layer, eval = FALSE----------------------------------------------
#  sample_data <- paste0(
#    "https://raw.githubusercontent.com/",
#    "uber-common/deck.gl-data/",
#    "master/website/sf-zipcodes.json"
#  )
#  
#  properties <- list(
#    pickable = TRUE,
#    stroked = TRUE,
#    filled = TRUE,
#    wireframe = TRUE,
#    lineWidthMinPixels = 1,
#    getPolygon = ~contour,
#    getElevation = JS("d => d.population / d.area / 10"),
#    getFillColor = JS("d => [d.population / d.area / 60, 140, 0]"),
#    getLineColor = c(80, 80, 80),
#    getLineWidth = 1,
#    getTooltip = JS("object => `${object.zipcode}<br/>Population: ${object.population}`")
#  )
#  
#  deck <- deckgl(zoom = 11, pitch = 25) %>%
#    add_polygon_layer(data = sample_data, properties = properties) %>%
#    add_mapbox_basemap()
#  
#  if (interactive()) deck

