Skip to main content

extends the capabilities of the earthengine-api by providing custom session management and client interactions

Project description

This repository starts as a an alternative for the current calls to Earth Engine API of earthengine-api.

The main issue with the current client api doest not allow multi-user sessions since it uses a global session object. This repository aims to present a workaround for this issue but only in very specific cases:

  • Create map id: getMapId

  • Compute values: getInfo

  • Send tasks to the server

ee-client is a Python package designed to extend the capabilities of the Google Earth Engine (GEE) API by providing custom session management and client interactions. This package allows users to make authenticated requests to the Earth Engine REST API using thread safe credentials, facilitating seamless integration and customization of GEE functionalities.

Key Features

  • Custom Authentication:

  • Session Management: Handle sessions efficiently with reusable session objects that store credentials and project information.

  • Enhanced API Calls: Replace and extend existing GEE API calls with custom methods to suit specific project requirements.

  • Integration with Existing GEE Objects: Seamlessly integrate custom methods into existing Earth Engine objects, allowing for intuitive and familiar usage.

Installation

To install the package, simply use pip:

pip install ee-client # Not yet developed

Usage

Here are a few examples of how to use ee-client in your projects:

Initialization and Authentication

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)

Making API Calls

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)

Fetching Map Tiles:

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)

Integration with Existing GEE Objects

WIP

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)

Contributing

We welcome contributions from the community. Please feel free to submit issues and pull requests to help improve this package.

Fork the repository

Create a new branch (git checkout -b feature-branch). Commit your changes (git commit -am ‘Add new feature’). Push to the branch (git push origin feature-branch). Create a new Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ee_client-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

ee_client-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file ee_client-0.1.0.tar.gz.

File metadata

  • Download URL: ee_client-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for ee_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4395083b0246bfbe3fbe27efeb61a4c6c6e5514a90712faa04ee83a21c04cae
MD5 844308360610f4a73916abb02d7b9f60
BLAKE2b-256 cfcc2b3387a37a6c7bb8a5cf14a764cd84e755b4b602eaddbb9153111d68d742

See more details on using hashes here.

File details

Details for the file ee_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ee_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for ee_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a36da0e412eb108d5d6cbd1bd6c224d759912fca8934e5af50408f24789e1296
MD5 1a33c53602830ec071f83cfb2d9d19ef
BLAKE2b-256 7fd0b6bd39d77f9e17a9df7fbab1cf4a253ef50c972823bef2101ba74abb0fd8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page