Zonify Documentation

Complete guide to advanced zonal statistics analysis in QGIS

🎯 Introduction

Zonify is a professional QGIS plugin for performing advanced zonal statistics analysis. It allows you to efficiently extract and analyze raster data within polygon zones, with support for batch processing, multiple statistics, and professional reporting.

✨ What makes Zonify special?

  • Process unlimited rasters in one batch
  • 20+ statistical measures including pixel-perfect coverage analysis
  • Multi-threaded processing with smart resource management
  • Professional HTML dashboards and PDF reports
  • Advanced tools: Score Creator, Classifier, Highlighter, Rule Tagger, Time Series, Map Generator
  • Resume capability for long-running jobs

πŸ”§ Requirements

πŸ–₯️

QGIS

Minimum: 3.28
Recommended: 3.34+

🐍

Python

Minimum: 3.9
Recommended: 3.11+

πŸ’Ύ

RAM

Minimum: 4GB
Recommended: 16GB

βš™οΈ

CPU

Minimum: 2 cores
Recommended: 4+ cores

Python Dependencies

numpy>=1.24.0
pandas>=2.0.0
scipy>=1.11.0
matplotlib>=3.8.0
plotly>=5.18.0
reportlab>=4.0.0
jinja2>=3.1.0
psutil>=5.9
pyarrow>=12.0

πŸ“₯ Installation

Step 1: Download Plugin

Download the latest release from GitHub Releases or install directly from QGIS Plugin Manager (coming soon).

Step 2: Install to QGIS

Extract the ZIP file to your QGIS plugins directory:

πŸ“ Plugin Directories

Windows:
C:\Users\<username>\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\

Linux:
~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/

macOS:
~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/

Step 3: Install Python Dependencies

Windows (OSGeo4W Shell as Administrator):

pip install numpy pandas scipy matplotlib plotly reportlab jinja2 psutil pyarrow

Linux/Mac:

pip3 install --user numpy pandas scipy matplotlib plotly reportlab jinja2 psutil pyarrow

Step 4: Enable Plugin

  1. Restart QGIS
  2. Go to Plugins β†’ Manage and Install Plugins
  3. Find "Zonify" in the list
  4. Check the box to enable it
  5. Look for the Zonify icon in the toolbar

βœ… Installation Complete!

You're now ready to start using Zonify. Check out the Quick Start section to begin!

⚑ Quick Start - Basic Workflow

Get started with Zonify in 5 minutes!

  1. Open Zonify: Click the Zonify icon in the toolbar or go to Plugins β†’ Zonify
  2. Select Polygon Layer: Choose your zones/regions layer from the dropdown
  3. Add Rasters: Click "Add Raster(s)" button and select one or more raster files
  4. Choose Statistics: Check the statistics you want to calculate (Mean, Sum, Min, Max, etc.)
  5. Set Output Path: Choose where to save your results
  6. Run Processing: Click the "Run Standard Processing" button and watch the magic happen!

πŸ’‘ Pro Tips

  • Start with a small dataset (10-20 polygons, 1 raster) to test the workflow
  • Use GeoPackage (.gpkg) format for output - it's the most efficient
  • Enable HTML Dashboard export to get interactive visualizations
  • QGIS stays fully responsive during processing - you can continue working!

πŸ“‹ Example Scenarios

🌊

Flood Risk Assessment

Goal: Calculate flood exposure per district

Input: City districts (polygons) + Flood depth raster + Population density raster

Statistics: Mean flood depth, Sum population

Time: ~30 seconds for 100 districts

🌳

Forest Monitoring

Goal: Track forest cover changes over time

Input: Forest parcels + NDVI time series (monthly, 3 years)

Statistics: Mean NDVI + Time Series Analysis

Time: ~5 minutes for 500 parcels Γ— 36 rasters

πŸ™οΈ

Urban Accessibility

Goal: Analyze access to services

Input: Neighborhoods + Travel time to hospitals/schools/parks

Statistics: Mean travel time, Coverage analysis

Time: ~2 minutes for 200 neighborhoods Γ— 5 rasters

πŸ“Š Statistical Measures

Zonify calculates 20+ statistical measures for each raster within each polygon:

Basic Statistics

  • Mean: Average value of pixels within each zone
  • Sum: Total sum of pixel values in each zone
  • Min: Find the minimum pixel value in each zone
  • Max: Find the maximum pixel value in each zone
  • Median: Middle value in each zone
  • Mode: Find the most frequently occurring pixel value in each zone
  • Count: Count the number of pixels in each zone
  • Minority: Find the least frequently occurring pixel value in each zone
  • Range: The difference between max and min values
  • Variety: Count the number of unique pixel values in each zone

Advanced Statistics

  • Standard Deviation: Measure of spread around the mean
  • Variance: Square of standard deviation
  • Coefficient of Variation (CV): Std Dev / Mean Γ— 100 (normalized variability)

Percentiles

  • Percentile 10: 10th percentile value
  • Percentile 25 (Q1): First quartile
  • Percentile 50 (Q2): Median
  • Percentile 75 (Q3): Third quartile
  • Percentile 90: 90th percentile
  • Percentile 95: 95th percentile

Coverage Statistics

  • Coverage: Percentage of polygon covered by valid raster data (pixel-perfect geometric calculation)

⚠️ When to Use Which Statistic

Use Case Recommended Statistics
Average conditions Mean, Median
Total amounts (population, area) Sum
Extreme values Min, Max, Percentiles
Variability assessment Std Dev, CV, Range
Distribution analysis Percentiles (25, 50, 75)
Data quality check Count, Coverage

🎯 Coverage Analysis

Coverage analysis is one of Zonify's most important features. It tells you what percentage of each polygon contains valid raster data.

Why Coverage Matters

  • Data Quality: Identifies polygons with incomplete data
  • Decision Making: Helps you decide if statistics are reliable
  • NoData Awareness: Shows where data is missing (clouds, gaps, etc.)
  • Validity Check: Polygons outside raster extent show 0% coverage

πŸ“ Pixel-Perfect Geometric Calculation

Zonify uses advanced geometric algorithms to calculate coverage with pixel-level precision. This means:

  • Edge pixels are properly accounted for (ALL_TOUCHED mode)
  • Partial pixel coverage is accurately calculated
  • Coverage percentages are mathematically accurate

Example

Forest Parcel: 100 hectares
Satellite image coverage: 75 hectares
Coverage: 75%

Interpretation:
β†’ 25% of the parcel was cloudy during satellite pass
β†’ Statistics represent only 75% of the parcel
β†’ Consider if 75% coverage is sufficient for your analysis

πŸ”„ Batch Processing

Process multiple rasters simultaneously with smart resource management.

Key Features

  • Unlimited Rasters: Process as many rasters as you need in one run
  • Multi-threaded: Utilizes all available CPU cores
  • Smart RAM Management: User-configurable memory limits prevent system overload
  • Background Processing: QGIS stays fully responsive - continue working on other tasks
  • Resume Capability: Checkpoint system allows resuming interrupted jobs
  • VRT Optimization: Virtual rasters for efficient multi-raster reading

Configuration Options

πŸ’»

CPU Cores

Default: Auto-detect
Recommendation: Leave 1-2 cores free for system

πŸ’Ύ

RAM Limit

Default: 50% of system RAM
Recommendation: Adjust based on other applications

πŸ“¦

Chunk Size

Default: 1000 features
Tip: Larger = faster but more RAM

πŸ† Score Creator

Combine multiple indicators into a single composite score with weighted importance levels.

Use Cases

  • Risk Assessment: Combine flood depth + population + vulnerability β†’ Risk Score
  • Suitability Analysis: Combine slope + aspect + soil + water β†’ Suitability Index
  • Priority Ranking: Combine poverty + accessibility + infrastructure β†’ Priority Score

How It Works

  1. Select 2-5 indicators from your processed results
  2. Assign importance level to each:
    • Very High (50% weight)
    • High (30% weight)
    • Medium (15% weight)
    • Low (5% weight)
  3. Choose normalization method (Min-Max or Z-Score)
  4. Name your score
  5. Generate! New layer with composite score field

🎨 Area Classifier

Classify continuous values into discrete categories.

Classification Methods

  • Equal Intervals: Divides range into equal-sized bins (good for uniform distributions)
  • Quantiles: Equal number of features per class (good for skewed distributions)
  • Natural Breaks (Jenks): Finds natural groupings in data (best for most cases)
  • Custom Breaks: Define your own thresholds

Number of Classes

Choose 3 or 5 classes with customizable labels (e.g., Low/Medium/High or Very Low/Low/Medium/High/Very High)

🏁 Area Highlighter

Flag top/bottom performing areas based on percentiles.

Use Cases

  • Priority Areas: Top 10% solar potential β†’ "High Priority Sites"
  • At-Risk Areas: Bottom 20% accessibility β†’ "Needs Improvement"
  • Investment Focus: Top 5% ROI β†’ "Prime Investment Zones"
  • Intervention Zones: Bottom 15% health index β†’ "Critical Areas"

How It Works

  • Values are ranked from lowest to highest
  • Top X% = areas with highest values (best performers)
  • Bottom X% = areas with lowest values (worst performers)
  • Creates binary flags (1/0) for easy filtering in QGIS
  • Text labels make maps readable for any audience

πŸ—ΊοΈ Quick Map Generator

Generate professional print-ready maps with one click.

Features

  • Auto-generated Legend: From layer symbology
  • Scale Bar: Automatically sized and positioned
  • North Arrow: Standard cartographic symbol
  • Title & Subtitle: Customizable text
  • Multiple Page Sizes: A4, A3, Letter
  • Orientation: Portrait or Landscape
  • Export Formats: PNG, PDF, SVG

πŸ“ˆ Time Series Analysis

Analyze temporal changes and trends across multiple time periods.

Calculated Metrics

  • First/Last Value: Values from earliest and latest time periods
  • Total Change: Last - First
  • Percent Change: (Change / First) Γ— 100
  • Mean Change: Average change per time step
  • Trend Slope: Linear regression slope (rate of change)
  • Trend RΒ²: How well data fits linear trend
  • Temporal Statistics: Mean, Min, Max, Range across all time periods

Example

Forest Monitoring: NDVI monthly (2020-2023) = 48 rasters

Output per forest parcel:
- ts_first_value: NDVI in Jan 2020
- ts_last_value: NDVI in Dec 2023
- ts_total_change: Change over 4 years
- ts_percent_change: % change
- ts_trend_slope: Rate of change (NDVI/month)
- ts_trend_r2: Consistency of trend

Interpretation:
- Negative slope = deforestation
- Positive slope = regrowth
- High RΒ² = steady trend
- Low RΒ² = variable/seasonal

πŸ“€ Export Formats

πŸ“¦

GeoPackage (.gpkg)

Primary output format. Single-file database with all attributes and geometry. Perfect for QGIS workflows.

πŸ“„

CSV

Tabular data export. Opens in Excel, Google Sheets. Good for sharing with non-GIS users.

πŸ”—

JSON

Structured data format. Machine-readable. Perfect for APIs and web applications.

πŸ“Š

HTML Dashboard

Interactive web report with charts, search, pagination, and dark/light mode.

πŸ“‘

PDF Report

Professional printable report with tables, charts, and formatting.

πŸ–ΌοΈ

PNG Map Export

Quick map export as a high-resolution PNG, ready for reports, presentations, and sharing.

πŸ“Š HTML Dashboard

Professional interactive reports that open in any web browser.

Features

  • Interactive Plotly Charts: Zoom, pan, hover for details
  • Dark/Light Mode Toggle: Comfortable viewing in any environment
  • Search & Filter: Find specific features quickly
  • Pagination: 100 entries per page for large datasets
  • Coverage Analysis: Visual breakdown by coverage ranges
  • Statistics per Raster: Individual charts for each raster
  • Responsive Design: Works on desktop, tablet, and mobile
  • No Installation Required: Just double-click the .html file!

πŸ“‘ PDF Reports

Professional printable reports.

Features

  • Summary statistics table
  • Formatted for printing
  • Page numbers and headers

⚑ Performance Optimization

What Affects Speed

  1. Number of Features: More polygons = longer processing
  2. Number of Rasters: More rasters = longer processing
  3. Raster Resolution: Higher resolution = more pixels = slower
  4. Number of Statistics: More stats = slightly slower
  5. CPU Cores: More cores = faster (diminishing returns after 8 cores)
  6. Storage Speed: SSD is 2-3x faster than HDD

Optimization Tips

  • βœ… Use SSD storage for input/output files
  • βœ… Increase chunk size if you have spare RAM
  • βœ… Use VRT for multiple rasters (automatic in Zonify)
  • βœ… Close other applications to free up resources
  • βœ… Only calculate statistics you actually need
  • βœ… Consider resampling very high-resolution rasters for preliminary analysis

πŸ“Š Performance Benchmarks

Tested on: 8-core CPU, 16GB RAM, SSD

Features Rasters Statistics Time
10 1 5 ~5 seconds
100 5 8 ~30 seconds
1,000 10 10 ~2 minutes
10,000 10 10 ~8 minutes
100,000 10 10 ~30 minutes
500,000 20 15 ~2-3 hours

❓ FAQ - Installation

Q: Where can I download Zonify?

A: From the GitHub Releases page or soon from QGIS Plugin Manager (awaiting approval).

Q: I get "Module not found: numpy" error. What should I do?

A: Python dependencies aren't installed. Open OSGeo4W Shell (Windows) or terminal (Linux/Mac) and run:

pip install numpy pandas scipy matplotlib plotly reportlab jinja2 psutil pyarrow

Q: Plugin doesn't appear after installation. Why?

A: Try these steps:

  1. Restart QGIS completely
  2. Check Plugins β†’ Manage and Install Plugins β†’ Installed β†’ Enable Zonify
  3. Check Python console for errors: Plugins β†’ Python Console

❓ FAQ - Usage

Q: How many rasters can I process at once?

A: Unlimited! Zonify has been tested with 20+ rasters without issues. Processing time increases linearly with number of rasters.

Q: Do polygons and rasters need to be in the same CRS?

A: No! Zonify automatically handles CRS differences through reprojection. However, using the same CRS is faster.

Q: What does "Coverage" mean?

A: Coverage is the percentage of a polygon that contains valid raster data (not NoData). Example: Coverage = 85% means 85% of polygon area has raster data, 15% is NoData or outside raster extent.

Q: Which statistics should I use?

A:

  • Mean - Most common, good for averages (temperature, elevation)
  • Sum - Good for totals (population, area)
  • Min/Max - For extreme values
  • Median - When data has outliers
  • Std Dev/CV - For measuring variability

❓ FAQ - Performance

Q: How long does processing take?

A: It depends on data size. See Performance Benchmarks for examples. Generally:

  • Small (10 polygons, 1 raster): ~5 seconds
  • Medium (1,000 polygons, 5 rasters): ~2 minutes
  • Large (100,000 polygons, 10 rasters): ~30 minutes

Q: Does QGIS freeze during processing?

A: No! Zonify uses true background processing. QGIS stays fully responsive and you can continue working on other tasks.

Q: Can I speed up processing?

A: Yes! See Performance Optimization section. Quick tips:

  • Use SSD storage
  • Increase CPU cores in settings
  • Close other applications
  • Only calculate needed statistics

❓ FAQ - Troubleshooting

Q: Processing crashes or freezes. What should I do?

A: Try these solutions:

  • Reduce RAM limit in Settings tab
  • Process fewer rasters at once
  • Check for corrupted raster files
  • Validate polygon geometries (Vector β†’ Geometry Tools β†’ Check Validity)

Q: Results seem incorrect. How do I verify?

A: Check these:

  • Verify CRS matches between polygons and rasters
  • Check raster NoData values are set correctly
  • Review coverage statistics - low coverage may indicate issues
  • Verify raster units are as expected
  • Visual inspection: load results in QGIS and check spatial patterns

Q: Some polygons have very low coverage. Why?

A: Common reasons:

  • Polygon extends outside raster extent
  • Raster has NoData in that area (clouds, data gaps)
  • CRS mismatch causing misalignment

Solution: Check coverage statistics and decide if those polygons should be excluded from analysis.

Q: HTML dashboard won't open. What should I do?

A: Try these:

  • Try a different browser (Chrome, Firefox, Edge)
  • Move file to a simple path (no spaces or special characters)
  • Check browser security settings (some browsers block local HTML files)
  • Regenerate HTML export

πŸ“ž Still Need Help?

Can't find your answer? We're here to help!

↑