importing the landsat 5 TM 32-day NDVI composite data set.

I have made it as far as drawing a polygon of my ROI and extracting from a different data set, a global land cover map (ESA/GLOBCOVER_L4_200901_200912_V2_3) which was linked from another question posted on here:

Drawing polygon and extracting land cover inside using Google Earth Engine?

I tried to reconfigure it to work with my Landsat NDVI set and I was met with errors. I tried to extract just the NDVI band and try with that, but I keep getting an error:

land.clip is not a function in , line #

var landsat: Imagecollection "Landsat 5 TM 32-Day NDVI Composite"  
var geometry: Polygon, 4 vertices  
var globcover: Image "GlobCover: GLobal Land Cover Map"

// Extract the landcover band    
var land = globcover.select('landcover');    
// Clip the image to the polygon geometry    
var landcover_roi = land.clip(geometry);  
// Add a map layer of the landcover clipped to the polygon.  
Map.addLayer(landcover_roi);

reworking to accomodate the landsat:

// Extract the landcover band  
    var land = landsat.select('NDVI');  
    // Clip the image to the polygon geometry  
    var landcover_roi = land.clip(geometry);  
    // Add a map layer of the landcover clipped to the polygon.  
    Map.addLayer(landcover_roi);

This is where I get the error,

land.clip is not a function in <global> line 4.

I am attempting to draw a polygon (square) around an area on the LS5NDVI data, export the "data cube", and correlate the time NDVI values at each pixel against various climate data to produce a single layer "heat map" of sorts to visually represent the correlation at each pixel.

  • It appears that you simply copied the "Imports" section of the Code Editor window, so your "landsat", "geometry", and "globcover" objects cannot be easily reproduced by others. It would be better to click on the blue "Show generated code" icon and copy the Javascript code that defines the objects into the question that you posted here. – Tyler Erickson Aug 2 '16 at 16:39

The code that you copied uses an Earth Engine object of type "Image", and Image objects have a method/function named clip. Your reworked code (i.e. Landsat) uses an Earth Engine object of type "ImageCollection", and ImageCollection objects do not have a method named clip, so it produces an error. To get around this, you can either:

  1. Convert the ImageCollection to an Image using a reducing method (i.e. median, mode, mosaic, max, etc.)
  2. Write a function that clips an Image object, and map that function over the collection using ee.ImageCollection.map().

Also, it probably doesn't make sense to add the entire Landsat 5 collection as a layer on the interactive map... it contains over 25 years of data. Add a step that filters the Landsat collection down to a shorter time interval, using ImageCollection.filterDate().

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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