google earth engine python api,google earth engine随缘学习(一)搭建GEE的python开发环境...

最近在摸索怎么把GEE服务应用于网站开发。。头大_(:3_ヽ)_

今天学习搭建GEE的python开发环境

这里附上大神的搭建过程-https://zhuanlan.zhihu.com/p/29186942

中间有一步pip install pyCrypto,换了各种方法,但一直是安装失败,于是跳过这一步,但运行pip install earthengine-api会提示:No module named oauth2client.client。于是安装:

pip install oauth2client

运行如下代码:

#!/usr/bin/env python

"""Filter an image collection by date and region to make a median composite.

See also: Clipped composite, which crops the output image

instead of filtering the input collection.

"""

import datetime

import ee

import ee.mapclient

ee.Initialize()

ee.mapclient.centerMap(-110, 40, 5)

# Filter to only include images within the colorado and utah boundaries.

polygon = ee.Geometry.Polygon([[

[-109.05, 37.0], [-102.05, 37.0], [-102.05, 41.0], # colorado

[-109.05, 41.0], [-111.05, 41.0], [-111.05, 42.0], # utah

[-114.05, 42.0], [-114.05, 37.0], [-109.05, 37.0]]])

# Create a Landsat 7 composite for Spring of 2000, and filter by

# the bounds of the FeatureCollection.

collection = (ee.ImageCollection('LANDSAT/LE07/C01/T1')

.filterDate(datetime.datetime(2000, 4, 1),

datetime.datetime(2000, 7, 1))

.filterBounds(polygon))

# Select the median pixel.

image1 = collection.median()

# Select the red, green and blue bands.

image = image1.select('B3', 'B2', 'B1')

ee.mapclient.addToMap(image, {'gain': [1.4, 1.4, 1.1]})

会提示如下错误:No module named PIL(这里是缺少图像处理库无法加载地理图像)。于是安装:

pip install Pillow

再运行代码,最后得到如下结果:

2a9b707733570e46e8a4c1bbb9bd07e9.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值