zoukankan      html  css  js  c++  java
  • 连接谷歌gee

    在按照https://www.earthdatascience.org/tutorials/intro-google-earth-engine-python-api/ 这个连接说明的步骤进行操作时,

    1. Download Python
    2. Download pip
    3. Run the below command from a command-line to download/install the Python API client
       pip install google-api-python-client
      
    4. Run the below command from a command-line to ensure you have the proper crypto libraries installed
       python -c "from oauth2client import crypt"
      

      If running this command results in an error message, you will need to download and install the proper crypto libraries. This can be accomplished by running the below command.

       pip install pyCrypto
      
    5. Run the below command from a command-line to download/install the Earth Engine Python library
       pip install earthengine-api
      
    6. Run the below command from a command-line to initialize the API and verify your account
       python -c "import ee; ee.Initialize()"
      

      This will result in an error message due to the fact that Google still needs to verify your account with Earth Engine and it currently does not have the proper credentials. Therefore, run:

       earthengine authenticate
      

      This will open your default web-browser (ensure that you’re currently logged into your Google account) and provide you with a unique key to verify your account. Copy and paste the key into the terminal when prompted for the key.

    运行到这一步一直报下面的错误:

    urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试 失败。>

    需要找到一个本地能用的,可以连接到谷歌网站的端口地址,使用下面命令行:

    set https_proxy=http://127.0.0.1:8087

    set http_proxy=http://127.0.0.1:8087

    冒号后面是需要设置为你自己端口的号码。

    然后再运行 earthengine authenticate,发现报了另外的错误

    certificate verify failed: unable to get local issuer certificate

    查了一下,发现是什么ssl错误,找到如下地址:

    C:ProgramDataAnaconda3Liburllib 这个里面有个文件 request.py,在里面加入下面两行代码:

    import ssl

    ssl._create_default_https_context = ssl._create_unverified_context

    保存,如果无法保存,可以创建新的,然后替换

    然后重新使用 anoconda prompt,使用管理员权限运行,再运行 earthengine authenticate 行,然后复制密码,运行

    成功运行结果

    To authorize access needed by Earth Engine, open the following URL in a web browser and follow the instructions. If the web browser does not start automatically, please manually browse the URL below.

    https://accounts.google.com/o/oauth2/auth?client_id=517222506229-vsmmajv00ul0bs7p89v5m89qs8eb9359.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fearthengine+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&code_challenge=YxF62ON0gm2pDU87m96VJIfQvePORdot9sn6cgB2Sxw&code_challenge_method=S256

    The authorization workflow will generate a code, which you should paste in the box below.
    Enter verification code: 4/1AY0e-g6-47F-UIvQcOAkVaa 5IF9Rch8AOfFZtW2SEbCD6uc

    Successfully saved authorization token.

  • 相关阅读:
    C++ Primer 有感(异常处理)(二)
    C++ Primer 有感(异常处理)
    C++ Primer 有感(多重继承与虚继承)
    C++ Primer 有感(面向对象编程)
    C++ Primer 有感(重载操作符)
    yii小部件
    [BAT]通过schtasks.exe远程调用windows 2008 server上的计划任务,提示ERROR : Access is denied
    [BAT]远程执行或停止计划任务
    [Jmeter]通过批处理调用java,java从CSV动态读取登录的用户名和密码,并将其作为参数组合成字符串,写入外部.bat文件,然后通过Java执行这个外部批处理文件
    [Jmeter]Xpath获取元素某个属性的值,以及获取最后一个元素某个属性的值
  • 原文地址:https://www.cnblogs.com/arcserver/p/14710239.html
Copyright © 2011-2022 走看看