Sorry, you need to enable JavaScript to visit this website.

Commercial Fleets, Vehicle Tracking, and the TomTom Location History API

The TomTom Location History and Geofencing services provide crucial details about fleet movement for a business.


If you're building applications for vehicle tracking, fleet management, and mobility scenarios, you'll need the ability to track the location of assets. It also means you need to store it somewhere.

How do you store this location information in an easy and secure way? You can build your own server, but it needs to be publicly available for both gathering tracking data and reporting location history. Do you want to spend vital development time managing storage and a public API? How do you make sure it scales correctly if your app grows? 

You can use a public cloud provider, but just the problem of gathering and managing data will add to the costs, and distract from your focus on app development. On top of that you are responsible for that sensitive data. You need to trust whoever is handling it.

The TomTom Location History API solves these problems. TomTom safely stores your location data so you don't have to worry about it, and hosts it for you so you don't need to set up and secure endpoints yourself. The Location History service is ad-free and platform agnostic.

It's also built to work easily alongside other TomTom APIs, so you can build awesome fleet or package tracking applications without hassle.

Vehicle Tracking and Location History Basics

Let’s start with some quick background: what do we mean by terms like "fleet management," "logistics," "mobility," and "on-demand?" There’s some misunderstanding and flexibility in the usage of these terms around the industry, and if you’re new to the field you might not immediately recognize the differences between them.

Usually, for fleet management and logistics, we’re looking at delivery trucks, optimized parcel delivery, and emergency services. There’s a lot more long-term planning involved and location and vehicle tracking is of utmost importance for operation optimization and safety.

Mobility and on-demand scenarios focus more on short distance and just-in-time service. Think of Uber, taxis, food deliveries, and other similar services. They react to immediate demand.

The TomTom Location History API is very flexible and works well in each of these areas. It allows you to track and manage the location of multiple objects. Any object, like a person (via a phone or other device), a vehicle, or a package (through location scans, RFID, or other technologies), can be tracked by the API. If you can capture a location and submit the location to the Location History API, that data can be used for location history. 

This captured location data is stored in an easily accessed cloud environment. You can then use that data easily along with other TomTom APIs to create rich, real-time data applications that can help you plan your next move. Using historical location data, you can do analyses to spot trends and be better prepared for peak traffic in the areas you serve.

In this article we’ll look at a specific mobility example: a food delivery service. When optimizing a delivery service, you can gain a competitive advantage if your fleet is positioned to cater for the lunch time or dinner time rush. With location history, you’ll be able to see trends where demand has been recorded over time, and use that information to direct your fleet accordingly in the future. 

Getting Started with TomTom Location History

To get started with the Location History API and other TomTom APIs, you need to get an API key. Simply create an account at the TomTom developer portal and get the key from your developer dashboard. For various services, like the Location History API and the Geofencing API, you will need to register an admin key, using the Configuration service.

If you’re building a robust app for a fleet management, logistics, or mobility scenario — like our food delivery example — you will likely need the TomTom Geofencing API. This API enables you to define areas, or fences, on geographical locations. Once your fences are defined, you can use the location of an object to determine whether it is within or close to a fence. 

Next, you will need to create a project, which is a container for your areas. Using the Fences service, you can create your areas. You can define your objects, such as delivery vehicles, using the Objects service.

The Geofencing API and the Location History API share data from the Objects service too, so you can use the Geofencing API to create and manage objects and areas, and you can use the Location History API to determine the location of your objects: in this case, the location of delivery vehicles over time.

Putting the Pieces Together to Track Objects

After you define your fences and objects, you can start tracking movement history for those objects. For example, for food delivery you could define the neighborhoods your deliverers provide service to, as well as the food pickup locations. When applicable, you can add other fences, like hotel districts and tourist attractions. 

The service enables you to create fences on the fly. For example, a restaurant might test neighborhood-specific promotions, creating fences to track customers originating orders or taking deliveries to determine the effectiveness of the promotion.

When you use this functionality in an app alongside the capabilities of other TomTom APIs, like the Map Display API and the Traffic Flow API, you can visualize routes and avoid busy traffic.

Your app might report the current location every time a customer orders a meal online, or an order is delivered to its destination. To reference historical location data, you can use the Position History service. This allows you to get a report of an object’s past recorded locations. You can request the past locations of an object to track its estimated speed and direction. 

To summarize, you'd use the Geofencing API to create fences and objects, then combine that data with the locations from the Location History API to get real-time data about the location of your tracked objects. 

Fences help you filter all that location data down into useful summaries: instead of cars at a dozen different points, fenced areas tell you "most orders stay near my main location, but there's a growing business in the next neighborhood over." This will give you a better idea of where your focus should be.

Fleet-Logistics,-Vehicle-Tracking,-&-the-Location-History-API

Digging into the Location History Services

Gathering location information is useful only if you can use the data in a meaningful way. To this end, TomTom has various reporting services. When creating real-time location reports, you would likely use the Report service, the Transitions service, and the Alert service.

The Report service returns information about the fences surrounding a specific location or object. The fences could be those that the location or object is inside of, or those that are within a specified radius. Using this information, you can see if your tracked delivery cars are in or near a specific location.

The Transitions service returns data when an object crosses the border of a fence, or in other words, when an object enters or exits an area. This can be used to track food delivery vehicles when they leave or arrive at a destination. You may find delivery vehicles cross other areas that are of interest, allowing your app to automatically suggest ad-hoc stopovers if necessary.

The Alert service can send out notifications to users via the Notifications API when they enter or exit a fence. The Notifications API provides the flexibility to send alerts via webhooks or email.

Using these reporting services allows you to create applications that give you real-time data about an object’s whereabouts and receive notifications when an object enters or leaves an area, allowing you to respond instantly when necessary. When displaying this data on a map through the Map Display API, you get a visual image, which will further help in planning routes.

With the Archive service you can download all the historical data of a user in one compressed file. This allows you to process the data in external applications or use it for archiving purposes.

By analyzing historical data, you can find daily, weekly, monthly, or even yearly trends. For example, deliveries near outdoor events may be heavier during summer, while at-home delivery is busier during autumn and spring.

Next Steps

In this article we looked at the various TomTom services that make up the Location History API and the Geofencing API, and that can be employed to build robust asset or vehicle tracking applications for businesses. The two APIs share data and can be used to track your fleet and to generate real-time reporting and notifications. 

By combining the outputs of the APIs, you can make it easy to track vehicles in your fleet, easily find information such as who is close to a destination, and use real-time data to plan aspects of your business based on where business is, and when it's there. Using historical data allows you to find trends so you are better prepared — for example, provide delivery vehicles for peak hours in specific areas.

To get started, register at https://developer.tomtom.com/. You can read about other APIs and tutorials on the TomTom documentation page and the Asset and Vehicle Tracking page.

Learn more about TomTom's fleet and logistics solutions on the Asset and Vehicle Tracking page here.

First published: 
Wednesday, September 16, 2020 - 20:44
Last edited: 
Monday, September 28, 2020 - 05:19