Search code examples
google-api-python-clientgoogle-earth-engine

Google Earth Engine Python API: map function


Does the use of the Earth Engine map function, e.g. map a list of bands over an Image Collection, in the Earth Engine Python API have access to the Python map function? Is there a possibility of Python mixing up between the two types?


Solution

  • Does the use of the Earth Engine map function, e.g. map a list of bands over an Image Collection, in the Earth Engine Python API have access to the Python map function?

    You can certainly use one inside the other if you want. But this is subject to the usual Earth Engine programming considerations of client vs. server — you can't, for example, get a Python list out of a feature's properties when you're mapping over a feature collection, so writing map(function, feature.get('p')) will never work.

    But if you already have a client-side list (or other sequence) then there's nothing stopping you from using Python map on that inside a mapped function.

    Is there a possibility of Python mixing up between the two types?

    No. One is a global builtin and the other is a method of the ee.List type. It is always unambiguous, to Python, which one you are using; they just happen to be spelled the same; x.map and map are entirely separate.