.dat, .cn1, isoxml, .agt, .shp, .2020, .ilf, GS3? There are many different proprietary machine data formats! The good news: you can use Leaf to translate any of them to standardized and consistent json.
Farm data management is moving to the cloud, but there are often still instances where you need to work with local machine data files.
Below is a quick guide to upload and translate your user's thumb drive files via Leaf. Let's go!
If you prefer a python notebook example, please find one here.
- Step 1: Authentication with Leaf
- Step 2: Find our sample leaf_user
- Step 3: Upload a file to be converted
- Step 4: Retrieve the converted file
Step 1: Authentication with Leaf
First you will need to create a Leaf account via User registration. (In the case you are already registered with Leaf, you can skip this step).
You will then receive an activation email and will need to click "activate" in that email. After that you can use your username and password to generate a token that will give you access to Leaf's API. To do this,
The response of the request should look like this:
The token generated will grant permission to access our services and should be embedded as a header on all other requests to Leaf's API.
Step 2: Find Our Sample Leaf User
In production, it's best to create new users in Leaf to organize individual farmer's data. For now, we add a sample user with sample data to each new Leaf account. We're going to find that user and then upload some data to it. Let's find the sample user with this endpoint.
The response should contain at least the sample Leaf User that will be used to manage other resources inside Leaf’s services. You'll notice the user has an "id" key. This id will be used to specify to which user we are uploading the data.
Step 3: Upload A File To Be Converted
Great! Now, we will upload the raw local files from the monitor (often found on thumb drives, so we call it thumb drive data) into Leaf (check if Leaf has support for your monitor data here). Make sure to have all your thumb drive data downloaded into .zip files in order to use the following endpoint. Leaf will recursively unzip and identify which files are in the uploaded folder and then send them through the appropriate translation process.
Each one of the compressed folders can be inserted in the body of the request as a payload, with CURL we have the following format.
Or, you can use our Postman Collection to select your file by clicking on the highlighted button.
Step 4: Retrieve The Converted File
The previous request should generate a batch_id which will contain a list of Leaf Files processed from the original uploaded files. These files can be accessed using the endpoint.
There you have it! A list with your Leaf Files and their translated GeoJSON's, summaries, Field Operations, and Images will be available for you to use. This same format is used for files coming in via connected APIs so local files and remote files can be used interchangeably in your apps.
Software developers use Leaf’s API to build and scale a wide range of products including farm optimization tools, lending products, outcome-based financing, land and input marketplaces, agronomic recommendations, traceability applications, equipment maintenance forecasting, and more.