0

I want to export the SRTM 30 m elevation data and slope for the country of Indonesia. Here is my script using GEE.

However, on exporting the tiles to my Google Drive, I get this error message- A region must be a GeoJSON Polygon or LinearRing. Got: 'MultiPolygon'.

How do I deal with this i.e. how do I export the elevation (and slope) tiles for Indonesia to my Drive and then download it to my computer?

// Load the SRTM image.
var srtm = ee.Image('USGS/SRTMGL1_003'); //Calling SRTm 30m images

// Apply slope algorithm to an image.
var slope = ee.Terrain.slope(srtm); 

//Scale and Projection
var scale = srtm.projection().nominalScale();
print('SRTM scale in meters', scale); //see Console tab in the right section of screen- 30.92208 m
print('Projection, crs, and crs_transform:', srtm.projection()); //EPSG:4326 is WGS 1984, look at right section of screen 
// in the Console tab

// Load countries border
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');
var justcountry = countries.filterMetadata('Country', 'equals', 'Indonesia'); //change country name here
Map.addLayer(justcountry)

//Displaying slope for country
var elevcountry= srtm.clip (justcountry);
var slopecountry= ee.Terrain.slope(elevcountry);
//var slopecountry_radians= slopecountry.divide(180).multiply(Math.PI) //converting to radians 'divide the slope by 180, multiply the result of that by π
Map.addLayer(slopecountry); //to view

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: elevcountry,
  region: justcountry.geometry().bounds(),
  description: 'elev',
  scale: 30, //pixel size specified 
  maxPixels: 1e12
});
4

MultiPolygon exports are not supported. You can calculate the bounding box around your MultiPolygon and use that as export region.

Export.image.toDrive({
  image: elevcountry,
  region: justcountry.geometry().bounds(),
  description: 'elev',
  scale: 30, //pixel size specified 
  maxPixels: 1e12
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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