powered by
This function assigns a set of geographic coordinates (longitude and latitude) to grid cells based on a specified cell size.
assign_coords_to_grid(coords, cell_size)
A character vector of grid cell identifiers, where each identifier is formatted as "x_y", representing the grid cell coordinates.
A data frame or matrix with two columns: longitude and latitude.
Numeric value representing the size of each grid cell, typically in degrees.
coords <- data.frame(long = c(-122.4194, 0), lat = c(37.7749, 0)) cell_size <- 1 assign_coords_to_grid(coords, cell_size)
Run the code above in your browser using DataLab