Generate Density Rasters from Polygon and Census Data

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

GeoDensityR is an R package for generating density rasters from polygon shapefiles and tabular census or survey data.

The package:

  • joins polygon and tabular datasets
  • calculates density values
  • rasterizes polygon densities
  • exports ASCII or GeoTIFF rasters

Useful for:

  • epidemiology
  • ecology
  • livestock distribution
  • population density
  • spatial analysis
  • disease modeling

Installation

devtools::install_github("sahalpaladan/GeoDensityR")

Usage

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"
  
)

Note

Inside Livestock_census_GJ_RJ.csv file have demo values only.

Online Shiny App

Access the online GeoDensityR Shiny application:

https://sahalpaladan.shinyapps.io/geodensityr_shiny/

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("GeoDensityR")

0.2.0 by Sahal Paladan, 2 months ago


https://github.com/sahalpaladan/GeoDensityR


Report a bug at https://github.com/sahalpaladan/GeoDensityR/issues


Browse source code at https://github.com/cran/GeoDensityR


Authors: Sahal Paladan [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports terra, tools

Suggests testthat, knitr, rmarkdown


See at CRAN