I'm pretty new to Google Earth Engine.

I'm trying to add an NDVI and Pollution layer onto a static image in GEE Python API but I haven't found any documentation for it. I understand this is possible using geehydro and Folium but the client that I ultimately want to display my results in do not support maps, only static images.

The closest I have come so far managed to produced an image (code below). However, the map is extremely warped and is unusable for analysis.

Is there a way to "flatten" this image or create layered images more reliably?

dem = ee.Image('MODIS/006/MOD13A2/2018_01_17').select('NDVI')
AOI = ee.Geometry.Rectangle([-180,-75, 180, 75])
# Display a thumbnail of global elevation.
Image(url = dem.updateMask(dem.gt(0))
  .getThumbURL({'min': 0, 'max': 3000, 'dimensions': 512, 'palette': ['red', 'yellow', 'green'], 'region': AOI,


1 Answer 1


The image is not actually warped; what you're seeing is the image in its native projection. Most image export operations let you ask for a specific projection, but for getThumbURL you need to specify it separately by changing the default projection in the image:

  .setDefaultProjection('EPSG:3857', [1, 0, 0, 0, -1, 0])
  .getThumbURL({'min': 0, 'max': 3000, 'dimensions': 512, 'palette': ['red', 'yellow', 'green'], 'region': AOI})

I chose EPSG:3857 "Web Mercator" as the projection familiar from e.g. the Earth Engine Code Editor, but you should use the projection that you actually want to perform your analysis on, or that your "static image" is in.

The argument [1, 0, 0, 0, -1, 0] specifies a coordinate transform that flips the image to be north-up instead of the default outcome of south-up (which would be written [1, 0, 0, 0, 1, 0]).

There's another problem to fix, too: your rectangle ee.Geometry.Rectangle([-180,-75, 180, 75]) does not cover the region you think it does. Geometries default to geodesic edges, which means that each line is not a straight line in your chosen projection but a great-circle arc on the surface of the earth. Therefore, your shape actually covers the entire earth because that's the shortest path that joins the corners at the 'top' and 'bottom' edge. Trying to export/download this as an image will always produce an error.

To fix this, you need to ask for non-geodesic interpretation (in which the top and bottom edges will follow lines of latitude):

ee.Geometry.Rectangle(coords=[-180,-75, 180, 75], geodesic=false)

Runnable JS version in Earth Engine Code Editor

  • Thank you for the reply! I have managed to get a "flattened" map. However, I ran into and error whe setting a boolean into geodesic: EEException: Projection: Argument 'crs': Invalid type. Expected type: String. Actual type: Boolean. Actual value: false
    – Shawn Lim
    Jul 17, 2020 at 12:36
  • Update: Upon doing some googling, I realised this might an open bug that you can work around by setting "proj=None" after the geodesic variable. See here. Not sure how proj changes things though
    – Shawn Lim
    Jul 17, 2020 at 12:47
  • @ShawnLim That will be fine; you're just specifying to use the default, which is degrees latitude and longitude in WGS 84 (which if written explicitly would be crs='EPSG:4326').
    – Kevin Reid
    Jul 17, 2020 at 15:29

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.