跳转到主要内容

用于在Jupyter开发环境中处理地球引擎的工具

项目描述

earthengine-jupyter

注意:这是一个实验性项目,不是一个官方支持的Google项目。欢迎使用,但我们不能保证稳定性。

设置

try:
  import ee_jupyter
  print('ee_jupyter was already installed.')
except ModuleNotFoundError:
  print('ee_jupyter was not found. Installing now...')
  import os
  result = os.system('pip -q install earthengine-jupyter')
Make sure that the earthengine-jupyter package is installed...

如何使用

这个库包含一个可以用来显示交互式地图的Map类。

import ee
from ee_jupyter.core import authenticate_if_needed
from ee_jupyter.ipyleaflet import Map
authenticate_if_needed()
✓ Authentication credentials were found.
# Intialize the Earth Engine client library.
ee.Initialize()
map1 = Map(center=(37.5924, -122.09), zoom=8)
map1
Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zo…

定义一个地球引擎图像图层,并将其添加到交互式地图中。

img1 = ee.Image("LANDSAT/LC09/C02/T1_L2/LC09_044034_20220127")
visualization = {
    'bands': ['SR_B4', 'SR_B3', 'SR_B2'],
    'min': 0.2 / 0.0000275,
    'max': 0.4 / 0.0000275,
}
map1.addLayer(eeObject=img1, visParams=visualization, name='Landsat scene')

我们还可以创建一个检查器对象,并将其与之前创建的地图关联起来。

from ee_jupyter.ipyleaflet import Inspector

inspector1 = Inspector(map_object=map1)
inspector1
Inspector(layout=Layout(border_bottom='solid', border_left='solid', border_right='solid', border_top='solid', …

通常,当您创建检查器对象时,您希望将其显示在地图附近。

from ipywidgets import HBox

display(HBox([map1, inspector1]))
HBox(children=(Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom…

提示:标题

请注意,当在GitHub Pages上查看时,您可以独立操作Jupyter小部件,但这些小部件之间不相互交互。要体验跨小部件交互性,请在Jupyter环境中打开此笔记本。

显示地图图像

如果您想显示一个静态(非交互式)图像,也可以这样做。将embed=True参数设置为True将允许图像在笔记本中保存。

from IPython.display import Image


visualization['dimensions'] = 400  # maximum dimension for the image
url = img1.getThumbUrl(visualization)

Image(url=url, format='png', embed=True)

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

earthengine-jupyter-0.0.7.tar.gz (12.9 kB 查看哈希值)

上传时间

构建分布

earthengine_jupyter-0.0.7-py3-none-any.whl (13.5 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面