1

I want to export statistics from one of the MODIS ImageCollection to an image as I'm using these values on regular basis. The geometry associated with these datasets is the whole world meaning that on any of the images of the image collection I got:

image.geometry().coordinates().getInfo()
{'type': 'Polygon',
 'coordinates': [[[-180, -90],
   [180, -90],
   [180, 90],
   [-180, 90],
   [-180, -90]]]}

Then when I try to export it no pixels are actually selected and my image becomes blank (the js version)

ndvi = ee.ImageCollection("MODIS/061/MOD13Q1").select("NDVI")
history = ndvi.filterDate("2000-01-01", "2019-01-01")
image = history.min().rename("min").addBands(history.max().rename("max"))

ee.batch.Export.image.toAsset(
  image = image,
  description = "min-max ndvi",
  assetId = "projects/ldc-main-crop/assets/MODIS/MOD13Q1_NDVI",
  region = image.geometry(),
  scale = image.projection().nominalScale().getInfo()
)

Why can I not use the image geometry as an export region? How do I set an export parameter to keep the same footprint for my end image as the MODIS one I don't want to get a weird pole excluding -179,99999999999°, -89,999999999999°, I'm looking for the exact same footprint.

3
  • Poles are infinitely far from the Equator in Web Mercator. Try computing tangent(89.999999999999) and see what happens.
    – Vince
    Commented Aug 2 at 6:28
  • and alternatively what if I export in EPSG:4326 instead? Commented Aug 2 at 9:40
  • I tried but it's not satifactory because by using tangent the geometry() associated with my image is not aligned with the original one. Commented Aug 2 at 9:44

1 Answer 1

0

The issue here seems to be with the way Earth Engine handle geometry around the poles not with an image footprint (although it's still problematic).. Both of the following would not return a bounded region regardless of any image (which is fair to relief us from discussing projection)

Map.addLayer(ee.Geometry({'type': 'Polygon',
 'coordinates': [[[-180, -90],
   [180, -90],
   [180, 90],
   [-180, 90],
   [-180, -90]]]}))
Map.addLayer(ee.Geometry.Polygon([
        -180, 90, 
           0, 90 ,
         180, 90 ,
         180, -90, 
           0, -90,
        -180, -90], null, false))

The other thing is the output of image collection reducer e.g., min/max is a mosaic that has no specific scale and is in 'EPSG:4326' projection. It doesn't really have a footprint either (like an ee.Image(0): it has a world boundary but with infinite coordinates repeating itself)

image.projection().nominalScale().aside(print)

returns 111319.49079327357 image.geometry().coordinates().aside(print) returns

List (1 element) 0:
 List (5 elements) 
  0:["-Infinity","-Infinity"] 
  1:["Infinity","-Infinity"] 
  2:["Infinity","Infinity"] 
  3:["-Infinity","Infinity"]
  4:["-Infinity","-Infinity"]

If there is no specific reason to include the poles areas (you actually don't have data over the poles anyway), you can just work around this by exporting for a defined bounding box that exclude the poles and define projection and scale

Export.image.toAsset({
  image: image,
  description: "min-max_ndvi",
  region: ee.Geometry.Polygon([
        -180, 85, 
           0, 85, 
         180, 85, 
         180, -62, 
           0, -62,
        -180, -62], null, false),
  crs: 'EPSG:4326',
  scale: 231.65635826395828, //history.first().projection().nominalScale()
  maxPixels: 1e13,
})

PS check if you really need the original MODIS scale ~250 or coarse scale is acceptable for global image, my try took >1 h to export min/max

3
  • I'm exporting it specifically because I need this reolutionk in a pipeline so this will be a 1 time 1h export instead of slowing down everything. About my bounding box issue. This is a practical exemple, the real issue comes from a method that try to "guess" the bounding box from the original image (they can be anything in my context) that fail systematically on this world-wide example. Commented Aug 4 at 18:32
  • 1
    Also if the modis image has a world-wide extend, it has been exported to GEE at some point right ? so the question is ... how ? Commented Aug 4 at 18:32
  • I see the point, and this doesn't answer the why! I intended to put this workaround as a comment but it was just too long to fit. Have you tried to reporject the world mosaic before exporting (i.e., force projection and scale using .reporject()) When I tried this it took +2h to export and I had to cancel it before it's done, but it was exporting something!
    – Es_a
    Commented Aug 5 at 1:44

Your Answer

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

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