4

I want to download a clipped version of image with getDownloadURL(), but the result only maintains the bounds of clip polygon, not the shape itself.

This is an example script:

var no2_coll = ee.ImageCollection("COPERNICUS/S5P/OFFL/L3_NO2");

// irregularly shaped polygon
var aoi = ee.Geometry.Polygon([[[36.19717602142744, 36.235397497040246], [35.03262524017744, 34.38876424418324],
[39.17447094330244, 34.37062991132883], [39.41617016205244, 36.36820725445314], [38.17471508392744, 35.3890351383359]]]);

var image = no2_coll.select("tropospheric_NO2_column_number_density")
  .filterBounds(aoi).first();


// this clips an image, but has no effect on result of .getDownloadURL()
var img_clip = image.clip(aoi);

// this has effect on result of .getDownloadURL()
var img_clip_double_mask = img_clip.mask(img_clip.mask());

var downloadArgs = {
  name: 'expected_clipped_image',
  crs: image.projection(),
  scale: 7000,
  region: aoi
};

var url = img_clip_double_mask.getDownloadURL(downloadArgs);

print(url);

So while both img_clip and img_clip_double_mask are rendered as a clipped image on Map, it is only when you change img_clip to img_clip_double_mask (essentially self masking - but seems redundant) when you get clipped image from .getDownloadURL().

Why is that?

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.