Creates continuous density raster surfaces by joining vector spatial layers with tabular data frameworks, normalizing values by ellipsoidal polygon area calculations. Reconciles discrete boundary-constrained census or survey counts with uniform grids. Accepts spatial objects in-memory or via file paths. Methods are based on spatial rasterization workflows implemented in the 'terra' package Hijmans (2025) < https://rspatial.github.io/terra/>.
GeoDensityR is an R package for generating density rasters from polygon shapefiles and tabular census or survey data.
The package:
Useful for:
devtools::install_github("sahalpaladan/GeoDensityR")
library(GeoDensityR)
generate_density_raster(
csv_file = "Livestock_census_GJ_RJ.csv",
shp_file = "GJ_RJ_District_Shape_File.shp",
join_shp = "District",
join_csv = "District",
value_col = "Cattle",
resolution = 0.1,
output = "density.asc"
)
Inside Livestock_census_GJ_RJ.csv file have demo values only.
Access the online GeoDensityR Shiny application: