This guide shows how to set up and use the Agricultural Understanding API.
Prerequisites
Make sure you have Google Cloud project and billing set up. Use this guided flow to enable and use all the necessary services.
Provide the following information to the Google team:
- Google Workspace Customer ID (GWCID). See Find your customer ID for instructions on how to find it.
- The email address of the person who will enable the API for your Google Cloud project.
Wait for the Google team to add your email and GWCID to the API allowlist.
Set up
Enable the API in your project by visiting Agricultural Understanding API.
Create an API key. See Create an API key for more details.
Example API Usage
You must include an API key with every Agricultural Understanding API request.
In the following examples, replace API_KEY
with your API key. See the
Reference
for more details about each API endpoint.
Look up landscape data
These are example API calls for looking up landscape data.
Look up landscape with S2Cell ID
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"locationSpecifier": {
"s2CellId": "3486736072451293184"
}
}' \
https://agriculturalunderstanding.googleapis.com/v1:lookupLandscape?key=API_KEY
Look up landscape with coordinates
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"locationSpecifier": {
"coordinates": {
"latitude": 18.624,
"longitude": 73.076
}
}
}' \
https://agriculturalunderstanding.googleapis.com/v1:lookupLandscape?key=API_KEY
Look up historical landscape data
Look up the available capture dates for the landscape data.
curl -X POST \ -H 'Content-Type: application/json' \ -d '{ "locationSpecifier": { "s2CellId": "3486736072451293184" } }' \ https://agriculturalunderstanding.googleapis.com/v1:lookupLandscapeCaptureDate?key=API_KEY
Look up the landscape data by specifying a capture date you got from the previous request.
curl -X POST \ -H 'Content-Type: application/json' \ -d '{ "locationSpecifier": { "s2CellId": "3486736072451293184" }, "captureDate": { "year": 2018, "month": 2, "day": 8 } }' \ https://agriculturalunderstanding.googleapis.com/v1:lookupLandscape?key=API_KEY
Monitor landscape data
These are example API calls for monitoring landscape data.
Monitor landscape with S2Cell ID
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"locationSpecifier": {
"s2CellId": "3486736072451293184"
}
}' \
https://agriculturalunderstanding.googleapis.com/v1:monitorLandscape?key=API_KEY
Monitor landscape with coordinates
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"locationSpecifier": {
"coordinates": {
"latitude": 18.624,
"longitude": 73.076
}
}
}' \
https://agriculturalunderstanding.googleapis.com/v1:monitorLandscape?key=API_KEY