Tutorial

Sustainable agriculture insights using Environmental Intelligence platform

Set up IBM Environmental Intelligence platform to analyze agricultural land using NDVI and Geospatial APIs for climate-smart insights

By

Neha A

The climate crisis presents significant risks to businesses across various sectors, including potential asset and infrastructure damage, supply chain disruptions, food insecurity, and increased regulatory pressures. Companies also face mounting expectations from customers, employees, and shareholders to operate sustainably. In response, IBM recently launched a public preview of Environmental Intelligence, a robust cloud-based platform designed to help businesses address urgent environmental challenges.

The Environmental Intelligence team processes extensive datasets, including satellite imagery, weather, land, and agricultural data, to deliver actionable insights. This platform supports a range of use cases: Insurance companies can develop sophisticated flood and fire risk models, energy and utility companies can predict outages and assess asset management impact, and agronomists can monitor crop health to make informed decisions that minimize climate crisis effects on yields. Government agencies can also use the platform to anticipate sea-level rise and plan mitigation strategies. Additionally, Environmental Intelligence enables analysis of above-ground biomass data for calculating historical and future carbon units, empowering companies to offset carbon footprints and strengthen sustainability efforts.

In this tutorial, we will focus on using Normalized Difference Vegetation Index (NDVI) satellite data to gain insights into vegetation density within an agricultural context. NDVI is particularly useful for identifying drought conditions by comparing current values to historical regional averages. It also supports efficient fertilizer and irrigation practices by guiding crop scouts to specific field areas that may need attention.

Prerequisites

  • Basic knowledge of Python
  • Python 3.x and Jupyter Notebook installed on your system

Step 1: Create an IBMid

  1. Go to the Free APIs preview page and create a unique IBMid for your account.

  2. Complete the Account Information form and submit it. You’ll receive a verification code at your registered email address.

  3. Enter the verification code to confirm your identity, then submit to complete the registration process.

  4. Click on Submit to accept the acknowledgment form and finalize setup.

  5. Wait a few moments for the service subscription to be set up with your registered IBMid. Once complete, you’ll receive a registration success email.

alt

alt

Step 2: Check your email for the introduction message

  1. After a few moments, check your inbox (including spam or junk folders) for an email from eis-noreply@ibm.com.

  2. In the welcome email sent to your registered IBMid, click the link labeled "Get Started Here" to proceed.

    alt

Step 3: Log in to the EI Dev Console

  1. Log in using your registered IBMid and associated password.

  2. You’ll be prompted to enter a verification code sent to your registered email address. Once verified, you’ll be redirected to the home page of the EI Dev Console.

    Note that some UI components may differ slightly from this tutorial, as the interface is continuously evolving.

  3. In the Account Information section, make a note of your API Key, Tenant ID, and Organization ID—you’ll need these later to run the NDVI use case.

    alt

    Explore the Summaries section to gain a comprehensive overview of EI’s offerings. This will help you understand the platform’s capabilities and identify solutions that best meet your needs.

Step 4: Access setup and quickstart resources

The Setup section provides links to API Hub product documentation and IBM’s open-source GitHub repositories, with detailed instructions for setting up the SDK and installing the Geospatial APIs QGIS plugin.

The Quickstart section allows you to quickly get started with the APIs by executing a simple query, showcasing one of the many capabilities of the platform.

alt

Step 5: Clone and set up the repository

  1. Clone the repository from the Environmental-Intelligence Github to your local machine.

  2. Navigate to the normalized_difference_vegetation_index_analysis.ipynb Jupyter notebook.

  3. In the Setup section, locate the path to the secrets.ini file, and paste the credentials you copied in Step 4 into this configuration file.

  4. Run each cell in the notebook sequentially, observing the output and explanations at each step.

Step 6: Observe the Point Query

  1. Perform a point query for a farmland in Australia. You can modify the coordinate values and temporal interval to observe NDVI values across different spatial and temporal ranges.

    • NDVI values range:

      • -1 to 0.1: Indicates barren areas such as rock, sand, or snow.
      • 0.2 to 0.3: Represents shrubs and grasslands.
      • 0.6 to 0.8: Reflects temperate and tropical rainforests.
  2. Visualize the NDVI values as a time series plot spanning two years.

    • This plot highlights seasonal vegetation variations, helping to detect deviations that may signal poor crop performance.
    • It can also be used to identify periods of drought stress, providing critical insights for effective agricultural management.

    alt

Step 7: Observe the raster query

  1. Define and submit a raster query.

    • Analyze a square area within the same farmland by submitting a raster query.
    • The satellite image generated as output provides valuable insights into land greenness or barrenness, aiding decisions about irrigation, fertilization, and pest management.
  2. Leverage user-defined functions (UDFs).

    • Geospatial APIs support user-defined functions (UDFs) that allow mathematical operations over data layers.
    • Instead of directly querying the pre-processed NDVI layer (ID: 49464), you can calculate NDVI values yourself using the formula:

      NDVI = (NIR - RED) / (NIR + RED)

      • NIR (Near Infrared band): Data layer ID 49361
      • RED (Red band): Data layer ID 49360
  3. Modify the query layers.

    • Update the “layers” section of your query to calculate NDVI dynamically as shown:

        "layers": [{
              "alias": "NIR",
              "type": "raster",
              "id": "49361",
              "output": False
            },
            {
              "alias": "RED",
              "type": "raster",
              "id": "49360",
              "output": False
            },
            {
              "alias": "NDVI",
              "expression": "(NIR - RED)/(NIR + RED)",
              "output": True
            }
      
  4. Adjust query area as needed.

    • Ensure the coordinates define a smaller area if the query size exceeds the maximum allowable limit.
    • Set output to false for the NIR and RED alias layers and true for the calculated NDVI alias to focus on the desired results.

    alt

Summary and next steps

You have successfully harnessed the power of Geospatial APIs to monitor and evaluate agricultural land.

For further insights into developing environmental intelligence solutions, check out the following resources:

These resources provide valuable guidance for developers looking to build climate-resilient solutions and leverage the power of environmental data in their applications.

If you want to solve complex environmental problems, IBM Environmental Intelligence provides the data and tools needed to build innovative, sustainable applications.

Visit the website today for a free preview !