Get Started

  • This guide explains how to set up and use the Agricultural Understanding API.

  • Prerequisites include setting up Google Cloud, providing specific information to Google, and waiting for allowlisting.

  • Setup involves enabling the API in your project and creating an API key.

  • Example API usage demonstrates how to look up current and historical landscape data and monitor landscape data using S2Cell ID or coordinates.

This guide shows how to set up and use the Agricultural Understanding API.

Prerequisites

  1. Make sure you have Google Cloud project and billing set up. Use this guided flow to enable and use all the necessary services.

  2. 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.
  3. Wait for the Google team to add your email and GWCID to the API allowlist.

Set up

  1. Enable the API in your project by visiting Agricultural Understanding API.

  2. 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

  1. 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
  2. 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