CLI tools for managing stac-fastapi-elasticsearch-opensearch deployments
Project description
CLI tools for managing stac-fastapi-elasticsearch-opensearch deployments.
Table of Contents
Installation
For Elasticsearch
pip install sfeos-tools[elasticsearch]
Or for local development:
pip install -e sfeos_tools[elasticsearch]
For OpenSearch
pip install sfeos-tools[opensearch]
Or for local development:
pip install -e sfeos_tools[opensearch]
For Viewer
To use the interactive Streamlit viewer:
pip install sfeos-tools[viewer]
Or for local development:
pip install -e sfeos_tools[viewer]
For Development (both backends)
pip install sfeos-tools[dev]
Or for local development:
pip install -e sfeos_tools[dev]
Usage
After installation, the sfeos-tools command will be available:
# View available commands
sfeos-tools --help
# View version
sfeos-tools --version
Commands
Standardized CLI Options
The CLI tools use standardized options across commands for consistency:
Database Commands (add-bbox-shape, reindex):
--host: Database host (default: localhost or ES_HOST env var)--port: Database port (default: 9200 for ES, 9202 for OS, or ES_PORT env var)--use-ssl/--no-ssl: SSL connection flag (default: true or ES_USE_SSL env var)--user: Database username (default: ES_USER env var)--password: Database password (default: ES_PASS env var)
STAC API Commands (load-data, ingest-catalog, viewer):
--stac-url: STAC API base URL (default: http://localhost:8080)
Authentication Options (optional for STAC API commands):
--user: Username for basic authentication--password: Password for basic authentication--use-ssl/--no-ssl: SSL verification flag
add-bbox-shape
Adds a bbox_shape field to existing collections for spatial search support. This migration is required for collections created before spatial search was added. Collections created or updated after this feature will automatically have the bbox_shape field.
sfeos-tools add-bbox-shape --backend [elasticsearch|opensearch] [options]
Options:
--backend: Database backend to use (required, choices: elasticsearch, opensearch)--host: Database host (default: localhost or ES_HOST env var)--port: Database port (default: 9200 for ES, 9202 for OS, or ES_PORT env var)--use-ssl/--no-ssl: Use SSL connection (default: true or ES_USE_SSL env var)--user: Database username (default: ES_USER env var)--password: Database password (default: ES_PASS env var)
reindex
Reindexes all STAC indexes to the next version and updates aliases. This command performs the following actions:
- Creates/updates index templates
- Reindexes collections and item indexes to a new version
- Applies asset migration script for compatibility
- Switches aliases to the new indexes
sfeos-tools reindex --backend [elasticsearch|opensearch] [options]
Options:
--backend: Database backend to use (required, choices: elasticsearch, opensearch)--host: Database host (default: localhost or ES_HOST env var)--port: Database port (default: 9200 for ES, 9202 for OS, or ES_PORT env var)--use-ssl/--no-ssl: Use SSL connection (default: true or ES_USE_SSL env var)--user: Database username (default: ES_USER env var)--password: Database password (default: ES_PASS env var)--yes: Skip confirmation prompt
Examples:
# Reindex Elasticsearch with custom host and no SSL
sfeos-tools reindex --backend elasticsearch --host localhost --port 9200 --no-ssl --yes
# Reindex OpenSearch with default settings
sfeos-tools reindex --backend opensearch --yes
load-data
Note: to enable this functionality, the ENABLE_CATALOGS_ROUTE env var needs to be set in SFEOS.
Load STAC collections and items from local JSON files into a STAC API instance. This command is useful for:
- Populating a new STAC API deployment with test data
- Migrating data between STAC API instances
- Bulk loading STAC collections and items
sfeos-tools load-data --stac-url <stac-api-url> [options]
Options:
--stac-url: STAC API base URL (default: http://localhost:8080)--collection-id: ID of the collection to create/update (default: test-collection)--data-dir: Directory containing collection.json and feature collection files (default: sample_data/)--use-bulk: Use bulk insert method for items (faster for large datasets)
Data Directory Structure:
Your data directory should contain:
collection.json: STAC collection definition- One or more
.jsonfiles: Feature collections with STAC items
Examples:
# Load data from default directory
sfeos-tools load-data --stac-url http://localhost:8080
# Load with custom collection ID and bulk insert
sfeos-tools load-data \
--stac-url http://localhost:8080 \
--collection-id my-collection \
--use-bulk
# Load from custom directory
sfeos-tools load-data \
--stac-url http://localhost:8080 \
--data-dir /path/to/stac/data \
--collection-id production-data
ingest-catalog
Ingest SKOS/RDF-XML files to create STAC catalogs and sub-catalogs. This command parses RDF/XML files containing SKOS concepts and creates a hierarchical catalog structure in the STAC API. It handles:
- Creating catalogs from SKOS concepts
- Establishing parent-child relationships (skos:narrower)
- Preserving semantic links (skos:related, skos:exactMatch, etc.)
- Including metadata from definitions and modification dates
sfeos-tools ingest-catalog --xml-file <path-to-rdf-xml> [options]
Options:
--xml-file: Path to RDF/XML file containing SKOS concepts (required)--stac-url: STAC API base URL (default: http://localhost:8080)--user: Username for basic authentication (optional)--password: Password for basic authentication (optional)--use-ssl/--no-ssl: Enable or disable SSL verification (optional)
Examples:
# Ingest test data from the tests directory (uses default localhost:8080)
sfeos-tools ingest-catalog --xml-file tests/skos-test-topics.rdf
# Ingest with explicit STAC API URL
sfeos-tools ingest-catalog --xml-file thesaurus.rdf --stac-url http://localhost:8080
# Ingest with basic authentication
sfeos-tools ingest-catalog --xml-file concepts.xml --stac-url https://my-stac-api.com --user myuser --password mypass
# Ingest with SSL verification disabled
sfeos-tools ingest-catalog --xml-file concepts.xml --stac-url https://my-stac-api.com --no-ssl
# Ingest with authentication and custom SSL settings
sfeos-tools ingest-catalog --xml-file /path/to/concepts.xml --stac-url https://my-stac-api.com --user admin --password secret --no-ssl
viewer
Launch an interactive Streamlit-based web viewer for exploring STAC collections and items. The viewer provides:
- Interactive map visualization of STAC items
- Collection browser and selector
- Item search and filtering
- Metadata inspection
- Asset preview and imagery display
- Support for thumbnails, images (JPEG, PNG, TIFF), and other asset types
sfeos-tools viewer [options]
Options:
--stac-url: STAC API base URL (default: http://localhost:8080)--port: Port for the Streamlit viewer (default: 8501)
Requirements:
The viewer requires additional dependencies. Install with:
pip install sfeos-tools[viewer]
Examples:
# Launch viewer with default settings (connects to http://localhost:8080)
sfeos-tools viewer
# Connect to a custom STAC API
sfeos-tools viewer --stac-url https://my-stac-api.com
# Use a different port
sfeos-tools viewer --port 8502
# Custom STAC API and port
sfeos-tools viewer --stac-url http://localhost:8080 --port 8502
The viewer will automatically open in your default web browser. Press Ctrl+C in the terminal to stop the viewer.
Development
To develop sfeos-tools locally:
# Install in editable mode with dev dependencies
pip install -e ./sfeos_tools[dev]
# Run the CLI
sfeos-tools --help
# Run tests
pytest
# Format code
pre-commit install
pre-commit run --all-files
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sfeos_tools-0.4.0.tar.gz.
File metadata
- Download URL: sfeos_tools-0.4.0.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
959ea7f27ec427c50c8aa1ff25be04c8cf05f66971a4f588387679d7d3109313
|
|
| MD5 |
fa42e20b8be5647d392458952980840d
|
|
| BLAKE2b-256 |
319f763cacf41d7ea2c14334680c320c8231a8c539ded9edd3e77f3f173fa0f9
|
File details
Details for the file sfeos_tools-0.4.0-py3-none-any.whl.
File metadata
- Download URL: sfeos_tools-0.4.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0a760d606e2bb2a3805a0c6e32220f566f3736b08ca978bb964f7528d835ec5
|
|
| MD5 |
ed2309542d4ab6fb47fa55f9a84d96fb
|
|
| BLAKE2b-256 |
9911dcd93a30a83f3df5db9641442389eada1f615b0fb9f160c6388ceb98862d
|