3

I am new to Google Earth Engine and was trying to run a script to get Landsat images of districts of India after having a fusion table of shapes of all districts. GEE script is as:

var india = ee.FeatureCollection('ft:1UDdgOCf8DoRJ9bVm-UVbR6CqxtkJToLQjTFd0r0Z','geometry')
    .filter(ee.Filter.eq('Name', 'India'))
    .geometry();
var district = ee.FeatureCollection('ft:1_GTWq6xk3hMYl6LelMm8o3VlnoHH0bsFUzLiW3_i','geometry')
    .filter(ee.Filter.eq('district', district_name));

where district_name is a defined variable containing the name of a district

 var india_image = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
    .filterBounds(india)
    .filterDate('2014-03-01', '2014-09-01')
    .sort('CLOUD_COVER')
    // .limit(500)
    .map(maskClouds)
    .median();
var district_image = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
    .filterBounds(district)
    .filterDate(year + '-03-01', year + '-05-01')
    .sort('CLOUD_COVER')
    .map(maskClouds)
    .median();

and then after performing few actions having no affect on any of the variables, I am exporting these images to my Google drive.

Export.image.toDrive({
  image: input.clip(district),
  description: district_name + '_summer_' + year,
  folder : 'Project_data',
  maxPixels: 499295920080,
  scale: 30,
  region: district
});

But here after executing and pressing "RUN" button in "Tasks" pane of GEE, I am getting the error "A region must be a GeoJSON Polygon or LinearRing. Got: 'MultiPoint'"

Link to GEE script: GEE script

What could have gone wrong and How do I deal with this?

1 Answer 1

0

Use distric.geometry().bounds() or district.union().bounds() in the Export call. Even better, just draw a nice, simple rectangle around the place you want.

4
  • I checked both district.geometry() and district.union() one after the other and got the same error "A region must be a GeoJSON Polygon or LinearRing. Got: 'MultiPoint'", please also explain what do you mean by drawing a simple rectangle @Nicholas
    – Mayan19
    Jul 2, 2019 at 2:56
  • I have edited the answer with what I think is a fix. Try appending bounds(). This will return the bounding box of whatever is in that FeatureCollection. Jul 2, 2019 at 16:23
  • tried 'district.union().bounds()' but got error: "district.union(...).bounds is not a function" on console. @Nicholas
    – Mayan19
    Jul 3, 2019 at 4:08
  • The 'district' property is a geometry, so I don't see how your filter is going to work. Second, you need to supply a polygon geometry to Export.image. That is provided by featureCollection.geometry() or featureCollection.union(). If you are filtering a FeatureCollection, you get another FeatureCollection, in which case you need to get the first() thing out, then call bounds() (you just need to cast to ee.Feature). code.earthengine.google.com/b36b660ca1f7a877bb508e920ac10b27. Please note the Docs tab, from which you can learn about the return types of these methods. Jul 3, 2019 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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