Equal-area hexagonal grids for spatial analysis
Assign geographic points to hexagonal cells using the ISEA discrete global grid system. All cells have the same area regardless of latitude.
# install.packages("pak")
pak::pak("gcol33/hexify")library(hexify)
# Your data
cities <- data.frame(
name = c("Vienna", "Paris", "Madrid"),
lon = c(16.37, 2.35, -3.70),
lat = c(48.21, 48.86, 40.42)
)
# Create a grid and assign points
grid <- hex_grid(area_km2 = 10000)
result <- hexify(cities, lon = "lon", lat = "lat", grid = grid)
# Visualize
plot(result)- Equal-area cells: No latitude distortion
- Simple workflow: Define grid once, reuse everywhere
- Fast C++ core: Handles millions of points
- sf integration: Works with any CRS
- dggridR compatible: Same cell IDs for interoperability
- Quick Start - Basic usage and concepts
- Visualization - Plotting options
- Workflows - Grid generation, spatial joins, multi-resolution analysis
"Software is like sex: it's better when it's free." — Linus Torvalds
I'm a PhD student who builds R packages in my free time because I believe good tools should be free and open. I started these projects for my own work and figured others might find them useful too.
If this package saved you some time, buying me a coffee is a nice way to say thanks. It helps with my coffee addiction.
MIT