Skip to main content

Smart Boundary 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.

Smart Boundary

Once you have successfully created a Party and Farm, you can use the Smart Boundary service to produce a boundary prediction. This is a four-step process due to the asynchronous nature of the service. These four steps have been captured and automated in tutorial/example/smart_boundary.py included in the downloadable tutorial zipfile.

image

  1. Submit a job request for a specific Party, Farm, and inclusive Start and End dates. The JSON for the request looks like the following.

    Notes:

    i. `resourceId` is your `Farm Id` as indicated by the `resourceType`
    ii. `pointOnSurface` is the point where the sample pixels will be taken to find the boundary.
{
"requestPath": "/v1/smart-boundary/job-1",
"partnerRequestBody": {
"imageStartDate": "2023-08-09",
"imageEndDate": "2023-08-19",
"partyId": "party1",
"pointOnSurface": {
"longitude": -92.9819,
"latitude": 41.5046
},
"resourceType": "Farm",
"resourceId": "farm1"
}
}
  1. Poll for the status of the job until the status of the job is SUCCEEDED.
  2. Use the insightId included in the successful status response to retrieve the insight attachment ID.
  3. Use the retrieved insight Attachment ID to download the attachment containing the predictions for all years.

Before we execute the tutorial command that wraps these steps, 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 a log file of the submitted request and its subsequent responses. In the following example the log file is named smart-boundary_2024-08-30T12_52_44.txt. The downloaded insight json file is smart-boundary_2024-08-30T12_52_44-ecc02698-c5f3-4587-a7ad-79a5c5e87624.json, and contains the geojson boundary of the field.

Output Directory Structure

output
└── [your_party]
└── [your_farm]
└── bayerAgPowered.smartBoundary
├── smart-boundary_2024-08-30T12_52_44-ecc02698-c5f3-4587-a7ad-79a5c5e87624.json
└── smart-boundary_2024-08-30T12_52_44.txt

Generate a Smart Boundary insight

Note that you will need to replace the party_id and farm_id "REPLACE_ME" values with your own party_id and farm_id in tutorial/example/smart_boundary.py to generate and retrieve the insight and its attachment.

Note this command will take 20 to 60 seconds to complete. The command is complete when it prints the message "Completed smart-boundary request".

adma> python -m tutorial.example.smart-boundary

An example generated Smarty Boundary insight follows.

{
"coordinates": [
[
[-91.7052976662854, 41.69115307675032], [-91.70529614309724, 41.69115362175576],
[-91.70517956367779, 41.69124008294588], [-91.70517763370061, 41.69124268521886],
[-91.70517165357633, 41.691242979003526], [-91.70464849008094, 41.691242979003526],
[-91.70446325229959, 41.69132508926483], [-91.70445665264852, 41.69133237085768],
[-91.70445065485346, 41.69133266551046], [-91.70326126462625, 41.69133266551046],
[-91.70325526683119, 41.69133237085768], [-91.70324866718012, 41.69132508926483],
[-91.70306342939877, 41.691242979003526], [-91.7006176026424, 41.691242979003526],
[-91.70061162251811, 41.69124268521886], [-91.70060969254094, 41.69124008294588],
[-91.70049311312148, 41.69115362175576], [-91.7004914864915, 41.691153039738246],
[-91.70048952608721, 41.69115039643905], [-91.70037294666761, 41.691063935248806],
[-91.70037142347951, 41.691063390243386], [-91.70037113257932, 41.69105746883404],
[-91.70037113257932, 41.68885536746853], [-91.70025720289824, 41.68865425345557],
[-91.70026099839339, 41.688649135822786], [-91.70025125991019, 41.68864191327139],
[-91.70025096612551, 41.68863593314694], [-91.70025096612551, 41.68784102889583],
[-91.7002512570257, 41.68783510748648], [-91.70025278021386, 41.68783456248104],
[-91.70036935963331, 41.687748101290914], [-91.70037128961049, 41.687745499017936],
[-91.70037726973477, 41.68774520523327], [-91.70041976741491, 41.68774520523327],
[-91.70060500519622, 41.68766309497201], [-91.70061160484732, 41.68765581337912],
[-91.7006176026424, 41.687655518726345], [-91.70252799159248, 41.687655518726345],
[-91.70253409919577, 41.687655818773656], [-91.70254621870984, 41.68765761653374],
[-91.7025465084315, 41.68765566338896], [-91.70264191551817, 41.68765566338897],
[-91.70264220523983, 41.68765761653374], [-91.7026543247539, 41.687655818773656],
[-91.70266043235719, 41.687655518726345], [-91.7027683245001, 41.687655518726345],
[-91.70277432229517, 41.68765581337912], [-91.70278092194627, 41.68766309497201],
[-91.70296615972758, 41.68774520523327], [-91.70505148712252, 41.68774520523327],
[-91.7050574672468, 41.687745499017936], [-91.70505939722398, 41.687748101290914],
[-91.70517597664343, 41.68783456248104], [-91.70517749983159, 41.68783510748648],
[-91.70517779073178, 41.68784102889583], [-91.70517779073178, 41.68941532471284],
[-91.70529172041286, 41.6896164387258], [-91.70528792491771, 41.68962155635858],
[-91.70529766340091, 41.68962877890998], [-91.70529795718559, 41.689634759034426],
[-91.70529795718559, 41.691147155340964], [-91.7052976662854, 41.69115307675032]
]
],
"type": "Polygon"
}