Download Files
For a better understanding of how you can implement the API into your software see Get Started
Description
This route is used to download files under a service (ndvi,ndwi,'chi' etc.) for a given {field_name}
. The files are download as a
PNG
or Json
file. Without a {service_name}
in extention, it will default to ndvi service.
When you enter a date, it will look for the closest date to the input date if the specific date has no data because of clouds.
Endpoints
- /download/{service_name}/{file_type}
- /files/get/{service_name}/{file_type}
Method type
POST
Parameters
name | description | type | Required | Default Value |
---|---|---|---|---|
token | Your identification token | string | required | |
field_name | Name of the field | string | required | |
date | Select files from this date or the closest. Format:YYYY-MM-DD | string | optional | |
ext | Specified file type to download. If not specied, both files will be downloaded (png , json ) | string | optional |
Response Details | JSON
name | description |
---|---|
bounds | Array containing latitude and longitude to place the png image in google maps/ leaflet API |
<index> | Like “ndvi”, “evi” etc. It is an array of absolute index values at all pixels. |
mean | Statistical mean value of the index |
median | median value of the index |
std | Standard deviation |
min | Minimum index value |
max | Maximum index value |
p25 | 25th Percentile value |
p75 | 75th Percentile value |
num | Number of pixels containing the field |
mean_variation | % change of current mean value from the previous image mean value |
Responses
status code | description |
---|---|
200 | Your request is successful |
400 | Wrong inputs or there are required parameters missing |
403 | Forbidden request or acces denied |
500 | Unexpected error |
404 | Resource was not found (It means that there are clouds and we have no data) |
Examples :
======
Image
Example Request Image
POST https://spacesense-api.ew.r.appspot.com/download/ndwi/image?token=__myToken__&field_name=farm_1
Example Response Image
This request returns a PNG file of the latest available imagery since no date is specied.
Color map
{"colormaps":
[
{
"index": "ndvi",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 0.0,
"stop": 1.0
},
{
"index": "ndwi",
"scale" : [ "#d3322b", "#f16d43", "#fcab64", "#fedc90", "#faf8c0", "#dcf1ec", "#abd6e8", "#76abd0", "#4a74b4", "#4a74b4"],
"start": 0.0,
"stop": 1
},
{
"index": "chi",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 0.0,
"stop": 3.0
},
{
"index": "ndre",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 0.0,
"stop": 1.0
},
{
"index": "savi",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 0.0,
"stop": 1.0
},
{
"index": "lai",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 1.0,
"stop": 7.0
},
{
"index": "evi",
"scale": ["#a50026", "#d3322b", "#f16d43", "#fcab63", "#fedc8c", "#f9f7ae", "#d7ee8e", "#a4d86f", "#64bc61", "#23964f", "#23964f"],
"start": 0.0,
"stop": 1.0
},
{
"index": "nirv",
"scale": ["#A50026", "#D3322B", "#F16D43", "#FCAB63", "#FEDC8C", "#F9F7AE", "#D7EE8E", "#A4D86F", "#64BC61", "#23964F", "#23964F"],
"start": 100,
"stop": 2000
}
]
}
Json
Example Request json
POST https://spacesense-api.ew.r.appspot.com/download/ndwi/json?token=__myToken__&field_name=farm_1
Example Response json
{
"bounds": [[45.068, 8.59], [45.07, 8.60]]
"ndvi":[[],[],[]........],
"mean":0.56,
"median":0.54,
"std":
}