I try to generate a feauture collection of 1 single rectangle coverring the whole world. The why is here unrelevant. In my test suit I want to check that this rectange exista and that its coordinates are effectively the min/max of EPSG:4326.

Here is how I build the object:

rectangle = ee.Geometry.Rectangle([-180, -90, 180, 90])
fc = ee.FeatureCollection(data2)

surprisingly if try to get the coordinates of the total geometry I get infinity everywhere:

coords = fc.geometry().bounds().coordinates().getInfo()
>>> [['-Infinity', '-Infinity'],
 ['Infinity', '-Infinity'],
 ['Infinity', 'Infinity'],
 ['-Infinity', 'Infinity'],
 ['-Infinity', '-Infinity']]

but if I do the same without extracting the coordinate I see the expected values in the json :

json = fc.geometry().bounds().getInfo()
>>> {'type': 'Polygon',
 'coordinates': [[[-180, -90],
   [180, -90],
   [180, 90],
   [-180, 90],
   [-180, -90]]]}

Can someone explain what is happening when I extract them ?

1 Answer 1


coordinates() forces a reprojection into the geometry's coordinate system, which is where things go wrong. Everything up to that is done in WGS84 without reprojection. (Even though the geometry's coordinate system is probably also WGS84, it still goes through a reprojection).

In general, you should always use a 6-point non-geodesic polygon when you want to refer to the whole world, to avoid these kinds of projection issues.

var WORLD = ee.Geometry.Polygon([
    [-180, 90], [0, 90], [180, 90], 
    [180,-90], [0, -90], [-180,-90]], 
    null, false);

Even better, stay a degree or two away from the poles unless you really have a compelling reason to include them (almost no one ever does).

Your Answer

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

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