The joint ESA-NASA Multi-Mission Algorithm and Analysis Platform (MAAP) focuses on developing a collaborative data system enabling collocated data, processing, and analysis tools for NASA and ESA datasets. The NASA MAAP API adheres to the joint ESA-NASA MAAP API specification currently in development. This joint architectural approach enables NASA and ESA to each run independent MAAPs, while ultimately sharing common facilities to share and integrate collocated platform services.
Development server: https://api.dit.maap-project.org/api
cd docker
docker-compose up
Prerequisites:
- postgresql
- Linux:
sudo apt-get install postgresql python-psycopy2 libpq-dev
- Mac OSx:
brew install postgresql
- Linux:
- pip, python3.7 and virtualenv
python3 -m venv venv
source maap-api-nasa/bin/activate
pip3 install -r requirements.txt
- Add the new postgres user (A fix for 'role does not exist'):
Note: You may need to use sudo -u postgres
before postgres commands.
# For example
# $ create user tonhai # or
# $ sudo -u postgres createuser tonhai
createuser <current_user>
- create an empty postgres db (maap_dev) (a fix for 'database maap_dev does not exist'):
psql # or $ sudo -u postgres psql
(in postgres shell): create database maap_dev;
(in postgres shell): \q
- OPTIONAL: PyCharm configuration, if using the PyCharm IDE:
- Script path:
./api/maapapp.py
- Environment variables:
PYTHONUNBUFFERED=1
- Python interpreter:
Python 3.7
- Working directory:
./api
In the settings.py (i.e., maap-api-nasa/api/settings.py):
# settings.py
API_HOST_URL = 'http://0.0.0.0:5000/' # For local testing
# ...
# The endpoint obtained after doing Titiler deployment
TILER_ENDPOINT = 'https://XXX.execute-api.us-east-1.amazonaws.com'
# If running the tiler locally, this can be TILER_ENDPOINT = 'http://localhost:8000'
FLASK_APP=api/maapapp.py flask run --host=0.0.0.0
sudo vi /etc/postgresql/9.5/main/pg_hba.conf #(the location may be different depend on OS and postgres version)
# Reconfig as follows:
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/0 trust
# Save pg_hba.conf
# Restart postgresql
sudo /etc/init.d/postgresql reload
sudo /etc/init.d/postgresql start
# Run the maap-api-nasa services locally
FLASK_APP=api/maapapp.py flask run --host=0.0.0.0
And run a test:
python3 -m unittest test/api/endpoints/test_wmts_get_tile.py
while keeping the server in the previous step running (i.e., local maap-api-nasa). Open a new terminal
source maap-api-nasa/bin/activate # or whatever environment name you choose in the previous step
#If you are running the latest version of Titiler, then use the following test scripts:
python3 -m unittest -v test/api/endpoints/test_wmts_get_tile_new_titiler.py
python3 -m unittest -v test/api/endpoints/test_wmts_get_capabilities_new_titiler.py
A valid MAAP API token must be included in the header for any API request. An Earthdata account is required to access the MAAP API. To obtain a token, URS credentials must be provided as shown below:
curl -X POST --header "Content-Type: application/json" -d "{ \"username\": \"urs_username\", \"password\": \"urs_password\" }" https://api.dit.maap-project.org/token
-
After running the local maap-api-nasa, go to http://0.0.0.0:5000/api to see the APIs.
-
Or running the your own test scripts with:
curl -X POST --header "Content-Type: application/json" -d "{ \"username\": \"urs_username\", \"password\": \"urs_password\" }" http://0.0.0.0:5000/token