Skip to main content

Imagery APS

Disclaimer

The example Python source code is meant merely as a starting point to quickly interact and retrieve insights from ADMA. It is in no way intended for production workloads.

Imagery Service

Once you have successfully created a Party, Farm and Field, you are ready to execute the additional provided examples.

Now that we have the needed entities created, we can use the Imagery Service to create an image insight. This is a four-step process. These four steps have been captured and automated in tutorial/example/imagery.py included in the downloadable tutorial zipfile..

image

  1. Submit a job request for a specific Party, Field, layer, collection, start and end date. The JSON for the request looks like the following. Note that in this case resourceId is the fieldId as indicated by the resourceType.
{
"requestPath": "/v1/imagery-add-on/{job_id}",
"partnerRequestBody": {
"partyId": "",
"collection": "sentinel-2-l2a",
"layer": "VEGETATION_MAP",
"resourceId": "",
"resourceType": "Field",
"sceneStartDateTime": "2023-08-28T00:00:00",
"sceneEndDateTime": "2023-08-28T23:59:59"
}
}
  1. Poll for the status of the job until the status of the job is SUCCEEDED.
  2. Get a list of job insight attachments.
  3. Save each of the insight attachments.

Before we execute the command, a little explanation is in order. A new directory will be created in the root of the adma directory named output. Within the output directory, the following directory structure will be created: party_id/resource_id/solution_id. This directory will hold log files of submitted requests and subsequent responses. In the following example the log file is named 2023-08-28-VEGETATION_MAP.txt. This directory will also hold two generated insights. The JSON file is a JSON representation of the legend that accompanies the TIFF image.

Output Directory Structure

output
└── 551c7fb3-8b9c-4b5c-8ecc-d6830325ce12
└── b159f824-4d12-4b40-aa38-b98f0c876edf
└── bayerAgPowered.imagery
├── 2023-08-28-VEGETATION_MAP-5ae18207-947c-4b87-8bb7-04dd1aad4c74.tiff
├── 2023-08-28-VEGETATION_MAP-643e4515-29d2-440c-8afb-22900aff826a.json
└── 2023-08-28-VEGETATION_MAP.txt

Generate Imagery Insight

Note that you will need to modify lines 78-79 in tutorial/example/imagery.py to add the UUID of the Party and Field in order to generate and retrieve the insight and its attachments.

Note this command will take a few seconds to complete. The command is complete when it prints the message "Processed 2023-08-28-VEGETATION_MAP".

python -m tutorial.example.imagery

The generated vegetation image.

image

Sample Imagery Output

You may also want to download this sample imagery output.