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.

  • 相关阅读:
    所有抽样单元都有相等的被选取机会 ,说法错误
    银行存款余额表由谁编制的
    资本公积——资本溢价与资本公积——其他资本公积
    货币单元抽祥
    企业安全生产费用账务的处理
    Tableau代写制作地图可视化和树形图、条形图
    Tableau 代写数据可视化:探索性图形分析新生儿死亡率数据
    R、Python代写、Open Refine采集pdf数据,清理数据和格式化数据
    使用GIS编程代写制作静态地图和处理地理数据
    用R语言编程代写制作交互式图表和地图
  • 原文地址:https://www.cnblogs.com/arcserver/p/14710239.html
Copyright © 2011-2022 走看看