0
var dataset = ee.FeatureCollection('USDOS/LSIB/2013')
            .filterBounds(ee.Geometry.Point(-7.681, 53.43));
var image = ee.Image().float().paint(dataset, 'iso_num');

var visParams = {
 palette: ['f5ff64', 'b5ffb4', 'beeaff', 'ffc0e8', '8e8dff', 'adadad'],
 min: 0.0,
 max: 894.0,
 opacity: 0.8,
 };
 Map.addLayer(image, visParams, 'USDOS/LSIB/2013');

 // The input image has a SR-ORG:6974 (sinusoidal) projection.
 var image1 = ee.ImageCollection('MODIS/MOD13A1')
           .filter(ee.Filter.date('2016-01-01', '2016-01-31'))
           .filterBounds(dataset)
           .mean();

var ndvi = image1.select('NDVI');
var ndviVis = {
 palette: [
'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
'66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
'012E01', '011D01', '011301'
 ],
 };
 Map.addLayer(ndvi, ndviVis, 'NDVI');

This is my code, it works, however, the map shows the NDVI for the entire world. Is it because of the different coordination system? I tried to convert it to the same, but the Google Earth Engine API only had the projection transformation of a single image, and do not have the code for transformation of the image collection. How can I do it?

This is the link of my code https://code.earthengine.google.com/c1132b4753acf26b4ce5f93cca6ff070

1 Answer 1

1

You can clip your image to the geometry you're interested in:

var ndvi = image1.select('NDVI').clip(dataset.geometry());

https://code.earthengine.google.com/0f3776e9e41fd209f55eda4f3a8e84ad

1
  • Hi, Thank you and it works. so do you know what's the matter with my code? Why use clip(dataset.geometry() instead of using clip.(dataset). Because it(clip.(dataset)) works in the Landsat and Sentinel data for mapping NDVI Commented Feb 5, 2020 at 23:27

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.