Skip to main content
corrected small typo
Source Link

After a comment was made here I was reminded of this question. After a while I was able to solve my issues, I wrote a little tutorial of how to export imagery in my github page, but the most relevant to me was the following:

  • Defining my arearea to be clipped didn't worked after using bounds, so I ended up doing the following to convert the patch around the pixel to an ee.Geometry.Rectangle object:
    region= point.buffer(len/2).bounds().getInfo()['coordinates']
    #defining the rectangle
    coords=np.array(region)
    #taking min and maxs of coordinates to define the rectangle
    coords=[np.min(coords[:,:,0]), np.min(coords[:,:,1]), np.max(coords[:,:,0]), np.max(coords[:,:,1])]
    rectangle=ee.Geometry.Rectangle(coords)
  • The rest of the problems were associated to the arguments used when exporting the function. To clip the image, I used image.filterBounds(rectangle).mean(), where image is an ee.ImageCollection object, and rectangle is the previously defined geometry. Using mean() converts this to an ee.Image object.

    With that done, I added the following arguments to either the ee.batch.Export.image.toDriveor ee.batch.Export.image.toCloudStorage besides the obvious ones (like the image we are exporting or the destination of the file:

    • region=str(region) to pass the previous list of coordinates of the geometry as a string.
    • dimensions="33x33" to pass the number of pixels to be included in the image.
  • When the image was exported to either of the sources, I used the imageio package, and did something like np.array(imageio.imread(image_path)) to convert the image from TIFF to an np.array.

After a comment was made here I was reminded of this question. After a while I was able to solve my issues, I wrote a little tutorial of how to export imagery in my github page, but the most relevant to me was the following:

  • Defining my are to be clipped didn't worked after using bounds, so I ended up doing the following to convert the patch around the pixel to an ee.Geometry.Rectangle object:
    region= point.buffer(len/2).bounds().getInfo()['coordinates']
    #defining the rectangle
    coords=np.array(region)
    #taking min and maxs of coordinates to define the rectangle
    coords=[np.min(coords[:,:,0]), np.min(coords[:,:,1]), np.max(coords[:,:,0]), np.max(coords[:,:,1])]
    rectangle=ee.Geometry.Rectangle(coords)
  • The rest of the problems were associated to the arguments used when exporting the function. To clip the image, I used image.filterBounds(rectangle).mean(), where image is an ee.ImageCollection object, and rectangle is the previously defined geometry. Using mean() converts this to an ee.Image object.

    With that done, I added the following arguments to either the ee.batch.Export.image.toDriveor ee.batch.Export.image.toCloudStorage besides the obvious ones (like the image we are exporting or the destination of the file:

    • region=str(region) to pass the previous list of coordinates of the geometry as a string.
    • dimensions="33x33" to pass the number of pixels to be included in the image.
  • When the image was exported to either of the sources, I used the imageio package, and did something like np.array(imageio.imread(image_path)) to convert the image from TIFF to an np.array.

After a comment was made here I was reminded of this question. After a while I was able to solve my issues, I wrote a little tutorial of how to export imagery in my github page, but the most relevant to me was the following:

  • Defining my area to be clipped didn't worked after using bounds, so I ended up doing the following to convert the patch around the pixel to an ee.Geometry.Rectangle object:
    region= point.buffer(len/2).bounds().getInfo()['coordinates']
    #defining the rectangle
    coords=np.array(region)
    #taking min and maxs of coordinates to define the rectangle
    coords=[np.min(coords[:,:,0]), np.min(coords[:,:,1]), np.max(coords[:,:,0]), np.max(coords[:,:,1])]
    rectangle=ee.Geometry.Rectangle(coords)
  • The rest of the problems were associated to the arguments used when exporting the function. To clip the image, I used image.filterBounds(rectangle).mean(), where image is an ee.ImageCollection object, and rectangle is the previously defined geometry. Using mean() converts this to an ee.Image object.

    With that done, I added the following arguments to either the ee.batch.Export.image.toDriveor ee.batch.Export.image.toCloudStorage besides the obvious ones (like the image we are exporting or the destination of the file:

    • region=str(region) to pass the previous list of coordinates of the geometry as a string.
    • dimensions="33x33" to pass the number of pixels to be included in the image.
  • When the image was exported to either of the sources, I used the imageio package, and did something like np.array(imageio.imread(image_path)) to convert the image from TIFF to an np.array.

Source Link

After a comment was made here I was reminded of this question. After a while I was able to solve my issues, I wrote a little tutorial of how to export imagery in my github page, but the most relevant to me was the following:

  • Defining my are to be clipped didn't worked after using bounds, so I ended up doing the following to convert the patch around the pixel to an ee.Geometry.Rectangle object:
    region= point.buffer(len/2).bounds().getInfo()['coordinates']
    #defining the rectangle
    coords=np.array(region)
    #taking min and maxs of coordinates to define the rectangle
    coords=[np.min(coords[:,:,0]), np.min(coords[:,:,1]), np.max(coords[:,:,0]), np.max(coords[:,:,1])]
    rectangle=ee.Geometry.Rectangle(coords)
  • The rest of the problems were associated to the arguments used when exporting the function. To clip the image, I used image.filterBounds(rectangle).mean(), where image is an ee.ImageCollection object, and rectangle is the previously defined geometry. Using mean() converts this to an ee.Image object.

    With that done, I added the following arguments to either the ee.batch.Export.image.toDriveor ee.batch.Export.image.toCloudStorage besides the obvious ones (like the image we are exporting or the destination of the file:

    • region=str(region) to pass the previous list of coordinates of the geometry as a string.
    • dimensions="33x33" to pass the number of pixels to be included in the image.
  • When the image was exported to either of the sources, I used the imageio package, and did something like np.array(imageio.imread(image_path)) to convert the image from TIFF to an np.array.