For detailed setup instructions, custom configurations, deployment, and additional features, please refer to the wiki.
To run the API for development purposes, clone the repository locally, and run the containers using VSCode + Dev Container extension. Also ensure you have docker installed.
- Copy .template.env to .env
cp deployment/.template.env deployment/.env
-
Open project root directory in VSCode
-
Execute Task:
Dev Containers: Rebuild and Reopen in Container
-
Wait until VSCode builds the containers
Once the containers are running, we need to run migration and create a superuser.
- Open Terminal in VSCode and go to
django_project
directory
cd django_project
- Run migration
python manage.py migrate
- Create superuser
python manage.py createsuperuser
We can run the API using runner configration in VSCode Django: Run server
.
-
Go to Run and Debug view.
-
Select
Django: Run Server
in the dropdown list. -
Click Start Debugging Button ▶
-
The API swagger is running and can be accessed in
http://localhost:8000/
-
Login to Django Admin in
http://localhost:8000/admin/
- Open QGIS Advanced Settings Editor (Ensure not using tree widget)
- Edit
Settings.BASE_API_URL
(1), tohttp://localhost:8000/api/v1
- Optional - Set DEBUG to true (2)
CPLUS API needs default layers for online processing. The layers are provided by the CI Team and it's uploaded to AWS S3 bucket. The other layer type is Nature Base layers which are downloaded by cron job.
For CPLUS layers, we need to upload the layers in Minio cplus
bucket with below structures:
common_layers/
├── ncs_carbon/
│ ├── cplus/
│ │ └── Bou_SOC_norm_inverse.tif
│ └── naturebase/
├── ncs_pathway/
│ ├── cplus/
│ │ └── Agroforestry_Priority_norm.tif
│ └── naturebase/
└── priority_layer/
│ ├── cplus/
│ │ └── Biodiversity.tif
│ └── naturebase/
Then we can trigger below task to sync into InputLayers table.
This repository is using CPLUS Core package for the analysis. You can find the repository here.
Contributions are welcome! Please read our contributing guide to learn how you can get involved and help improve this project.
This project is licensed under the MIT License. See the LICENSE file for details.