I am trying to get MODIS satellite data with Google Earth Engine to find temperature data of given points on a map. I would like to get an array of all the points in an area (every 1km square in California) and their temperatures in a given timeframe. The array would be kind of like this: [[temperature on December 10, temperature on December 11...], [...], [...]]

With each element corresponding to a different 1km square. So far, I have the following code to find the temperature of a specific point:

var dataset = ee.ImageCollection('MODIS/006/MOD11A1')
          .filter(ee.Filter.date('2018-12-10', '2018-12-23'));
var landSurfaceTemperature = dataset.select('LST_Day_1km');
var landSurfaceTemperatureVis = {
  min: 13000.0,
  max: 16500.0,
  palette: [
    '040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
    '0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
    '3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
    'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
    'ff0000', 'de0101', 'c21301', 'a71001', '911003'
Map.setCenter(-6.746, 46.529, 10);
Map.addLayer(landSurfaceTemperature, landSurfaceTemperatureVis, 'Land Surface Temperature');
// map over the image collection and use server side functions
var tempToDegrees = landSurfaceTemperature.map(function(image){
    return image.multiply(0.02).subtract(273.15);
// print and add to the map
//print('image collection in temp in degrees', tempToDegrees);
Map.addLayer(tempToDegrees, {min: -20, max: 40, palette: landSurfaceTemperatureVis.palette}, 'temp in degrees');
var point = ee.Geometry.Point(coordinates);
var data = dataset.select('LST_Day_1km').get('LST_Day_1km');
var dataN = ee.Number(data);

When I print dataN, the output is null. I want to print the temperature in degrees. How can I do this?

1 Answer 1


This can be easily accomplished by using reduceRegion(s) on an image. However, you have an image collection consisting of one band per image. Therefore, you will have to reduce the imagecollection to a multiband image first. How that is done, you can find HERE

From that multiband image if the land surface temperature in degrees, you can get the temperature at every date using:

var point = ee.Geometry.Point([2.3622940161999395, 42.569280018996714]); // a random point
// get the temperature at a given point on the map for the given time spand and print to the console
var temperature = multiband.reduceRegion({reducer: ee.Reducer.mean(), geometry: point, scale: 1000, bestEffort: true});
    print(' temperature at a single point', temperature);

If you make a feature collection of multiple points, you can apply reduceRegions and get statistics of multiple points at once:

var points = ee.FeatureCollection([ee.Feature(ee.Geometry.Point([1.362, 42.569]), {'label': 1}),
                                  ee.Feature(ee.Geometry.Point([2.362, 42.569]), {'label': 2}),
                                  ee.Feature(ee.Geometry.Point([3.362, 42.569]), {'label': 3})])
// calculate the temperature over the time span at every point in the AOI
var temperatures = multiband.reduceRegions({collection: points, reducer: ee.Reducer.mean(), scale: 1000});
print('feature collection of temperatures', temperatures);

Note that you do not have information at every pixel on every day, so you will null (no data) values at certain days and/or locations.

Here I have a link to the full code, where I added a way for you to easily make points at regular interval based on the pixel sizes, so you will have one point per pixel inside the area of interest you will define. Note that there is a maximum of 5000 features in a feature collection, so don't make your area to large or export the output.

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.