TransWikia.com

Retrieve projection inside .map() GEE

Geographic Information Systems Asked by Alexander Vocaet on September 18, 2020

When using a reducing function such as .reduceRegion(), a provided projection is necessary.
This projection has to be provided as CRS String, and crsTransform List. Both are optainable with :

var proj = Im.projection().getInfo()
var crs = proj.crs
var transform = proj.transform

enter image description here

yet the Funktion .getInfo() is not usable inside .map(), due to its correspondence with the Javascript Interface of Google Earth Engine.

To call the projection with the designated ee.Projection() functions is not possible, due to the expectations of .reduceRegions()

var proj = Im.projection()
var crs = proj.crs()
var transform = proj.transform()

enter image description here

how can a projection Inside the .map() function be retrieved for usage inside .reduceRegion()?

var min = Im.reduceRegion({
  reducer:ee.Reducer.min(),
  crs:crs,
  crsTransform:transform,
})

One Answer

You do not need to specify crsTransform if use the same transform as given in the projection you passed to crs. Furthermore, if you don't set a different crs than supplied by the image you are mapping over, you don't need to specifically define a crs at all. In this case the crs will be taken from the Image you are calling reduceRegion() on. But in case you want to take the projection from a different image this should work just fine in a .map call:

// Different Image from which you take the projection    
var proj = Im2.projection()

var min = Im.reduceRegion({
  reducer:ee.Reducer.min(),
  crs: proj
})

Correct answer by JonasV on September 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP