The Brazil Data Cube STAC implementation depends essentially on:
- Flask: a lightweight WSGI web application framework.
- Flask-SQLAlchemy: an extension for Flask that adds support of SQLAlchemy.
- BDC-Catalog: an image metadata storage module for Earth Observation imagery of Brazil Data Cube.
- Flask-Redoc: a Flask extension for displaying OpenAPI/Swagger documentation using Redocs.
Use git
to clone the software repository:
git clone https://github.com/brazil-data-cube/bdc-stac.git
Go to the source code folder:
$ cd bdc-stac
Install in development mode:
$ pip3 install -e .[all]
Note
If you want to create a new Python Virtual Environment, please, follow this instruction:
1. Create a new virtual environment linked to Python 3.7:
python3.7 -m venv venv
2. Activate the new environment:
source venv/bin/activate
3. Update pip and setuptools:
pip3 install --upgrade pip pip3 install --upgrade setuptools
You can generate the documentation based on Sphinx with the following command:
python setup.py build_sphinx
The above command will generate the documentation in HTML and it will place it under:
docs/sphinx/_build/html/
You can open the above documentation in your favorite browser, as:
firefox docs/sphinx/_build/html/index.html
Note
Make sure you have a database prepared using Brazil Data Cube Catalog Module.
In the source code folder, enter the following command:
$ FLASK_APP="bdc_stac" \
FLASK_ENV="development" \
SQLALCHEMY_DATABASE_URI="postgresql://postgres:postgres@localhost:5432/bdc_catalog" \
BDC_STAC_BASE_URL="http://localhost:5000" \
BDC_STAC_API_VERSION="0.8.1" \
BDC_STAC_FILE_ROOT="http://localhost:5001" \
flask run
You may need to replace the definition of some environment variables:
SQLALCHEMY_DATABASE_URI="postgresql://postgres:postgres@localhost:5432/bdc_catalog"
: set the database URI connection.BDC_STAC_BASE_URL="http://localhost:8080"
: Base URI of the service.BDC_STAC_API_VERSION="0.8.1"
: STAC Version used in the service.BDC_STAC_FILE_ROOT="http://localhost:8081"
: File root for the Assets.BDC_STAC_MAX_LIMIT
: Set number of maximum items fetched per request. Default is1000
.BDC_STAC_TITLE
: Set the catalog title.BDC_STAC_ID
: Set the catalog identifier.
To add authentication support with Brazil Data Cube OAuth 2.0, use the following:
BDC_AUTH_CLIENT_ID
: The OAuth 2.0 client identificationBDC_AUTH_CLIENT_SECRET
: The OAuth 2.0 client secretBDC_AUTH_ACCESS_TOKEN_URL
: The URL domain of BDC-OAuth 2.0 provider.