0

I have a set of images I have processed. Unfortunately, the geometry of the image processed do not always fit the image data.

Problem: Let's assume I have an imageCollection. Then, when I would like to filter by bounds according the green area (using filterBounds). The 'blue' image will be selected whereas I don't want (no data in the green area).

Illustration:

  • blue is the image data
  • dark the image geometry
  • green is the region of interest

enter image description here

Question: Knowing the geometry where there is data (I know it from image before pre-processing), how can I refit the image geometry ?

My attempts:

  • to update the property system:footprint with:

    image = image.set('system:footprint', mygeometry)
    

    But, then, when I call image.geometry(), the geometry hasn't been updated.

  • clip function: the documentation clearly explains this is applying a mask, do not update the geometry.

Reproducibility: Link code

1

Your code is fine, it's doing what you need, but you are not watching right the results:

var image = imageCollection.first();
var bad_footprint = image.geometry()

Map.addLayer(image, imageVisParam, "Original Image");
Map.addLayer(image.geometry(), {}, "Image footprint (bad)");
Map.centerObject(image);

var original_image = ee.Image("COPERNICUS/S2/20180105T112439_20180105T112439_T30VVH");
var good_footprint = original_image.geometry()

// set footprint of image
var image_updated = image.set('system:footprint', good_footprint);
Map.addLayer(image_updated.geometry(), {}, "New Image footprint (good)");

https://code.earthengine.google.com/cb0f8ae5ae6193b2678a37f7ee2e8433

|improve this answer|||||
  • Thank you for the reply ! Feel so clumsy about the example. Do you know if we can apply this update while exporting images. Once image has been exported, the updated geometry seems overwritten (and come back to the unfitted area). – Alexandre B. Jul 15 '19 at 14:08

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.