Learn R Programming

hexify (version 0.3.8)

hexify_lonlat_to_cell: Convert longitude/latitude to cell ID

Description

Converts geographic coordinates to DGGRID-compatible cell identifiers. This is the primary function for geocoding points to grid cells.

Usage

hexify_lonlat_to_cell(lon, lat, resolution, aperture)

Value

Numeric vector of cell IDs (1-based)

Arguments

lon

Numeric vector of longitudes in degrees

lat

Numeric vector of latitudes in degrees

resolution

Grid resolution (integer >= 0)

aperture

Grid aperture (3, 4, or 7)

Details

Returns DGGRID-compatible cell identifiers. The cell ID uniquely identifies each hexagonal cell in the global grid.

For a grid-object interface, use lonlat_to_cell.

See Also

lonlat_to_cell for the recommended S4 interface, hexify_cell_to_lonlat for the inverse operation

Other coordinate conversion: hexify_cell_id_to_quad_ij(), hexify_cell_to_icosa_tri(), hexify_cell_to_lonlat(), hexify_cell_to_plane(), hexify_cell_to_quad_ij(), hexify_cell_to_quad_xy(), hexify_grid_cell_to_lonlat(), hexify_grid_to_cell(), hexify_icosa_tri_to_plane(), hexify_icosa_tri_to_quad_ij(), hexify_icosa_tri_to_quad_xy(), hexify_lonlat_to_plane(), hexify_lonlat_to_quad_ij(), hexify_quad_ij_to_cell(), hexify_quad_ij_to_icosa_tri(), hexify_quad_ij_to_xy(), hexify_quad_xy_to_cell(), hexify_quad_xy_to_icosa_tri(), hexify_roundtrip_test()

Examples

Run this code
cell_id <- hexify_lonlat_to_cell(0, 45, resolution = 5, aperture = 3)

Run the code above in your browser using DataLab