geospatialsuite 🌍

CRAN status Total Downloads License: MIT

Comprehensive Geospatiotemporal Analysis and Multimodal Integration Toolkit for R

geospatialsuite is a powerful R package for geospatial analysis featuring 60+ vegetation indices, universal spatial analysis, auto-geocoding without coordinates, efficient raster visualization, and comprehensive workflows for agricultural research, environmental monitoring, and remote sensing applications.

πŸ“‹ Table of Contents

✨ Key Features

πŸ—ΊοΈ Auto-Geocoding Without Coordinates

🌱 Advanced Vegetation Analysis

πŸ—ΊοΈ Universal Spatial Analysis

πŸ“Š Efficient Visualization

πŸ”„ Comprehensive Workflows

⚑ Performance Features

πŸ“¦ Installation

# Install the stable version from CRAN
install.packages("geospatialsuite")

Development Version from GitHub

# install.packages("devtools")
devtools::install_github("cwru-sdle/geospatialsuite")

πŸš€ Quick Start

Load Package and Test Installation

library(geospatialsuite)

# Test your installation
test_geospatialsuite_package_simple()

# Check function availability
test_function_availability(verbose = TRUE)

Basic Usage Examples

# Load built-in sample data
red <- load_sample_data("sample_red.rds")
nir <- load_sample_data("sample_nir.rds")
blue <- load_sample_data("sample_blue.rds")
study_sites <- load_sample_data("sample_coordinates.csv")

# 1. One-line mapping (auto-detects everything!)
quick_map(red, title = "Red Band")

# 2. Universal spatial join (most common operation- Requires your own data)
result <- universal_spatial_join(
  source_data = study_sites,
  target_data = red,
  method = "extract"
)

# 3. Calculate vegetation indices with sample data
ndvi <- calculate_vegetation_index(
  red = red, 
  nir = nir, 
  index_type = "NDVI",
  verbose = TRUE
)

# 4. Enhanced NDVI with quality filtering
enhanced_ndvi <- calculate_ndvi_enhanced(
  red = red,
  nir = nir,
  quality_filter = TRUE
)

# 5. Multiple indices at once
indices <- calculate_multiple_indices(
  red = red, 
  nir = nir, 
  blue = blue,
  indices = c("NDVI", "EVI", "SAVI"),
  output_stack = TRUE
)

πŸ—ΊοΈ Auto-Geocoding Without Coordinates

Work with data that doesn’t have latitude/longitude coordinates. geospatialsuite automatically detects and geocodes geographic identifiers:

# Works with state names or abbreviations
state_data <- data.frame(
  state = c("Ohio", "PA", "Michigan"),
  population = c(11.8, 13.0, 10.1)
)
spatial_data <- auto_geocode_data(state_data)


# Works with FIPS codes
county_data <- data.frame(
  fips = c("39049", "39035", "39113"),
  unemployment = c(4.2, 5.1, 4.8)
)
county_sf <- auto_geocode_data(county_data)

# Works with HUC codes (any format!)
watershed_data <- data.frame(
  HUC_8 = c("04100009", "04100012"),  # or HUC-8, huc8, Huc 8, etc.
  water_quality = c(72, 65)
)
huc_sf <- auto_geocode_data(watershed_data)

# Works with ZIP codes
zip_data <- data.frame(
  zip = c("43215", "44113", "45202"),
  median_income = c(58000, 45000, 72000)
)
zip_sf <- auto_geocode_data(zip_data)

# Preview what will be detected before geocoding
preview_geocoding(my_data)

Supported geographic entities: - βœ… States (names or abbreviations) - βœ… Counties - βœ… FIPS codes - βœ… HUC watershed codes (HUC-8, HUC_8, huc8, etc.) - βœ… ZIP codes - βœ… City names

Column name flexibility: The package handles any naming convention - HUC_8, HUC-8, huc8, State, STATE, state_name, etc.

πŸ“– Documentation

Function Reference

# View all available functions
help(package = "geospatialsuite")

# Auto-geocoding functions
?auto_geocode_data
?preview_geocoding

# Test function availability
test_function_availability()

# Run basic package tests
test_geospatialsuite_package_simple()

# Run minimal functionality test
test_package_minimal(verbose = TRUE)

🎯 Real-World Examples

Census Data Analysis (No Coordinates Needed!)

# Load census data with just state names - no coordinates!
census_data <- data.frame(
  state = c("California", "Texas", "Florida", "New York"),
  population_millions = c(39.5, 29.1, 22.2, 20.2),
  median_income = c(75000, 64000, 59000, 72000),
  unemployment_rate = c(4.8, 4.1, 3.2, 4.3)
)

# Auto-geocode and visualize
census_sf <- auto_geocode_data(census_data, verbose = TRUE)
quick_map(census_sf, variable = "median_income", 
          title = "Median Household Income by State")

Watershed Analysis with HUC Codes

# Water quality data with HUC-8 codes (no coordinates!)
watershed_data <- data.frame(
  HUC_8 = c("04100009", "04100012", "04110002", "05120201"),
  basin_name = c("Great Miami", "Mill Creek-Cincinnati", 
                 "Middle Ohio", "Upper Wabash"),
  nitrogen_mg_l = c(2.3, 3.1, 1.8, 2.7),
  phosphorus_mg_l = c(0.08, 0.12, 0.06, 0.09)
)

# Auto-geocode watersheds
huc_sf <- auto_geocode_data(watershed_data, verbose = TRUE)

# Comprehensive water quality analysis
water_results <- analyze_water_quality_comprehensive(
  water_data = huc_sf,
  variable = "nitrogen_mg_l",
  thresholds = list(
    Normal = c(0, 2), 
    Elevated = c(2, 5),
    High = c(5, Inf)
  )
)

quick_map(huc_sf, variable = "nitrogen_mg_l",
          title = "Nitrogen Levels by Watershed")

Agricultural Monitoring Crop Codes

# Get crop codes for analysis
corn_codes <- get_comprehensive_cdl_codes("corn")
grain_codes <- get_comprehensive_cdl_codes("grains")

County-Level Environmental Analysis

# County data with FIPS codes (no coordinates needed!)
county_data <- data.frame(
  fips = c("39049", "39035", "39113", "39061"),
  county_name = c("Franklin", "Cuyahoga", "Montgomery", "Hamilton"),
  air_quality_index = c(45, 52, 48, 41),
  tree_canopy_pct = c(28, 35, 32, 40)
)

# Auto-geocode counties
county_sf <- auto_geocode_data(county_data, verbose = TRUE)

Analyse crop vegetation

red <- load_sample_data("sample_red.rds")
nir <- load_sample_data("sample_nir.rds")
blue <- load_sample_data("sample_blue.rds")

spectral_stack <- c(red, nir, blue)

names(spectral_stack) <- c("red", "nir", "blue")

result <- analyze_crop_vegetation(
  spectral_data = spectral_stack,
  crop_type = "corn",
  analysis_type = "comprehensive"
)

# Structure:
result$vegetation_indices      # SpatRaster with calculated indices
result$analysis_results        # Detailed analysis results
result$metadata                # Processing metadata

Crop Classification Methodology

analyze_crop_vegetation() classifies vegetation stress, growth stage, and yield potential using literature-informed thresholds across multiple indices:

Note: Thresholds are literature-informed starting points. Exact NDVI boundaries vary by region, cultivar, sensor, and season. Calibration with local ground truth data is recommended.

References: - Tucker (1979). Remote Sensing of Environment, 8(2), 127–150. https://doi.org/10.1016/0034-4257(79)90013-0

🌟 What Makes geospatialsuite Special

1. Auto-Geocoding Revolution

No more manual coordinate lookups! Work directly with: - State names, county names, FIPS codes - HUC watershed codes (any format) - ZIP codes, city names - Flexible column naming (HUC_8, HUC-8, huc8 all work!)

2. Universal Design

Works with any spatial data combination - no need to learn different functions for different data types. The universal_spatial_join() function automatically handles: - Vector-to-vector joins - Vector-to-raster extractions
- Raster-to-raster operations - Multi-dataset integrations

3. Intelligent Automation

4. Efficient Visualization

5. Comprehensive Coverage

6. Research-Ready

Designed specifically for reproducible research with: - Comprehensive testing suite (test_geospatialsuite_package_simple()) - Function availability checking (test_function_availability()) - Quality control and filtering options - Integration with modern R spatial ecosystem

⚑ Performance

geospatialsuite is optimized for:

For realistic satellite imagery (5KΓ—5K pixels):

Performance Tips

# Test basic functionality
test_package_minimal(verbose = TRUE)

# Check which functions are available
test_function_availability(verbose = TRUE)

πŸ“Š Supported Vegetation Indices

Click to see all 60+ vegetation indices (full table)
# Index Category Application Required Bands Description
1 NDVI basic general Red, NIR Normalized Difference Vegetation Index
2 SAVI basic soil Red, NIR Soil Adjusted Vegetation Index
3 MSAVI basic soil Red, NIR Modified Soil Adjusted Vegetation Index
4 OSAVI basic soil Red, NIR Optimized Soil Adjusted Vegetation Index
5 EVI basic general Red, NIR, Blue Enhanced Vegetation Index
6 EVI2 basic general Red, NIR Two-band Enhanced Vegetation Index
7 DVI basic biomass Red, NIR Difference Vegetation Index
8 RVI basic general Red, NIR Ratio Vegetation Index
9 GNDVI basic chlorophyll Green, NIR Green NDVI
10 WDVI basic soil Red, NIR Weighted Difference Vegetation Index
11 ARVI enhanced atmospheric Red, NIR, Blue Atmospherically Resistant Vegetation Index
12 RDVI enhanced general Red, NIR Renormalized Difference Vegetation Index
13 PVI enhanced general Red, NIR Perpendicular Vegetation Index
14 IPVI enhanced general Red, NIR Infrared Percentage Vegetation Index
15 TNDVI enhanced general Red, NIR Transformed NDVI
16 GEMI enhanced general Red, NIR Global Environment Monitoring Index
17 VARI enhanced general Red, Green, Blue Visible Atmospherically Resistant Index
18 TSAVI enhanced soil Red, NIR Transformed Soil Adjusted VI
19 ATSAVI enhanced soil Red, NIR Adjusted Transformed Soil Adjusted VI
20 GESAVI enhanced soil Red, NIR Generalized Soil Adjusted VI
21 MTVI enhanced general Red, NIR Modified Triangular VI
22 CTVI enhanced canopy Red, NIR Corrected Transformed VI
23 NDRE advanced stress NIR, RedEdge Normalized Difference Red Edge
24 MTCI advanced stress RedEdge, NIR MERIS Terrestrial Chlorophyll Index
25 IRECI advanced stress RedEdge, NIR Inverted Red-Edge Chlorophyll Index
26 S2REP advanced stress RedEdge Sentinel-2 Red-Edge Position
27 PSRI advanced stress RedEdge, NIR Plant Senescence Reflectance Index
28 CRI1 advanced stress Red, Green Carotenoid Reflectance Index 1
29 CRI2 advanced stress RedEdge, Green Carotenoid Reflectance Index 2
30 ARI1 advanced stress RedEdge, Green Anthocyanin Reflectance Index 1
31 ARI2 advanced stress RedEdge, NIR Anthocyanin Reflectance Index 2
32 MCARI advanced stress Red, Green Modified Chlorophyll Absorption Ratio Index
33 PRI stress stress Green, NIR Photochemical Reflectance Index
34 SIPI stress stress Red, NIR Structure Insensitive Pigment Index
35 CCI stress stress RedEdge, Green Canopy Chlorophyll Index
36 NDNI stress stress NIR, SWIR1 Normalized Difference Nitrogen Index
37 CARI stress stress Red, Green Chlorophyll Absorption Ratio Index
38 TCARI stress stress Red, Green Transformed Chlorophyll Absorption Ratio Index
39 MTVI1 stress stress Red, NIR Modified Triangular Vegetation Index 1
40 MTVI2 stress stress Red, NIR Modified Triangular Vegetation Index 2
41 TVI stress stress Red, NIR Triangular Vegetation Index
42 NPCI stress stress Red, Blue Normalized Pigment Chlorophyll Index
43 RARS stress stress Red, NIR Ratio Analysis of Reflectance Spectra
44 NPQI stress stress Red, Blue Normalized Phaeophytinization Index
45 NDWI water water Green, NIR Normalized Difference Water Index
46 MNDWI water water Green, SWIR1 Modified Normalized Difference Water Index
47 NDMI water water NIR, SWIR1 Normalized Difference Moisture Index
48 MSI water water NIR, SWIR1 Moisture Stress Index
49 NDII water water NIR, SWIR1 Normalized Difference Infrared Index
50 WI water water NIR, SWIR1 Water Index
51 SRWI water water NIR, SWIR1 Simple Ratio Water Index
52 LSWI water water NIR, SWIR1 Land Surface Water Index
53 LAI specialized forestry Red, NIR Leaf Area Index
54 FAPAR specialized forestry Red, NIR Fraction of Absorbed PAR
55 FCOVER specialized forestry Red, NIR Fraction of Vegetation Cover
56 NBR specialized forestry NIR, SWIR2 Normalized Burn Ratio
57 BAI specialized forestry Red, NIR Burn Area Index
58 NDSI specialized snow Green, SWIR1 Normalized Difference Snow Index
59 GRVI specialized general Red, Green Green-Red Vegetation Index
60 VIG specialized general Green, NIR Vegetation Index Green
61 CI specialized canopy Red, Green Coloration Index
62 GBNDVI specialized general Green, Blue, NIR Green-Blue NDVI

Total: 60+ indices with automatic band detection across satellite platforms

πŸ›  System Requirements

Required Dependencies

# Core dependencies (automatically installed with geospatialsuite)
# These are listed in DESCRIPTION Imports and will be installed automatically
terra (>= 1.6-17)
sf (>= 1.0-0)
dplyr (>= 1.0.0)
ggplot2 (>= 3.3.0)
magrittr
viridis
leaflet          # Interactive web mapping
rnaturalearth    # Natural Earth country boundaries
tigris           # US Census boundaries (states, counties, FIPS)
# Plus: graphics, grDevices, htmlwidgets, mice, parallel, 
#       RColorBrewer, stats, stringr, tools, utils

Optional Enhancement Packages

# These packages provide additional functionality but are not required
# Install them separately for enhanced capabilities

# Raster visualization enhancements
install.packages(c(
  "tidyterra",    # Efficient raster visualization with ggplot2
  "RStoolbox"     # Remote sensing tools and visualization
))

# Figure composition and animation
install.packages(c(
  "patchwork",    # Multi-panel figures and layouts
  "gganimate"     # Animated visualizations
))

# Extended geocoding capabilities (listed in DESCRIPTION Suggests)
install.packages(c(
  "nhdplusTools",  # HUC watershed boundaries
  "zipcodeR",      # ZIP code centroids
  "tidygeocoder"   # City name geocoding
))

Minimum R Version

πŸ“„ Citation

If you use geospatialsuite in your research, please cite:

citation("geospatialsuite")

πŸ“§ Contact

πŸ“ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

Contributing Institutions

Special Thanks