Skip to content

links-ads/gaia-geodatalake-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GAIA GeoDataLake — Example Client

Example scripts for uploading and downloading geodata from the GAIA GeoDataLake, using the CKAN API, OAuth2 authentication, and RabbitMQ notifications.

Setup

Requires Python >= 3.13 and uv.

uv sync

Environment configuration

Copy the template and fill in your credentials:

cp envs/env.template .env

The .env file must contain the following variables:

Variable Default Description
PROJECT gaia Project name (lowercase, no stopwords)
CKAN_URL https://datalake.gaia-project.cloud GeoDataLake API base URL
OAUTH_URL https://auth.gaia-project.cloud OAuth2 / FusionAuth base URL
OAUTH_USERNAME Your username
OAUTH_PASSWORD Your password
OAUTH_API_KEY API key (provided separately)
OAUTH_APP_ID Application ID (provided separately)
RMQ_HOSTNAME bus.gaia-project.cloud RabbitMQ hostname
RMQ_PORT 5671 RabbitMQ TLS port
RMQ_VHOST example RabbitMQ virtual host
RMQ_EXCHANGE amq.topic RabbitMQ topic exchange name
RMQ_QUEUE qexample.geodatalake RabbitMQ queue name
RMQ_USERNAME RabbitMQ username
RMQ_PASSWORD RabbitMQ password
RMQ_CA_FILE (optional) Path to the CA certificate PEM file

Upload resources to the geodata repository

The example uploads a mock dataset from data/datasets/NameDataset/.

  • INSPIRE metadata: data/metadataINSPIRE_NameDataset.json — a JSON dict with all fields compliant to the INSPIRE metadata guidelines. All values are strings except spatial, which holds a GeoJSON geometry.
  • Per-resource metadata: data/datasets/NameDataset_resource_metadata/ — one .json file per dataset file describing temporal validity, datatype ID, format, etc.

The upload runs in two steps:

  1. Upload the INSPIRE metadata package.
  2. Iteratively upload dataset files, each attached to the metadata package. If any upload fails the metadata package is deleted automatically.
uv run tools/upload.py

Download resources from the geodata repository

When a new resource is uploaded, the repository automatically sends a notification to the messaging bus. The download script:

  1. Simulates sending a notification to the bus (for testing — this step is not needed in production).
  2. Connects to the queue and listens for notifications.
  3. Downloads each notified resource to outputs/.
uv run tools/download.py

Press Ctrl-C to stop listening.


Check the RabbitMQ connection

tools/rabbitmq.py is a lightweight connectivity smoke test. It connects to the broker, binds the configured queue to the exchange with a hello.# routing key, publishes a test message, and consumes it back. Useful to verify credentials and TLS configuration before running the main scripts.

uv run tools/rabbitmq.py

Useful links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages