Following files are required.
utils.py
: Contains utilitesmain.py
: Main flow of the programenvironment.yml
: Contains the conda environment containing necessary packages required.
Steps to recreate the environment:
conda env create -f environment.yml;
conda activate EOD;
PS: If this script fails,manually install matplotlib, sentinelhub, pillow(PIL), gdal, numpy.
Read sentinelhub docs on how to configure the API for usage. Create the account required HERE.
For Instance ID go to Configuration Utility. For SH_Client_ID go to User Settings and click of 'Create New' under OAuth Clients and use the secret key as SH_Client_Secret. OR use my acc credentials already set instead.
.
├── data
│ ├── d19514cf33acf6fe96e66c4f12ee1085
│ │ ├── request.json
│ │ ├── response_cog.tiff
│ │ ├── response.tiff
│ │ └── response.webp
│ └── f1c3a296d2ee6a5ccb78451909e72726
│ ├── request.json
│ ├── response_cog_cog.tiff
│ ├── response_cog.tiff
│ ├── response_cog.webp
│ ├── response.tiff
│ └── response.webp
├── environment.yml
├── main.py
├── __pycache__
│ └── utils.cpython-311.pyc
├── README.md
└── utils.py
- data/ This folder contains all output and transformation results.
request.json
: The API request parametersresponse.tiff
: The original tiff image returned by the APIresponse.webp
: Original image transformed into (500x500) webp format with transparency where 0 pixels are presnt for Thumbnails viewing.response_cog.tiff
: The original high res tiff image converted to Cloud Optimized GeoTIFF format.
This is the process of the entire code
┌────────────────────────────┐
│ │
┌──────► SentinelHub API │
│ │ │
│ │ │
│ └─────────────────┬──────────┘
│ │
│ │
│ │
│ │
│ │
Request Response
│ │
│ │
│ │
│ │
│
┌─────────────────▼────────────┐ | | | |
│ Image Data │
└─────────────────┬────────────┘
│
▼
┌──────────────────────┐
│ │
│ │
┌──────────────────────────┤ Data Folder │
│ │ │
│ └────────────▲─────────┘
│ |│ |
┌───────────────▼───────────────────────┐ │
│ │ │
│ Traverse all files in Data │ │
│ folder │ │
│ │ │
│ │ │
│ │ │
└──────────────────┬────────────────────┘ │
│ │
│ │
┌────────▼─────────────┐ │
│ │ │
│ │ │
│ │ │
┌──────────▼──────────┐ ┌────▼────────────┐ │
│ │ │ │ │
│ convert_to_thumbnail│ │ convert_to_cog │ │
│ │ │ │ │
│ │ │ │ │
└──────────┬──────────┘ └─────┬───────────┘ │
│ │ │
│ │ │
│ │ │
│ │ │
└──────────►┌───────────┘ │
│ │
│ │
│ │
└─────────────────────────────────┘