Lune Docs Logo
Log inContact us

Road transfer inference

At Lune, we aim to make emissions calculations as simple and accurate as possible. That’s why we offer Road transfer inference, a feature that helps refine journey details when limited data is available.By analysing the source and destination locations you provide, Lune can determine whether route corrections or additional legs should be added. Inference improves the accuracy of emissions calculations, even with minimal input data.

Pre-requisites

Complete the following setup steps before using this guide:
/illustrations/stamp-key.png
Generate an API key and authenticate your account.
/illustrations/stamp-accounts.png
Set up Client Accounts to track emissions for your individual customers.
/illustrations/stamp-route.png
Review how to calculate emissions for multi-leg shipments using the API.

How it works

To engage road transfer inference in your emission estimate calculation, the following steps must be taken. When making an API request for a shipment emission estimate, you must include the source and destination for your shipment. Additionally, include a apply_route_inference query parameter to your endpoint and set it to true.Lune will assess the locations, and determine if adjustments need to be made based on the distance from a sea port, airport, or rail station, and the transport method chosen.Depending on the input data, inference will work in one of two ways:
  1. Additional legs will be added
  2. The source and destination will be adjusted to a nearby port
1. Additional leg inference
If the source or destination location is far from an airport, seaport, or rail station, but the transport method is set to air, sea, or rail respectively, it is likely that the shipment was transported to or from the port by road. Therefore, when making the emission estimate, Lune will add a road leg to the overall shipment to represent this transport.This leg will take the shipment to or from the indicated source or destination location, to the closest port for the chosen transport method. If a road leg has already been included in the shipment, the additional leg will use the same vehicle details as the adjacent road leg. Otherwise, the leg emission estimate will be calculated based on the use of a generic diesel truck.
2. Port inference
If the starting location is pretty close but not exactly the location of an airport, seaport, or rail station, and the shipment is by air, sea, or rail respectively, Lune will automatically adjust the location to the nearest port or station. The emissions calculation will then reflect the updated distance and adjusted source/destination inputs, ensuring maximum accuracy.

Understanding your results

Once the request has been made, you can expect to see a legs array as you would with any shipment emission estimate calculation request. However, any leg that has had inference applied in either of the two ways described above, will have an additional resolved_legs object nested within the leg object. If additional leg inference is applied, there may be several resolved_legs objects nested within a single leg object.The response object includes will include the following properties:
resolved_legs.mass
The estimated tCO₂e for the resolved leg.
resolved_legs.distance
The calculated distance based on the source and destination determined for the leg.
methodology_details.route_inference
An object with information about how the inference was applied to the originally requested leg. The object will include an inference explanation property for each resolved leg, with values such as snapped_source_to_known_location or inferred_source_transfer_point.
For a full list of properties in the resolved_legs object, please refer to the API reference.The following is the legs object of a sample response to a request with a single cargo air transport leg. Given the source and destination provided, the single leg was converted into three legs, returned in the resolved_legs object. The response has been edited for brevity.
  • Legs sample object with road transfer inference
  • In addition to the API response, the details associated with the resolved legs, including the inference explanations and any other methodology can be found in the emission estimate calculation page, or in the Lune dashboard. The URLs for these pages can be found in the external_estimate_url or dashboard_url properties of the API response, respectively.

    What to do next…

    To better understand the methodology used to calculate emissions, now that road inference has been applied, we encourage you to review the following guides…