I tried to generate Landsat NDVI time series for Fagge, Nigeria from 1993 to 2022 on Google Earth Engine but the output chart started from 1998 despite several items.

Can you assist with the code?

Here is the code below:

// Define the location of interest (Fagge, Nigeria).
var point = ee.Geometry.Point(12.0308, 8.5294);

// Define the time range.
var startDate = ee.Date('1993-01-01');
var endDate = ee.Date('2022-12-31');

// Function to calculate NDVI.
var calculateNDVI = function(image) {
  var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
  return image.addBands(ndvi);

// Filter and aggregate Landsat data (Landsat 5 to Landsat 8).
var landsatCollection = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
  .filterDate(startDate, endDate)

// Define a function to calculate the annual mean NDVI.
var calculateAnnualNDVI = function(year) {
  var annualNDVI = landsatCollection
    .filter(ee.Filter.calendarRange(year, year, 'year'))
    .set('year', year);
  return annualNDVI;

// Create a sequence of years from 1993 to 2022.
var years = ee.List.sequence(1993, 2022);

// Calculate the annual mean NDVI for each year.
var annualNDVIList = years.map(function(year) {
  return calculateAnnualNDVI(year);

// Create an image collection from the list of annual NDVI images.
var annualNDVICollection = ee.ImageCollection(annualNDVIList);

// Create a chart of annual NDVI values.
var chart = ui.Chart.image.series({
  imageCollection: annualNDVICollection,
  region: point,
  reducer: ee.Reducer.mean(),
  scale: 30,
  xProperty: 'year'
  title: 'Annual NDVI Time Series',
  hAxis: {title: 'Year'},
  vAxis: {title: 'NDVI'}

// Print the chart to the console.

// Export the annual NDVI values to a CSV file.
  collection: annualNDVICollection,
  description: 'Fagge_Annual_NDVI',
  folder: 'Your_GEE_Folder_Name',
  fileNamePrefix: 'Fagge_Annual_NDVI',
  fileFormat: 'CSV'

1 Answer 1


Unfortunately, there are no available images for your point of interest during that time. You can print the images in the collection prior to making your chart:

var point = ee.Geometry.Point(12.0308, 8.5294);
var startDate = ee.Date('1984-03-01');
var endDate = ee.Date('1998-12-31');
var landsatCollection = ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
  .filterDate(startDate, endDate)
// ^^ Large gap between 19920104 and 19981104

You will see that there is a large gap between the image acquired in 19920104 and 19981104.

See also: Poor Landsat 5 coverage in Google Earth Engine


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.