top of page
task_01ka8chvxgegf8r3p36myheq5b_1763365720_img_1.webp

Python-Based NDVI Analysis for Vegetation Study in Chalakkudy, Kerala

-Sreelakshmi Devak,
Student of AGSRT

Abstract:

This project focuses on the application of the Normalized Difference Vegetation Index (NDVI) to assess and classify vegetation patterns in the Chalakkudy region using Python-based geospatial analysis. NDVI is a well-established spectral index that quantifies vegetation health by comparing reflected near-infrared and red light from satellite imagery. Using Landsat 8 data, this study performs NDVI computation, spatial clipping using administrative boundaries, and classification into four vegetation zones: water bodies, barren land, sparse vegetation, and dense vegetation. The project utilizes open-source Python libraries such as `rasterio`, `geopandas`, `numpy`, and `matplotlib` to develop a reproducible workflow. The final output includes spatially accurate NDVI maps enriched with scale bars, north arrows, and vegetation zone classifications, providing valuable insights into the regional ecological structure and vegetation distribution.

Introduction:

The Normalized Difference Vegetation Index (NDVI) is a widely recognized and extensively used remote sensing index for evaluating vegetation health, density, and distribution over large geographic regions. Developed from spectral reflectance properties of vegetation, NDVI leverages the difference between absorbed red light and reflected near-infrared (NIR) radiation to estimate the presence and vigor of live green vegetation. Healthy, chlorophyll-rich vegetation typically absorbs most red light and reflects a significant portion of NIR, resulting in high NDVI values, while barren land, water bodies, or stressed vegetation return lower or negative values.
NDVI plays a crucial role in a variety of geospatial and environmental applications such as land use monitoring, drought assessment, agricultural productivity evaluation, deforestation tracking, and ecosystem management. With the increasing availability of open satellite data, such as Landsat and Sentinel imagery, NDVI has become a cornerstone in modern geospatial analysis and environmental planning.
This project focuses on the spatial computation and classification of NDVI over the Chalakkudy region in Kerala, India. The region is known for its ecological diversity, including river systems, forest cover, plantations, and urban settlements. By using Python-based geospatial techniques, including open-source libraries like Rasterio, GeoPandas, NumPy, and Matplotlib, this project establishes a workflow for calculating NDVI from Landsat 8 imagery, clipping it to the administrative boundary of Chalakkudy, and classifying the results into distinct vegetation zones.
The ultimate goal is to generate spatial outputs—NDVI maps and classified vegetation zones— that can serve as valuable decision-making tools for environmental planners, researchers, and local authorities. This technical report documents each stage of the project, from data preparation to visualization, demonstrating how Python can be used effectively for remote sensing and spatial data analysis.

Objectives:

  • To calculate NDVI from Landsat 8 imagery

  • To clip the NDVI image to the Chalakkudy boundary

  • To classify NDVI values into zonal vegetation categories

  • To visualize and export the final classified map

Study Area:

Chalakkudy is a municipal town and surrounding region located in the Thrissur district of Kerala, India. It is part of the Chalakkudy River Basin and represents a typical midland geography of Kerala, comprising a variety of landforms including riverbanks, low hills, agricultural lands, built-up areas, and scattered forest patches.The region supports mixed land use patterns, with prominent features such as paddy fields, rubber plantations, coconut groves, and semi-urban settlements. These characteristics make Chalakkudy a representative area for spatial analysis of vegetation using NDVI, as it includes both natural and anthropogenic landscapes.Due to its ecological diversity and accessibility of open geospatial data, Chalakkudy was selected as a suitable case study for NDVI calculation, classification, and visualization using Python-based remote sensing tools.

Study Area.jpg

Objectives:

  • Landsat 8 imagery (Bands 4 and 5)

  • Chalakkudy shapefile (.shp, .dbf, .shx, etc.)

  • Python programming language

  • Libraries: geopandas, rasterio, matplotlib, numpy

  • Landsat 8 Imagery (Bands 4 and 5)

​

The project utilized Landsat 8 imagery, specifically Band 4 (Red) and Band 5 (Near- Infrared), to calculate the Normalized Difference Vegetation Index (NDVI). A Chalakkudy shapefile containing the study area's boundary was used to spatially clip the NDVI raster. The analysis was conducted using the Python programming language, leveraging open-source geospatial libraries such as geopandas for vector data handling, rasterio for raster processing, numpy for NDVI calculation and classification, and matplotlib for generating maps and visual outputs.

Methodology:

The NDVI is calculated using the formula (NIR - Red) / (NIR + Red). The following steps were performed:

  • Load and plot the shapefile

  • Extract bands from Landsat image

  • Compute NDVI

  • Save and clip NDVI using the shapefile

  • Mask background pixels

  • Classify NDVI into four zones: Water, Barren, Sparse, Dense

  • Generate maps with scale bar and north arrow

The Normalized Difference Vegetation Index (NDVI) is calculated using the standard remote sensing formula: NDVI = (NIR - Red) / (NIR + Red), where NIR and Red refer to the near-infrared and red spectral bands respectively, derived from Landsat 8 satellite imagery. The process began with loading and visualizing the Chalakkudy shapefile, which defines the geographic extent of the study area. Following this, Band 4 (Red) and Band 5 (NIR) were extracted from the satellite image using Python and raster processing tools. NDVI was then computed on a pixel-by-pixel basis using NumPy. The resulting NDVI raster was then clipped to the boundary of the Chalakkudy shapefile using masking functions to limit analysis to the study area. Pixels with a value of zero were masked out to eliminate background noise. The clipped NDVI data was then classified into four vegetation zones—Water, Barren land, Sparse vegetation, and Dense vegetation—based on standard NDVI value thresholds. Finally, the

classified output was visualized using Matplotlib, enhanced with a legend, north arrow, and scale bar, and exported as a high-quality map for interpretation and reporting.

Methodology.jpg
NDVI Calculation and Clipping.jpg

NDVI Calculation and Clipping:

The Normalized Difference Vegetation Index (NDVI) is one of the most widely used vegetation indices in remote sensing, primarily because of its simplicity and ability to indicate vegetation health and density using satellite imagery. NDVI values range between -1 and +1, where higher values (e.g., > 0.5) typically represent healthy and dense green vegetation, while lower or negative values indicate sparse vegetation, bare land, water bodies, or urban surfaces.
NDVI is calculated using reflectance data from two specific spectral bands: Red (visible) and Near-Infrared (NIR). In this project, Landsat 8 imagery was used, specifically Band 4 for the red

portion of the spectrum and Band 5 for NIR. Healthy vegetation strongly absorbs red light for photosynthesis and reflects NIR, resulting in higher NDVI values. The NDVI formula applied was:

NDVI = (NIR - Red)/(NIR + Red)

The calculation was implemented in Python using NumPy, a powerful library for numerical array operations. Each pixel's red and NIR values were used to calculate a corresponding NDVI value, producing a full NDVI raster image of the region covered by the satellite.

To focus the analysis solely on the Chalakkudy region, the NDVI raster was clipped using a shapefile boundary that defines the area of interest. This was done using the rasterio.mask function, which allows precise extraction of raster data within vector-defined boundaries. Clipping reduced data volume and ensured that all statistical and visual interpretations relate strictly to the study area.

Following the clipping process, background pixels (typically those outside the region of interest or with no valid reflectance data) were masked out, particularly where NDVI values were equal to zero. This preprocessing step was crucial for enhancing the accuracy of classification and avoiding misinterpretation in the final visualization.

The resulting clipped NDVI raster served as the basis for classification into vegetation zones and was later used to generate the final NDVI maps that include spatial elements like scale bars and north arrows for better geographic context.

NDVI Calculation and Clipping 1.png
NDVI Calculation and Clipping 2.png
NDVI Calculation and Clipping 4.jpg
NDVI Calculation and Clipping 5.jpg

Classification and Mapping:

After computing and clipping the NDVI raster to the Chalakkudy study area, the NDVI values were classified into four vegetation categories to enhance interpretability and support zonal analysis. NDVI, being a continuous index, ranges from -1 to +1. To extract meaningful land cover insights, the following classification scheme was applied based on standard NDVI threshold interpretations:

  • LNDVI < 0.1: Water bodies and very low reflectance surfaces

  • 0.1 ≤ NDVI < 0.25: Barren land or built-up urban areas with minimal vegetation

  • 0.25 ≤ NDVI < 0.5: Sparse vegetation, such as grasslands, fallow land, or degraded forest

  • NDVI ≥ 0.5: Dense vegetation, including healthy forests, plantations, or well-irrigated crops

This classification transforms the grayscale NDVI raster into a categorical vegetation map, enabling better visual differentiation of ecological zones. Each class was mapped to a distinct color using a discrete colormap via the matplotlib.colors.ListedColormap function. For example, water was represented in blue, barren land in yellow, sparse vegetation in light green, and dense vegetation in dark green.

To enhance map readability and spatial reference, standard cartographic elements were added:

  • A scale bar, indicating real-world distance (3 km), was manually plotted in data units based on the Landsat pixel resolution (30 meters)

  • A north arrow was included to show map orientation, aiding geographic interpretation

  • A legend was generated to indicate what each color represents in terms of NDVI classification

​

The final classified NDVI map was exported as a high-resolution PNG image using plt.savefig() to ensure clarity in the project report. This map provides an intuitive overview of vegetation distribution within Chalakkudy and serves as the primary output of the entire NDVI workflow.

Classification and Mapping.png
Classification and Mapping 1.jpg
Classification and Mapping 2.jpg

Result and Analysis:

The NDVI-based analysis of the Chalakkudy region highlights the spatial variation in vegetation cover and land use across the study area. By classifying the NDVI raster into four vegetation zones, it becomes evident that the landscape comprises a mix of ecological conditions ranging from water bodies and built-up areas to sparsely and densely vegetated zones.
The classified NDVI map reveals that a significant portion of the Chalakkudy region falls under sparse vegetation and barren or urban areas. These may correspond to agricultural fields in off-

season, degraded land, or human settlements. In contrast, dense vegetation is limited to small, concentrated pockets, likely representing forest patches, riverbank vegetation, or plantations.
Water bodies were distinctly identified in the NDVI output by negative or near-zero values, which is consistent with the spectral behavior of open water. Their presence along river stretches and lowland zones confirms the accuracy of the NDVI classification.

Results and Analysis.jpg

To quantify the extent of each vegetation zone, pixel-based statistics were computed. Using the known spatial resolution of Landsat 8 (30 meters per pixel), the following area distribution was derived:

  • Water bodies: Approximately 4.2 km², located primarily along the Chalakkudy River and its tributaries

  • Barren/urban areas: Around 108.8 km², reflecting both built-up zones and open, non- vegetated land

  • Sparse vegetation: About 141.6 km², the dominant class across the region, likely including cropland, plantations, and degraded forest

  • Dense vegetation: Just 0.15 km², concentrated in isolated forested pockets or highly vegetated areas

​

These statistics provide important insights into the ecological structure of the region and reveal an imbalance between vegetated and non-vegetated areas, which may warrant further environmental assessment. The results also reflect the terrain and land use dynamics of Chalakkudy, where vegetation varies widely due to natural and anthropogenic influences.

Overall, the analysis aligns well with the known geographical and ecological profile of the region and demonstrates the utility of NDVI as a tool for large-scale vegetation monitoring.

Conclusion:

This project successfully demonstrated the effective use of the Normalized Difference Vegetation Index (NDVI) as a remote sensing tool for assessing and classifying vegetation in the Chalakkudy region of Kerala. By employing a structured, Python-based geospatial workflow, Landsat 8 imagery was processed to calculate NDVI, spatially clip the analysis to the study area, classify vegetation zones, and generate interpretable visual outputs. The integration of open- source tools such as rasterio, geopandas, matplotlib, and numpy allowed for an efficient and reproducible methodology suitable for both academic research and practical environmental assessments.The resulting NDVI maps and area statistics reveal that Chalakkudy is predominantly composed of sparse vegetation and barren land, with very limited areas of dense green cover. This spatial pattern aligns with the mixed land use and landscape characteristics of the region, which includes agricultural fields, plantations, and semi-urban settlements. The project also successfully identified water bodies using NDVI thresholds, confirming the reliability of the classification approach.
Importantly, the methodology adopted in this project can be applied to other geographic regions for similar ecological analyses. The automation and flexibility provided by Python make it well- suited for periodic monitoring, especially in data-scarce or resource-limited environments.For future studies, several improvements can be considered. These include the use of multi-seasonal NDVI analysis to assess vegetation dynamics over time, integration with climatic or rainfall data to understand environmental drivers, and advanced classification algorithms such as machine learning-based segmentation for improved accuracy. Incorporating higher-resolution imagery or combining NDVI with other vegetation indices (e.g., EVI, SAVI) could further enhance the precision and interpretability of vegetation assessments.Overall, this project illustrates how NDVI-based spatial analysis can contribute to landscape monitoring, ecological planning, and sustainable land management initiatives by offering insights into vegetation distribution and health at a regional scale.

bottom of page