Joey Roses
Joey Roses

Reputation: 11

Exporting data set from Google Earth Engine for use in Google Earth

So I have a date range of MODIS temperature images that I am attempting to export from GEE for use in Google Earth. This is what the code looks like thus far:

var dataset = ee.ImageCollection('MODIS/006/MYD11A2')
                  .filter(ee.Filter.date('2018-05-01', '2018-06-01'));
var landSurfaceTemperature = dataset.select('LST_Day_1km');
var landSurfaceTemperatureVis = {
  min: 14000.0,
  max: 16000.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(-85.60371794450282,44.73590436363271, 8);
Map.addLayer(
    landSurfaceTemperature, landSurfaceTemperatureVis,
    'Land Surface Temperature');

// Create a geometry representing an export region.
var features = ee.Geometry.Rectangle([-85.1417893413635, 45.31413490213395, -86.125065708551, 44.65070625463291]);

Where I am having trouble is coding the export feature that would allow for an overlay to be placed into Google Earth. This is what I have now:

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: dataset.filter('LST_Day_1km'),
  description: 'Overlay',
  scale: 30,
  region: features
});

So what do I need to add to that code to facilitate the export of the color-coded data set into a .kmz, GeoTIFF or some sort of file that could be overlayed in Google Earth? Do I need to .sum() the image set prior to export?

This is for personal use, so I do not need to embed it into a website, so I don't think I will need to use the API provided by Earth Engine....or do it?

Upvotes: 1

Views: 2631

Answers (1)

Lukasz Tracewski
Lukasz Tracewski

Reputation: 11367

The Export.image already exports in GeoTIFF format, that's the default for fileFormat argument. Your real issue is that your code won't work in this form. dataset is a collection with multiple bands, while export works with type Image. You'd need to e.g. select specific band and image. The latter can be e.g. first item in the collection or some sort of aggregation - up to you.

Here's an example:

Export.image.toDrive({
  image: dataset.select('LST_Day_1km').first(),
  description: 'Overlay',
  scale: 30,
  region: features,
  fileFormat: 'GeoTIFF'
});

Upvotes: 0

Related Questions