Google Earth Engine – Geometry Doesn’t Cover All Multipolygons with Geodesic False and Projection Null

google-earth-engine

I created 6 geometries with identical coordinates but with different settings of projection and geodesic. The coordinates I used is composed of two polygons. Then I use reduceRegion to print out the minimum and maximum latitude and longitudes.

The weird result is that when I do not specify the projection, and specify true for the geodesic parameter, the resulting range of latitude and longitude only covered the first polygon. On the other hand, the result for with projection specified as EPSG:4326 and geodeisc specified as true covered both polygons. But the GEE's documentation states:

The default is the projection of the inputs, where Numbers are assumed
to be EPSG:4326.

Which suggest that the two results should have been the same.

I also considered the possibility that GEE uses a pull-based method for projection and scale, so I tested results with the projection specified to be the same as that of the reducer (EPSG:4269). But they covered both polygons as well.

Note that when I plot all of the geometries (whether EPSG:4326, EPSG:4269, null) using Map.addLayer, they all looked the same.
Also note that when I specify geodesic as false, both polygons are covered as well.

Below is my code:

var coords = [
  [[-140, 54], [-130, 54], [-130, 60], [-140, 60], [-140, 54]],
  [[-125, 28], [-72, 28], [-72, 50], [-125, 50], [-125, 28]]
  ]

var geometry4326Geodesic = ee.Geometry.MultiPolygon(coords, 'EPSG:4326', true)
var geometry4326Planner = ee.Geometry.MultiPolygon(coords, 'EPSG:4326', false)
var geometry4269Geodesic = ee.Geometry.MultiPolygon(coords, 'EPSG:4269', true)
var geometry4269Planner = ee.Geometry.MultiPolygon(coords, 'EPSG:4269', false)
var geometryNullGeodesic = ee.Geometry.MultiPolygon(coords, null, true)
var geometryNullPlanner = ee.Geometry.MultiPolygon(coords, null, false)


var lonLat = ee.Image.pixelLonLat()

var reducers = ee.Reducer.count().combine({
  reducer2: ee.Reducer.min(),
  sharedInputs: true
}).combine({
  reducer2: ee.Reducer.max(),
  sharedInputs: true
})

var GEE = function(geometry, title){
  var result = lonLat.reduceRegion({
    reducer:reducers,
    geometry:geometry,
    crs:'EPSG:4269',
    scale: 5000
  })
  Map.addLayer(geometry, {}, title)
  print(title, result)
}

// same results are noted with the same alphabet. A and B are different but both roughly cover two polygons. C only cover 
GEE(geometry4326Geodesic, '4326_geodesic')// A
GEE(geometry4326Planner, '4326_palnner')// B
GEE(geometry4269Geodesic, '4269_geodesic')// A
GEE(geometry4269Planner, '4269_planner')// B
GEE(geometryNullGeodesic, 'null_geodesic')// C
GEE(geometryNullPlanner, 'null_planner')// B

Best Answer

I filed a bug report and Google has replied. The example I gave in the bug report was slightly different, but the mistake is the same: I missed a set of brackets for each polygon, so GEE think they are the same polygon with holes instead of separate polygons.

The bug report I filed and Google's full reply is here

Related Question