Retrieve an analysis
So far, you have created a polygon, initiated two analysis requests, and checked the status of those requests. Now it is time to retrieve the analyses. All analysis requests are retrieved using using their specific retrieveSomeAnalysis()
queries. Each query takes three required arguments:
polygonId
startDate
endDate
The retrieveSomeAnalysis()
queries return a list of URLs for the images available between the startDate
and endDate
for a given service.
Let's retrieve the images for Plant Health first. Copy and paste the query below into the API Playground and press the RUN button. Be sure to change the polygonId
to the id of the polygon you created.
query {
retrievePlantHealth(
polygonId: "[YOUR POLYGON ID GOES HERE]"
startDate: "2023-04-01"
endDate: "2023-09-30"
)
{
Message
Status
Result {
colorlegend
png
tif
json
}
}
}
In this example, you are asking the API to return the URLs for:
colorlegend
- This is a static color legend for the .png images produced by the APIpng
- This is an array of the URLs for the .png images produced by the API. There is one image for each processed date.tif
- This is an array of the URLs for the .tif images produced by the API. There is one image for each processed date.json
- This is an array of URLs for the .json statistics files produced by the API. There is one statistic file for each processed data.
In the "Monitor a Request" section, we saw that the API indicates that there are several days available for analysis, so the API will return something like this.
{
"data": {
"retrievePlantHealth": {
"Message": "Success",
"Status": 200,
"Result": {
"colorlegend": "https://spatial-production.s3.eu-west-2.amazonaws.com/[[YOUR POLYGON ID]]/vegetation-indices/colorbar_ndvi.png",
"png": [
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-16_[YOUR POLYGON ID]_ndvi.png",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-26_[YOUR POLYGON ID]_ndvi.png",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-29_[YOUR POLYGON ID]_ndvi.png",
...
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-09-06_[YOUR POLYGON ID]_ndvi.png"
],
"tif": [
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-16_[YOUR POLYGON ID]_ndvi.tif",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-26_[YOUR POLYGON ID]_ndvi.tif",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-29_[YOUR POLYGON ID]_ndvi.tif",
...
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-09-06_[YOUR POLYGON ID]_ndvi.tif"
],
"json": [
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-16_[YOUR POLYGON ID]_ndvi.json",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-26_[YOUR POLYGON ID]_ndvi.json",
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-04-29_[YOUR POLYGON ID]_ndvi.json",
...
"https://spatial-production.s3.eu-west-2.amazonaws.com/[YOUR POLYGON ID]/vegetation-indices/2023-09-06_[YOUR POLYGON ID]_ndvi.json"
]
}
}
}
}
Note: All possible values for the "png", "tif", and "json" arrays are not shown in the results above.
You can use any of the URLs returned by your query to download the associated file. Try it now by copying one of the .png URLs and pasting it into your browser URL box. This will download the image so that you can view it on your computer.
Now, try the same thing for your Water Stress request. Copy and paste the query below into the API Playground and press the RUN button. Again, be sure to change the polygonId
to the id of the polygon you created.
query {
retrieveWaterStress(
polygonId: "[YOUR POLYGON ID GOES HERE]"
startDate: "2023-04-01"
endDate: "2023-09-30"
)
{
Message
Status
Result {
colorlegend
png
tif
json
}
}
}