| gt_make_grid | R Documentation | 
Creates a grid of sf polygons, where traffic data for each polygon can then be queried using gt_make_raster_from_grid().
gt_make_grid(
  polygon,
  zoom,
  height_width_max = 2000,
  height = NULL,
  width = NULL,
  reduce_hw = 10
)
| polygon | Polygon ( | 
| zoom | Zoom level; integer from 5 to 20. For more information about how zoom levels correspond to pixel size, see here and here. | 
| height_width_max | Maximum pixel height and width to check using for each grid (pixel length depends on zoom). If the same number of grids can be made with a smaller height/width, the function will use a smaller height/width. If  | 
| height | Height, in pixels, for each grid (pixel length depends on zoom). Enter a  | 
| width | Pixel, in pixels, for each grid (pixel length depends on zoom). Enter a  | 
| reduce_hw | Number of pixels to reduce height/width by. Doing so creates some overlap between grids to ensure there is not blank space between grids. (Default: 10). | 
Returns an sf dataframe with the locations to query, including parameters needed for gt_make_raster_from_grid()
## Make polygon
poly_sf <- c(xmin = -74.02426,
             xmax = -73.91048,
             ymin = 40.70042,
             ymax = 40.87858) |>
  sf::st_bbox() |>
  sf::st_as_sfc() |>
  sf::st_as_sf()
sf::st_crs(poly_sf) <- 4326
## Make grid using polygon
grid_sf <- gt_make_grid(polygon = poly_sf,
                        height  = 2000,
                        width   = 2000,
                        zoom    = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.