Learn R Programming

dggridR (version 2.0.4)

dgtransform: (DEPRECATED) Converts lat-long pairs into discrete global grid cell numbers

Description

A discrete global grid maps lat-long points to particular cells. These cells are uniquely numbered, for a given resolution, from 1 to some maximum number. Cell numbers may be reused from one resolution to the next. THIS FUNCTION IS DEPRECATED.

Usage

dgtransform(dggs, lat, lon)

Arguments

dggs

A dggs object from dgconstruct().

lat

A vector of latitudes. Same length at the longtiudes

lon

A vector of longitudes. Same length as the latitudes.

Value

A vector of the same length as latitudes and longitudes containing the cell id numbers of the points' cells in the discrete grid.

Examples

Run this code
# NOT RUN {
library(dggridR)
data(dgquakes)

#Construct a grid with cells about ~1000 miles wide
dggs          <- dgconstruct(spacing=1000,metric=FALSE) 
dgquakes$cell <- dgtransform(dggs,dgquakes$lat,dgquakes$lon)
# }

Run the code above in your browser using DataLab