使用GEE过程中经常会运行太慢甚至报错,具体报错内容可能如下:
(1)API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See https://cloud.google.com/docs/authentication
(2)Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
问题就在于GEE中不能用getInfo() 这个函数,尤其在循环中,改写即可解决。官方解释在https://developers.google.com/earth-engine/guides/client_server