google earth engine python_Google Earth Engine Python API的解决方法,并且不支持Python 3中的“ee.mapclient”...

所以我正在使用Google Earth Engine并在他们的回购中处理一些示例代码.我使用的是

Python 3.6.看起来谷歌将不再通过他们的ee.mapclient()支持Python 3中的映射功能.我想知道是否有人找到了合适的解决方法?让我概述一下这个问题.

我试图加载ee.mapclient来绘制地图.

import ee

import ee.mapclient

ee.Initialize()

但是我收到了一个错误:

ModuleNotFoundError Traceback (most recent call last)

in ()

1 import ee

----> 2 import ee.mapclient

3 ee.Initialize()

/media/krishnab/lakshmi/anaconda3/envs/pMining/lib/python3.6/site-packages/ee/mapclient.py in ()

29

30 import collections

---> 31 import cStringIO

32 import functools

33 import math

ModuleNotFoundError: No module named 'cStringIO'

所以我在Google Earth Engine Repo上发布了一个问题,但发现了一个先前存在的问题:

在这个问题中,开发人员承认这个问题,但是由于底层Tk包的限制,他们表示不会修复它.

以下是该问题的引用:

We have not been actively maintaining the mapclient object, because it

depends on Tk, a graphical user interface toolkit, which behaves

differently on different machines.

Could you describe your use case that requires mapclient? We may be

able to suggest an alternative approach.

谷歌开发者提出了提交解决方法,但到目前为止还没有发布任何解决方法.

因此,我想知道是否有其他人在Python3.6中找到了适合此问题的解决方法?

通过一个真实的代码示例,我可以从Google示例回购中提供以下代码:

import datetime

import ee

import ee.mapclient

ee.Initialize()

ee.mapclient.centerMap(-95.738, 18.453, 9)

# Filter the LE7 collection to a single date.

collection = (ee.ImageCollection('LE7_L1T')

.filterDate(datetime.datetime(2002, 11, 8),

datetime.datetime(2002, 11, 9)))

image = collection.mosaic().select('B3', 'B2', 'B1')

# Display the image normally.

ee.mapclient.addToMap(image, {'gain': '1.6, 1.4, 1.1'}, 'Land')

# Add and stretch the water. Once where the elevation is masked,

# and again where the elevation is zero.

elev = ee.Image('srtm90_v4')

mask1 = elev.mask().eq(0).And(image.mask())

mask2 = elev.eq(0).And(image.mask())

ee.mapclient.addToMap(

image.mask(mask1), {'gain': 6.0, 'bias': -200}, 'Water: Masked')

ee.mapclient.addToMap(

image.mask(mask2), {'gain': 6.0, 'bias': -200}, 'Water: Elev 0')

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值