An n x 3 data frame containing three variables: cell_ind corresponds to unique id
for each grid cell,
cell_lon is the longitude of the grid cell, cell_lat is the latitude of the grid cell.
Since the output data frame retains the order of the input coordinates, the original coordinate
dataset and the output have can be linked one-to-one by the row index.
Arguments
lon
Numeric, n longitude values
lat
Numeric, n latitude values
sp.resolution
Numeric, must be a single value that indicates the minimal unit length of
a grid cell.
lon.range
Optional vector that indicates the range of lon. Default is range(lon).
lat.range
Optional vector that indicates the range of lat. Default is range(lat).
Details
The longitude and latitude of each grid cell are the coordinate of the cell center.
For example, if sp.resolution=1, then cell_lon=55.5 and cell_lat=22.5 correspond to the
square whose left boundary is 55, right boundary is 56, upper boundary is 23, and lower boundary
is 22.