# Using Landsat Images to calculate NDVI for any country (Sample: India)

### Normalized Difference Vegetation Index (NDVI)

The Normalized Difference Vegetation Index (NDVI) is referred to as the continuity index to the existing National Oceanic and Atmospheric Administration-Advanced Very High-Resolution Radiometer (NOAA-AVHRR) derived NDVI.

The NDVI is calculated from these individual measurements as follows:

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

In this tutorial, we will look at a simple method to calculate NDVI for India (sample area). You can edit the code and calculate NDVI for any country.

### Data used

USGS Landsat 8 Collection 1 Tier 1 and Real-Time data TOA Reflectance

Landsat 8 Collection 1 Tier 1 and Real-Time data calibrated top-of-atmosphere (TOA) reflectance. Calibration coefficients are extracted from the image metadata. See Chander et al. (2009) for details on the TOA computation.

Revisit Interval
16 days

Here is the code:

``````var countries = ee.FeatureCollection("ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw")
var country_name = ['India']
var Area = countries.filter(ee.Filter.inList('Country', country_name));
Map.centerObject(Area, 5);  //Zoom to Study area/

// Import Landsat 8 images
var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT_TOA")
var MyCollection = L8.filterBounds(Area)
.filterDate('2014-01-01','2018-12-31');

var ndviParams = {min: -1, max: 1, palette: ['blue', 'white', 'green']};

function CalculateNDVI(image){
var selected =image.select('B4','B5');
var NDVI = selected.expression('(b(1)-b(0))/(b(0)+b(1))').select(['B5'],['NDVI']);
return NDVI;
}

var NDVIcollection = MyCollection.map(CalculateNDVI);