How to translate and integrate field operations (for production)

05 Mar, 2024

How to translate and integrate field operations (for production)

How to translate and integrate field operations (for production)

About

In this tutorial, we’ll show you how to set up field operations with Leaf’s unified API in preparation for production. Leaf translates and merges raw machine files from multiple machine providers and turns them into standardized field operations. This includes planting, application, harvest and tillage. Note if you have already completed the field boundary or manual file upload tutorials, you can skip straight to step 7.

Why integrate operations through Leaf instead of going direct to providers?

  • Receive clean operations data, translated to a consistent format
  • Increase speed to market by skipping the need to build backend infrastructure
  • Provide integrations from many different providers to increase your addressable market
  • Less ongoing API maintenance

To learn more about the benefits, click here.


Summary


1. Register for a Leaf account

First, you’ll need to register for a Leaf account. If you don’t yet have an account you can register below. Make sure to activate your account via the activation email.

Register with Leaf -->

2. Authenticate to access Leaf’s API

Next, you’ll need to authenticate by requesting your access token:

View documentation -->

3. Create a Leaf user

Next, you’ll need to create a ‘Leaf user’.

What is a Leaf user? A Leaf user represents a data owner and is equivalent to a customer/grower account. A Leaf user helps keep your customers’ data organized under your API owner.

You can organize & filter data by leaf_user_id directly within Leaf and attach 3rd party API credentials to leaf_users to manage their individual account access.

Leaf, data infrastructure for agriculture

Your Leaf account includes a sample leaf_user for testing. Let's find that leaf_user & associated leaf_user_id by querying for all Leaf users in the account as shown below:

In the previous step we set the leaf_user as the sample user. If you want to use a different user, you have the option to create a new Leaf user and set the user ID as shown below.

4. Set up configurations

Make sure to review and set your configurations according to your needs. Setting this up now will save you from getting stuck later.

View configurations -->

5. Set up alerts/webhooks (optional but recommended)

By setting up alerts through Leaf, you can be notified of new data and updates instead of repeatedly querying for changes.

View alerts -->

6. Integrate providers

There are 3 ways to integrate providers: Leaf Magic Link, Leaf Link or manual. The option you choose depends on how quickly and what form you want to get authentication to your end user.

Option A: Magic Link

This is the easiest way to set up provider authentication as it requires no front-end coding. Simply send a URL to growers to authenticate with their providers.

Leaf Magic Link uses your application credentials to do the authentication, so you first need to inform it of your desired providers using our set up guides.

Set up providers -->

Then, simply create the Magic Link:

This setup will make you compatible with all providers that you connected by default. If you want to filter to specific providers, you can use the "allowedProviders" parameter. E.g if you only want to allow John Deere and Climate FieldView, add this: "allowedProviders": ["JohnDeere", "ClimateFieldView"]. Remember the provider set up is still required to enable them.

There is also another option with a different layout for a single provider authentication, check the authentication option here.

Option B: Leaf Link

Leaf, data infrastructure for agriculture

With Leaf Link, you can embed a pre-built widget into your application. Similar to Magic Link, all the back-end Leaf user management is handled for you, saving you some steps. You may want to consider this option instead of Magic Link if you want to keep the interface within your application (not via a separate URL).

Get started with Leaf Link for provider connection -->

Option C: Manual

This is the most customizable option if you want to build your own interface, it has more steps than Leaf Link. The instructions on how to authenticate will be different per provider, so it’s important to follow each one specifically. By the end, you will have successfully linked the provider to Leaf so you can start pulling boundaries from customer accounts.

↓ Click on a provider below and follow the steps to authenticate ↓

7. Understanding Leaf's Operations

It’s important to understand the following definitions before proceeding.

Machine file summary: Basic information of files derived from the point data, processed and cleaned by Leaf, in Leaf’s standardized output. Data outputs will vary by the type of task performed (planted, applied, harvested, tillage). You’ll find some sample responses here.

Operations: Field Operations data files merged based on task, time and boundary intersection (planting, application, harvest, tillage).

Operation summary: The output of merged files (Leaf Operations) geospatially attached to a field boundary, that are processed and cleaned by Leaf. Operations only form if there are boundaries present. You’ll find some sample responses here.

8. Get field boundary data to create your Field Operations data

There are 2 ways to get field boundary data, which is required for the geospatial matching of an operation:

Option A. Import boundaries from providers. If you want to use the field boundaries from the provider, you can head straight to the next step as you’ve already connected this data in step 6.

Option B. Use your own boundaries. Send POST requests to create field boundaries; you’ll find more details in the Field Boundary Management Endpoints doc.

9. Check your field operations

Once you have boundaries in Leaf and your machine files have been converted into Leaf's standard format, Leaf will automatically merge machine files into operations based on a few configurations you set up earlier. This merging process runs once every 4 hrs. Once all of the processing is completed (operationsProcessingFinished alert) you can fetch your operations using the following endpoints:

Note that you can also filter it by Leaf user.

If the Field Operations are not available yet, try again after the processing time.

It's also important to note that Leaf requires at least one operation before proceeding.

For each field operation, you can see the important properties, like:

With these properties, you can get extra information, like the field boundary, summary, and the Standard GeoJSON:

Field Operation summary

Field Operation Standard GeoJSON

Leaf’s API also offers a filtered GeoJSON which lets you add more clean-up criteria. You can find more information here. The Filtered GeoJSON makes our image (V2) functionality available which creates images based on the operation properties. Here is how you can get them:

In the endpoint response, you will find an image per each numerical property and a legend with the values. This is what a V2 image looks like.

Leaf, data infrastructure for agriculture

View documentation -->

Excellent, you’ve now set up field operations. Where to next?

--> Get help from the Leaf team --> Field Boundaries --> Manual File Upload --> Crop Monitoring --> Back to the page for developers

Ready to begin?

Get API Keys and Start Building Today!

Sign up for free account

Questions? Get in touch