R10424/Raster_gap_Analyzerdb97b68e7e43master
README.md
ReadMe for RasterGapAnalyzer
Created by Alain Foehn on April 28 2020
Last modification by Alain Foehn on April 28 2020
Table of Contents
- Code preparation
- API Inputs/Outputs
Code preparation
To work properly, RasterGapAnalyzer requires the followings :
- A file INI\API-research.ini
- a file template is given in INI\Templates.
- Provide login and password
- A file INI\INI-research.ini
- a file template is given in INI\Templates
- Configure the file to the desired analysis.
- A file minerve-d3\global_config.ini file (to define Output and Temporaty folders ; template given in minerve-d3\Templates\Global_config_Templates.ini).
When ready, run the content of main.R (for example in RStudio)
API Inputs/Outputs
This part provides the data structure required to use the CombiValais tool with other APIs than the one of the minerve-d3 project. The data structure of each argument of the INI API file is given.
- First, the inputs arguments are given. When indicated with {}, this indicates a variable that will be replaced. When not indicated with {}, this indicates fix arguments in the request.
- Second, the structure of the API output file is given.
List of functions :
- valuesatcoordinates
- get_pixel_altitude
- get_metadata
- token_path
1. valuesatcoordinates
INPUT (arguments)
- {productId}
- {ENDDATE}
- {list_of_coords} [in the format (east,north) example : [2600000,1130000 ; 2600000, 1132000]]
OUTPUT
content-type: application/json; charset=utf-8
Response body :
{ "e": 2600000, "n": 1130000, "value": 0 }, { "e": 2600000, "n": 1132000, "value": 0 }
2. get_pixel_altitude
INPUT (arguments)
- {prod_id}
- {X_val}
- {Y_val}
OUTPUT
content-type: application/json; charset=utf-8
Response body : 1126
3. get_metadata
INPUT (arguments)
None.
OUTPUT
content-type: text/csv
The returned CSV, without header, must have at least the following arguments for each product in the database :
- Product ID [ID]
- Product temporal resolution [Temp_res_before]
- Product spatial resolution [sp_res_X]
In the current code version, the CSV has the following structure (line 40 of file minerve-d3/Code/fc_API-REST.R):
colnames(metadata) <- c("ID","Name","Type","Temp_res_before","Temp_res_after","Upper_left_X","Upper_left_Y","Width","Height","sp_res_X","sp_res_Y","data_format")
Hereafter is an example of response body with the 2 first lines of the output used in the minerve-d3 project.
1;acquire;observation;3600;0;2518000;1204000;192;172;1000;1000;64BF;mm/h 2;azc;observation;3600;0;2518000;1204000;192;172;1000;1000;64BF;mm/h
If the CSV file has a different columns structure, simply modify the above code line [BUT ensure to have the 3 variables ID, Temp_res_before and sp_res_X !
4. token_path
INPUT (arguments)
The following arguments must appear in the base request (modified during the code execution):
- {user}
- {login}
OUTPUT
content-type: application/json; charset=utf-8 Response body :
{ "token": "rtJhbGciOiJIUzI1NiIsInR5kpXV.eyJ1c2VyIjp7..." }