Asset Tracking

A solution for ingesting, enriching, storing, and retrieving live location data

What does this solution do?

Logistics providers need to continuously improve safety, efficiency and satisfaction for their customers. To achieve these goals, providers need to overcome three major problems:

  1. Operational visibility - A trucking company needs to respond to a mechanical problem with a vehicle. The company’s legacy system only describes the vehicle location at specific barcode checkpoints. Without an asset tracking solution, service operators must get on the phone to determine the exact vehicle location and dispatch a technician.
  2. Customer experience - A grocery delivery company needs to show customers exactly where their delivery is. Providing accurate and real-time ETA updates to customers reduces churn and increases adoption.
  3. Compliance and reporting - A rental car company has parking lots where vehicles are returned and restricted areas where they cannot operate. Without an asset tracking solution, they don’t know if a customer enters a restricted area or abandons a vehicle until they get fined by law enforcement.

The Mapbox asset tracking solution solves these problems by determining whether assets are on task, on time, and on location.  

Last Updated:
September 13, 2019
Start building
Get source code from Github

Solution details

This solution deploys a pipeline using AWS infrastructure to ingest, enrich, store, and retrieve live location data. Data flows through the solution in four phases:

Phase 1: Data ingestion
Data is ingested into the pipeline from any device that measures and transmits location, such as an Automotive Vehicle Location (AVL) sensor or a mobile device with GPS. After AWS IoT Core ingests the data, it is forwarded to AWS Kinesis for processing.

This solution comes with a test IoT harness for sending sample messages into the pipeline. You can create your own asset application to measure and transmit location using the Mapbox Navigation SDKs for Android and iOS.

Phase 2: Data enrichment
Once the data has entered the Kinesis stream, an AWS Lambda function enriches each data point with geofence status and elevation. Geofences define areas of interest for your business that you want to track, such as no-park zones defined by the city government for a bike share application. Elevation data allows you to create route profiles from historical data for route planning, fuel optimization, and vehicle simulation.

Geofence status is added by querying the Mapbox Tilequery API, and polygon geofences are defined using the Mapbox Datasets Editor. High-precision elevation information is added by querying the Mapbox Terrain-RGB dataset from the Mapbox Raster Tiles API.

You can customize how your data is enriched in the AWS Lambda function. For example, you can call a third-party service such as the Mapbox Directions API to calculate traffic-aware ETAs. You can also retrieve business-specific information from a database, such as delivery time SLA's or package contents.

Phase 3: Data storage
Once enrichment is complete, the data is written to an AWS DynamoDB table and simultaneously archived to AWS S3. DynamoDB stores the current state of all assets, while S3 serves as a low cost, long-term archive for all historical data.

You can move data from S3 into a data warehouse for historical analysis. For example, you could identify frequent truck idling locations and the impact on fleet fuel efficiency in the past quarter.

Phase 4: Data retrieval
The data in DynamoDB can be consumed via a REST API powered by AWS API Gateway and AWS Lambda. The API transforms the data into GeoJSON using TurfJS for use with Mapbox GL JS.

You can build a live asset tracking dashboard or customer delivery status map using the API to retrieve data from DynamoDB. This solution includes a sample web dashboard which connects directly to the API and visualizes live asset location and state.

Technical information

Source code can be found in the GitHub repository.

What you’ll need:
To deploy this solution you will need the following:

  • AWS account:
    You will need basic familiarity with Amazon Web Services (AWS). You will need an active AWS account with valid Access and Secret keys to deploy your infrastructure. If you do not have an AWS account, you will need to create an account and consult the AWS documentation for configuring CLI access.
  • Pulumi:
    This solution depends on Pulumi. Pulumi allows you to use common programming languages like Javascript to define and manage infrastructure. It reduces the need to manually manage infrastructure deployments via the AWS Console or learn new syntax like CloudFormation. Once you have signed up and installed the CLI, run pulumi up to deploy the solution.

Usage considerations
You will be consuming services from Mapbox and AWS. You are responsible for any associated costs.

  • Mapbox usage
    Each message ingested into the pipeline will make a single call to the Raster Tiles API for elevation, and the Tilequery API for geofencing. The sample dashboard visualization consumes map loads. All services used in the solution are available on free tier. For more pricing details, consult the Mapbox pricing documentation.
  • Pulumi
    There is no charge for Pulumi usage.