A PTV API integration into a road logistics TMS: challenges and opportunities

The logistics industry is a dynamic, ever-evolving sector that operates on razor-thin margins while striving to meet an ever-increasing demand for speed and efficiency. To stay competitive, logistics companies need to employ advanced technologies that let them quickly adapt to new market challenges.  One such technology is a robust Transport Management System. In a world […]

by Reneta Nikolova

November 15, 2023

4 min read

PTV-integration-transportation-management-system

The logistics industry is a dynamic, ever-evolving sector that operates on razor-thin margins while striving to meet an ever-increasing demand for speed and efficiency. To stay competitive, logistics companies need to employ advanced technologies that let them quickly adapt to new market challenges. 

One such technology is a robust Transport Management System. In a world where every second counts and every mile travelled has financial implications, a good TMS has become indispensable.

The TMS arms race

Companies are investing ever-increasing amounts into improving their systems. Let’s look at the numbers: the global TMS market was valued at USD 13.5 billion in 2022, and is projected to surpass 33 billion by 2028, at a 19.7% compound annual growth rate. 

Several main factors are driving that amount of growth. According to a Gartner report, TMS users can expect to save 5-15% of their annual freight costs. Furthermore, the steady proliferation of cloud solutions has pushed many suppliers to make the shift and adopt a more digitized approach. 

Crucially, technology has also been steadily improving, opening up new horizons to logistics providers. New and improved visibility tools are available on the market, lending companies increased visibility and an improved end-user experience. 

We were recently part of a concerted effort carried out by a partner of ours – one of the largest logistics companies in Europe with a presence in over 100 countries. They wanted to enrich their TMS with several features: 

  • Route optimisation in order to boost fleet utilization and overall efficiency
  • Map visualization
  • Geocoding
  • Routing and more

To that end, we helped integrate the PTV framework’s API into their Transport Management System. In this article,  we talk about how we did it, the challenges we faced along the way, and the best way we found to overcome them. 

Integration challenges: a multi-pronged approach

The integration presented several technical challenges, and each of them needed to be tackled and overcome separately. 

Calculating route distances

A TMS typically stores pickup and delivery locations as human-readable addresses – but in order to calculate distance, we needed geographic coordinates. The xLocate API let us convert addresses into the necessary coordinates. 

However, the API itself still requires a detailed address in human-readable format. We solved that by preparing addresses of both locations as strings – including country, city, street, house number, and zip code – then call to the API. Once it returns a list of found addresses, we pick the relevant one based on a matching system and store its coordinates. 

We also used the API’s search function to improve address matching. 

Now that we had both addresses in the format we needed, we could calculate the optimal route between the two, taking real-world infrastructure and similar factors in mind. The xRoute API enabled us to achieve that efficiently. 

It requires a list of waypoints to go through, including a marked beginning of end. The PTV API lends itself to various route calculation options. We were able to choose between route optimisation options such as: 

  • Picking the shortest/fastest route
  • Avoiding toll points
  • Avoiding highways and/or ferries
  • Excluding specific countries or regions

In any case, the API response would include a detailed route with precise coordinates and distances. Based on our partner’s needs, we opted for the solution to display the shortest possible route between the selected waypoints. It also shows the distance in the TMS, making it available for other tools and features. 

Shipment route visualization with an interactive map

In order to visualise the route in an interactive map, we used a PTV tile server called xMap. It offers several visualisation toolkits. We decided to use the Leaflet library, which let us add additional visual layers to the solution’s map. We started by adding two main layers: 

  • A transport layer to visualize all transportation routes
  • A label layer to show location names and details

Once the map has all transportation routes and relevant locations, the solution runs the coordinates through Leaflet. Then a third, custom layer comes in and displays the shipment’s route on the map.  

Finally, to make it more visually appealing, we added yet another layer with markers (pins) to differentiate starting and ending points. 

A successful integration

When it was completed, the integration of the PTV API brought about several benefits:  

  • Improved data accuracy and route optimization
  • Precise address conversion: The TMS allows our partner to convert addresses into precise geographic coordinates, allowing for more accurate invoicing and overall logistics planning.
  • Efficient route planning: Thanks to the system, our partner can calculate optimized routes and account for real-world factors like road conditions and traffic. This boosts decision-making, fleet efficiency, and overall operational performance.
  • Interactive shipment visualization
  • Visual clarity: The solution supports interactive maps, enabling visualization of shipment routes, cities, and countries. That serves to enhance communication and informed decision-making.
  • User-friendly interface: Interactive maps provide a user-friendly interface, making it easier for operators to view and share detailed shipment routes, improving overall logistics management.

Last but not least, such a solution is designed to be scalable – and therefore, easy to update. In addition to expanding functionalities, we wanted to ensure our partner is primed to stay ahead of ever-evolving industry demand. Keeping up with new tools and technologies, and integrating them into your system, is becoming a strategic imperative for staying competitive. 

Learn more about our tailored approach.

Software engineer @Dreamix