Adds an `h3_index` column to a GPS data frame by mapping each coordinate to
its containing H3 hexagon at the specified resolution. Rows with missing
coordinates are dropped. The data frame is returned in its original
unprojected (WGS84) form with the index appended.
Usage
assign_h3_indices(df, lat_col = "lat", lon_col = "lon", h3_res = 9)
Arguments
- df
A data frame with GPS coordinates.
- lat_col
Character. Name of the latitude column. Default is `"lat"`.
- lon_col
Character. Name of the longitude column. Default is `"lon"`.
- h3_res
Integer (0–15). H3 resolution level. Default is `9`
(~174 m edge length). Higher values produce smaller, finer cells.
Value
The input data frame (minus rows with missing coordinates) with an
additional `h3_index` character column.
See also
[aggregate_h3_effort()], [rollup_h3_resolution()]