geonodectl Documentation
Overview
geonodectl is a command-line interface (CLI) tool for interacting with the GeoNode REST API v2. It allows users to manage datasets, resources, documents, maps, users, and more from the command line, making it ideal for automation, scripting, and power users.
- Project Repository: https://github.com/GeoNodeUserGroup-DE/geonodectl
- License: MIT
Features
- List, describe, upload, patch, and delete datasets, documents, maps, and geoapps
- Manage users, groups, uploads, execution requests, keywords, and linked resources
- Read and write the MapStore blob JSON for maps (
get-blob,set-blob) - Manage GeoServer styles — list, describe, upload SLD, set default style
- Transfer resources between users
- Supports authentication and secure API access
- Supports pagination, filtering, and ordering
Installation
From PyPI (recommended)
pip install geonodectl
From Source (latest development version)
pip install -e 'git+https://github.com/GeoNodeUserGroup-DE/geonodectl.git@main#egg=geonodectl'
Development Setup
pip install .[test]
pre-commit install
Configuration
GeoNode API
Set the following environment variables to connect to your GeoNode instance:
export GEONODE_API_URL=https://your-geonode-instance/api/v2/
export GEONODE_API_BASIC_AUTH=<base64-user:password>
Generate the basic auth string with:
echo -n user:password | base64
GeoServer (for geoserver subcommands)
GeoServer credentials are required only for the geoserver subcommand group.
Authentication (in order of precedence):
# Option 1 — preferred, same format as GEONODE_API_BASIC_AUTH:
export GEOSERVER_API_BASIC_AUTH=<base64-admin:password>
# Option 2 — explicit username and password:
export GEOSERVER_USER=admin
export GEOSERVER_PASSWORD=geoserver
URL — defaults to the GeoNode base URL with /geoserver appended, so no extra config is needed in standard GeoNode deployments. Override if needed:
export GEOSERVER_URL=https://your-geonode-instance/geoserver # optional
SSL — follows GEONODE_API_VERIFY (default: True).
Usage
Get help and see available commands:
geonodectl --help
See docs/example.md for worked examples.
Command Reference
GeoNode API commands
| Command | Aliases | Capabilities |
|---|---|---|
resources |
resource |
list, delete, metadata |
datasets |
ds, dataset |
list, delete, patch, describe, upload |
documents |
doc, document |
list, delete, patch, describe, upload |
maps |
— | list, delete, patch, describe, create, get-blob, set-blob |
geoapps |
apps |
list, delete, patch, describe |
users |
user |
list, delete, patch, describe, create, transfer_resources |
groups |
— | list, delete, patch, describe, create |
uploads |
— | list, describe |
executionrequest |
execrequest |
list, describe |
keywords |
— | list, describe |
tkeywords |
thesaurikeywords |
list, describe |
tkeywordlabels |
thesaurikeywordlabels |
list, describe |
linked-resources |
linkedresources |
delete, add, describe |
attributes |
attr, attribute |
describe, patch |
GeoServer commands
The geoserver command group requires GeoServer credentials (see Configuration above).
| Command | Description |
|---|---|
geoserver styles list |
List styles in GeoServer, optionally filtered by workspace |
geoserver styles describe |
Print the SLD XML for a named style |
geoserver styles upload |
Create or update a style from an SLD file |
geoserver styles set-default |
Set the default style for a GeoServer layer |
Examples
# List all styles in the geonode workspace
geonodectl geoserver styles list --workspace geonode
# Show the SLD XML for a style
geonodectl geoserver styles describe foss4g_buildings --workspace geonode
# Upload a new or updated SLD file
geonodectl geoserver styles upload --name foss4g_buildings \
--sld-path ./buildings.sld --workspace geonode
# Set the default style for a layer
geonodectl geoserver styles set-default \
--layer geonode:buildings --style foss4g_buildings
Map blob commands
The MapStore blob is the JSON configuration that controls how a map is rendered in the GeoNode MapStore viewer (layers, zoom, center, widgets, etc.).
# Print the blob JSON for map 2073 (pipe-friendly)
geonodectl maps get-blob 2073
geonodectl maps get-blob 2073 | jq '.map.layers'
# Replace the blob JSON from a file
geonodectl maps set-blob 2073 --json_path ./my_blob.json
Development
Code Quality
This project uses pre-commit hooks and GitHub Actions for:
- Black (code formatting)
- mypy (type checking)
- flake8 (linting)
Run checks locally:
pre-commit run --all-files
Or individually:
black .
mypy src/ --ignore-missing-imports
flake8 src/
Testing
Tests are in tests/. Run with:
pytest
Contribution Guide
- Fork the repository and create a feature branch.
- Install development dependencies:
pip install .[test] - Install pre-commit hooks:
pre-commit install - Make your changes and ensure all checks pass.
- Submit a pull request.
License
This project is licensed under the MIT License.
Further Reading
Release files for geonodectl 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geonodectl-0.3.4.tar.gz | 51.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geonodectl-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.9 kB
Release files / geonodectl-0.3.4.tar.gz
| Download URL | geonodectl-0.3.4.tar.gz |
|---|---|
| Size | 51.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00a44f4dbf098f1641deb2bee67f69fdb437e894a59d33baebb7cb9fd76a48c6
|
|
BLAKE2b-256 checksum How to use checksums |
df2958c29737f8bd77248f265831f7dec8ae3bf7e38ff4bd9c4b3eccb1d4b1e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.21
|
Release files / geonodectl-0.3.4-py3-none-any.whl
| Download URL | geonodectl-0.3.4-py3-none-any.whl |
|---|---|
| Size | 54.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5896c8391400d4c4f3d5f683482f8b7e86d00ab9bcc2c4ad863c638d4fbc822b
|
|
BLAKE2b-256 checksum How to use checksums |
f29ac07274676dd1c4fa128618623d7ec22e2abb00a372f5d912b7d785fa73ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.21
|