1

I am working on the Surface water data in google earth engine. I want to export the tiff files from here and use them in Mapbox.

I am trying to export tiff images from google earth engine but My images are coming out to be geometrically wrong.

I tried everything I knew but I don't know where I am doing wrong.

// Asset List
var gsw = ee.Image('JRC/GSW1_0/GlobalSurfaceWater');
var occurrence = gsw.select('occurrence');
var change = gsw.select("change_abs");
var roi = /* color: 0B4A8B */ee.Geometry.Polygon(
        [[[-74.17213, -8.65569],
          [-74.17419, -8.39222],
          [-74.38362, -8.36980],
          [-74.43031, -8.61293]]]);

// Constants

var VIS_OCCURRENCE = {
    min:0,
    max:100,
    palette: ['red', 'blue']
};
var VIS_CHANGE = {
    min:-50,
    max:50,
    palette: ['red', 'grey', 'limegreen']
};
var VIS_WATER_MASK = {
  palette: ['white', 'black']
};

//////////////////////////////////////////////////////////////
// Calculations
//////////////////////////////////////////////////////////////

// Create a water mask layer, and set the image mask so that non-water areas are transparent.
var water_mask = occurrence.gt(90).mask(1);

// Generate a histogram object and print it to the console tab.
var histogram = ui.Chart.image.histogram({
  image: change,
  region: roi,
  scale: 30,
  minBucketWidth: 10
});
histogram.setOptions({
  title: 'Histogram of surface water change intensity.'
});
print(histogram);

//////////////////////////////////////////////////////////////
// Initialize Map Location
//////////////////////////////////////////////////////////////

// Uncomment one of the following statements to center the map on
// a particular location.
// Map.setCenter(-90.162, 29.8597, 10);   // New Orleans, USA
// Map.setCenter(-114.9774, 31.9254, 10); // Mouth of the Colorado River, Mexico
// Map.setCenter(-111.1871, 37.0963, 11); // Lake Powell, USA
// Map.setCenter(149.412, -35.0789, 11);  // Lake George, Australia
// Map.setCenter(105.26, 11.2134, 9);     // Mekong River Basin, SouthEast Asia
// Map.setCenter(90.6743, 22.7382, 10);   // Meghna River, Bangladesh
// Map.setCenter(81.2714, 16.5079, 11);   // Godavari River Basin Irrigation Project, India
// Map.setCenter(14.7035, 52.0985, 12);   // River Oder, Germany & Poland
// Map.setCenter(-59.1696, -33.8111, 9);  // Buenos Aires, Argentina\
Map.setCenter(77.1025, 28.7041, 5);  // India

//////////////////////////////////////////////////////////////
// Map Layers
//////////////////////////////////////////////////////////////

Map.addLayer({
  eeObject: water_mask,
  visParams: VIS_WATER_MASK,
  name: '90% occurrence water mask',
  shown: false
});
Map.addLayer({
  eeObject: occurrence.updateMask(occurrence.divide(100)),
  name: "Water Occurrence (1984-2015)",
  visParams: VIS_OCCURRENCE,
  shown: false
});
Map.addLayer({
  eeObject: change,
  visParams: VIS_CHANGE,
  name: 'occurrence change intensity'
});


Export.image.toDrive({
image: gsw.toInt32(),
description: 'gsw',
region: gsw,
scale:250

});






    The expected output is multiple Tiff files that show complete data.
Lalit Ojha
  • 11
  • 2
  • Could you [edit] your question to clarify what you mean by "geometrically wrong"? Is it in the wrong projection? Does it contain the wrong region? Tell us what you need, not just that it isn't working for you. – Kevin Reid Jun 23 '19 at 16:46
  • I had a problem like this also - have you changed your images to be the correct projection for mapbox? If you have not, I can help. – David Jun 24 '19 at 03:58

1 Answers1

0

Maybe you forgot to add type of the image that you want to export

//Export
Export.image.toDrive({
  image: image that you wanna export,
  description: 'file name',
  scale: 250,
  folder: 'your folder name',
  region: you region,
  fileFormat: 'GeoTIFF'
})