Integrating Leaf with ArcGIS Enterprise

27 Mar, 2024

Integrating Leaf with ArcGIS Enterprise

Integrating Leaf with ArcGIS Enterprise

About

This tutorial provides steps to consume Leaf geospatial data through your ArcGIS Enterprise environment.

This process is based on geoprocessing that can easily communicate via Leaf Alerts when new data like Field Boundaries, Satellite images, and Field Operations are available.

Summary

  • Step 1: Register for a Leaf account
  • Step 2: Connect your customer data
  • Step 3: Create your geoprocessing
  • Step 4: Publish your geoprocessing
  • Step 5: Configure the alert with Leaf

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 https://withleaf.io/account/quickstart

2. Connect your customer data

You can use Magic Link to facilitate the providers’ credentials connections or even the manual data upload. Please reference the toolbox samples in the previous tutorial [link to Consuming Leaf datasets in ArcGIS Pro tutorial] for assistance with data connections.

More information about the Magic Link can be found here [link to magic link tutorials].

3. Create your geoprocessing

Here [link to toolbox sample] is an ArcGIS toolbox configured with specific parameters, these parameters are the properties available in the Leaf Alert service.

Example: If you need to listen for any new satellite images available for your fields, you can create your geoprocessing with the following parameters, based on the newSatelliteImage alert documentation:

Parameter name Type Description
externalId String The satellite field (AOI) identifier. It can be used to retrieve the field information in the "Get a satellite field" endpoint
processId String The identification of the set of images available, usually for a specific timestamp. The "Get an image of satellite field" endpoint will provide all images available for the given process, it also requires the externalId.
type String The type of the Alert, in this specific case the value will filled as `newSatelliteImage`
timestamp String The timestamp of the alert. It means the time when the resource becomes available and gets notified.
X-Leaf-Signature String A security layer to ensure the communication was sent from Leaf. It will be required for all geoprocessing used in the Leaf Alert consumption.

Leaf provides images from Sentinel-2 and Planet Scope, in GeoTIFF and PNG formats. The images available can be the original multiband GeoTIFF, the RGB composition, or calculated indexes like NDVI and NDRE.

Since your geoprocessing will act like a webhook, you will receive a new image as soon it becomes available, you can download the images using their URLs. Remember you need to be authenticated with Leaf to use the download URLs, check our authentication document to know how to use it.

One option would be to add the images directly to a mosaic if you use Mosaic Datasets.

The sample toolbox downloads and stores the image in a directory in the server where your ArcGIS Server is hosted. Feel free to change this and add your own rules.

3.1. Security

As your geoprocessing will be publicly available, you must handle the security validation based on a signature that only Leaf and your geoprocess will know. Below is how you can develop this. The secret variable should be a random and strong word like a password. Tt will be the key that will be informed to Leaf and can not be shared outside Leaf communication.

4. Publish your geoprocessing

You can follow the instructions available on this documentation page: ArcGIS Pro documentation: publishing a geoprocessing service and share your code as a geoprocessing service

Please make sure your service is public to everyone. This is a requirement for communication with Leaf Alerts. The security of the consumption will be validated based on the secret as mentioned in the "3.1 Security" topic.

5. Configure the alert with Leaf

After publishing and configuring your geoprocessing, make sure you have the following information:

  • The secret used in your code;
  • The geoprocessing URL.

Now, you’ll register your geoprocessing as the endpoint to receive the Leaf Alert, like this:

Remember to include the /submitJob?f=json at the end of the service URL if it is asynchronous or \execute?f=json if it is synchronous geoprocessing.

Done! From now on, every time a new image or other registered entity is available the notification will be sent directly to the geoprocessing.

Ready to begin?

Get API Keys and Start Building Today!

Sign up for free account

Questions? Get in touch