跳转到主要内容

通过提供自定义会话管理和客户端交互来扩展earthengine-api的功能

项目描述

此存储库最初是作为earthengine-api当前对地球引擎API调用的一种替代品。

当前客户端API的主要问题是它不允许多用户会话,因为它使用一个全局会话对象。此存储库旨在针对特定情况提供对此问题的解决方案。

  • 创建地图ID: getMapId

  • 计算值: getInfo

  • 将任务发送到服务器

ee-client是一个Python包,旨在通过提供自定义会话管理和客户端交互来扩展Google Earth Engine (GEE) API的功能。此包允许用户使用线程安全的凭证对地球引擎REST API进行认证请求,从而促进GEE功能的无缝集成和定制。

主要功能

  • 自定义认证

  • 会话管理:通过可重用的会话对象有效地处理会话,存储凭证和项目信息。

  • 增强API调用:用自定义方法替换和扩展现有的GEE API调用,以满足特定项目需求。

  • 与现有GEE对象的集成:将自定义方法无缝集成到现有的地球引擎对象中,允许直观和熟悉的用法。

安装

要安装此包,请简单使用pip

pip install ee-client # Not yet developed

用法

以下是一些如何在项目中使用ee-client的示例

初始化和认证

from eeclient import Session, get_info, get_asset

# Define your credentials and project ID
credentials = {
    "client_id": "your_client_id",
    "client_secret": "your_client_secret",
    "refresh_token": "your_refresh_token",
}
project = "your_project"

# Create a session object
session = Session(credentials, project)

进行API调用

import ee

# Initialize the Earth Engine library and authenticate
ee.Initialize()

# Example: Get information about an Earth Engine object
result = get_info(session, ee.Number(5))
print(result)

# Example: Get asset information
asset_info = get_asset(session, "users/your_username/your_asset")
print(asset_info)

获取地图瓦片

from eeclient import get_map_id, get_map_tile

# Example: Get map ID for an Earth Engine image
image = ee.Image('COPERNICUS/S2/20190726T104031_20190726T104035_T31TGL')
map_id = get_map_id(session, image)

# Example: Get map tile layer
tile_layer = get_map_tile(map_id)
print(tile_layer)

与现有 GEE 对象集成

进行中

import ee
import eeclient

# Custom method to get information about an Earth Engine Number object
def custom_get_info(self, session):
    return get_info(session, self)

# Extend the Earth Engine Number class with the custom method
ee.Number.custom_get_info = custom_get_info

# Usage
number = ee.Number(5)
result = number.eeclient.get_info(session)
print(result)

贡献

我们欢迎社区贡献。请随时提交问题和拉取请求,以帮助改进此包。

分支仓库

创建一个新分支(git checkout -b feature-branch)。提交您的更改(git commit -am '添加新功能')。推送到分支(git push origin feature-branch)。创建新的拉取请求。

许可协议

本项目采用 MIT 许可证 - 请参阅 LICENSE 文件以获取详细信息。

项目详情


下载文件

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

源代码分发

ee_client-0.1.0.tar.gz (6.3 kB 查看散列值)

上传时间 源代码

构建分发

ee_client-0.1.0-py3-none-any.whl (7.0 kB 查看散列值)

上传时间 Python 3

由...支持