SHARE

Navigating from Point A to Point B is one of the most common use cases we see in location services. If you’ve ever felt like the travel time estimate was wrong you might wonder why. One reason is that we don’t all drive the same way. Since estimates returned from navigation services are best guesses based on traffic conditions and average speeds it may not match your expectations. If you want an app that provides more accurate results, the custom speed profiles in the HERE Fleet Telematics REST API might help.

I’m going to take a look at what Fleet Telematics is to demonstrate how to use the REST endpoint with curl and get back results based on a custom speed profile.

What is Fleet Telematics

What does the name Fleet Telematics mean? The first part of the name comes from Fleet, meaning a group of motor vehicles owned or leased by an organisation rather than an individual. The typical examples of this are things like car rental companies, taxicabs, public utility vehicles, buses, delivery trucks, police and rescue vehicles, etc. The second part of the name Telematics is derived from the French telematique, a blended word of telecommunications and informatique (computer science). From the blog post Our Platform Extensions Are Getting a Makeover you learned a bit about why the Fleet Telematics API can be useful when your use case gets more advanced than the Routing API alone.

Let’s start with the basics.

Routing API

The Routing API is perfect for quickly finding the route between two waypoints for most cases. Let’s look at an example navigating from Alamo Drafthouse Cinema in Austin, TX to The Alamo in San Antonio, TX.

I setup a short script like the following (for Linux / OSX) which initialises my APP ID and APP CODE into my environment. You can find these values from the Projects dashboard:

Then I can use curl and jq to pretty print the resulting JSON response and run some experiments:

The route from theatre to museum is 131,419 metres (81 miles) with a travel time of 5,233 seconds (1 hour, 27 minutes).  This CalculateRouteResponseType as pictured below includes a set of instructions (or maneuvers) we can use from the response.

I also included the legattributes=li which will include the RouteLinkAttributeType in the response. These links include the speed limit details that can be useful.

In the article Speed Limit Fragment for Android SDK, Mariusz taught us how to retrieve SpeedLimitFragments with the Android SDK. It’ll take a little bit of work to parse the JSON response from Routing API and REST alone to associate the speed limit of the link for each road segment maneuver.

Fleet Telematics API

There are a lot of parameters you can use to calculate a route with the Routing API but there are some limitations for more advanced use cases. The Fleet Telematics API helps with the scenarios through its own calculateroute resource to do things like:

  • Define custom speed profiles for any FC class road in the HERE road network to calculate more appropriate ETAs
  • Calculate routes considering driver rest times for any type of routes (eg, with/without waypoints, custom routes)
  • Calculate routes based on desired arrival time and day to a destination while considering real-time or historical traffic
  • Calculate fuel-/energy-optimised routes considering road conditions like uphill and downhill
  • Calculate cost-optimised routes considering toll-cost information for various vehicle profiles

It’s this first use case I’m going to look at a bit more.

Speed Limits

A bit of background about speed limits. In January 1974, the United States passed the Emergency Highway Energy Conservation Act that prohibited drivers from exceeding 55 miles per hour (90 km/h) on any roadway. The rationale for the law was fuel efficiency during the oil crisis and price spikes of the time.

The National Motorists Association advocated for its repeal and was successful in 1995. The NMA position on speed limits is that they should be set according to the 85th percentile of free flowing traffic. The theory is that most drivers are rational so a “realistic” speed limit is one in which no more than 15% of the public exceeds through reasonable compliance. The Institute of Travel Engineers explains that “a speed study usually creates a speed distribution” for a segment of road and the speed can be set +/- 5mph of the 85th percentile unless engineering or other specific road conditions deem it unsafe.

A Federal Highway Administration (FHA) study of nearly 200 roads in 22 states determined that 55% of traffic exceeded the posted speed limit. Even after speed limits were raised or lowered as much as 20mph, there was not much variation in speed and no significant changes in crashes.

I’m going to see what happens when increasing the speed profile for this route.

Custom Speed Profile

If you take a look at the Fleet Telematics API Reference you can view the Routing & Route Matching specification. The request is pretty similar to the routing API but the URI differs and you must provide a vehiclecost or drivercost.

I get back additional results from this query, including the links without requiring an extra parameter. To change the speed profile though I’m focusing on one parameter in particular: speedFcCat.

speedFcCat

Comma separated list of speeds driven per road functional class and speed category. Can contain empty entries (don’t change). Overrides router’s default driven speed values.

The Geocoder API Speed Category is a useful reference to understand. The following example is to illustrate various speed categories that match up with the functional class of road. You can find the functional class from the link details:

You can use one of the default speed tables for car, truck, 7.5 ton truck, 18 ton truck or give your own arbitrary speeds in kph. The trick is that you must provide something for each speed category and functional class. If you don’t specify a value the default will be used, but you still need the delimiter.

For example, TX-130 has a speed limit of 85mph and is the fastest posted highway in the United States so the request might include a parameter like this modifying the first four speed categories and leaving the remaining four the defaults.

As might be expected, driving faster will reduce the total travel time in the response.

Wrapping Up

Custom speed profiles are only one way of getting started with the functionality available from the Fleet Telematics API. There are plenty of other projects involving truck routing, custom locations, geofencing, and more that can help build solutions by adjusting some of the parameters. Let us know how you are using it in the comments, but until then please drive safely and follow posted speed limits.

This article is reprinted by permission and was originally published on the HERE developer blog. The author, Jayson DeLancey is a Senior Developer Evangelist with HERE Technologies in Berkeley, CA. He writes about his location technology experiences related to Web, IoT, and Robotics projects using a variety of technologies like ReactJS, Python, and Cloud Foundry. Jayson is an active advocate for maker and open-source communities. You can find him on Twitter (@jaysondelancey) or LinkedIn (in/jaysondelancey).

You can contact the Grey Matter mapping team who are HERE specialists, to discuss your use case directly: +44 (0)1364 655 133 or email: mapping@greymatter.com

Find out more about how Grey Matter Ltd can help you with this subject. Send us a message:

We’d love to be able to send you news about our great offers and the latest info.

Yes keep me updated please