For many routing cases, an “as the crow flies” distance like Haversine works well for finding the shortest path between points. In some instances, like when we’re working in an area with many lakes or with a fleet of vehicles that can only traverse certain roads, we want to take real-road distances into account. Features like bridges, bike-accessible roads, and one-ways become important in these cases.
At Nextmv, we use a combination of open source tools with our engines to provide customers with the best route optimization stack for their use case and respective constraints. We use measures to determine the cost of a connection between two locations, and then our routing engines use that information to minimize overall cost to visit all locations.
We created the routingkit measure based on RoutingKit, a C++ library for route planning. This measure uses mapping data from OSM (OpenStreetMap) to find feasible routes and calculate cost. To make route optimization easier for specific types of vehicles, we provide profiles that calculate cost based on the type of vehicles in your fleet.
Considerations for vehicle profiles
Last-mile furniture deliveries are often handled by box freight trucks. Your piping-hot pad thai may be delivered by bike. Or perhaps your favorite bottle of pinot noir is on its way, safely nestled into the arm of a delivery person on foot.
Each of our carriers above are moving at different speeds and may not be able to traverse on the same roads or ways. As we calculate the cost of each of their routes, the following questions arise:
- What types of vehicles are in our fleet?
- What types of roads and ways can those vehicles travel on?
- At what speeds can those vehicles travel on those roads and ways?
Instead of manually identifying the answers for the last two questions every time, you can use profiles that generalize vehicle-specific attributes and use OSM tags to identify speed and road accessibility based on the type of vehicle.
Standard vehicle routing profiles: pedestrian, bike, car, and truck
We’ve created standard profiles for commonly used vehicles, or rather common forms of transportation used in routing problems. With these profiles, the routingkit measure will only use roads and ways that can actually be traversed by the form of transportation selected.
Note: OSM tags are complex and different regions have unique mapping requirements. We’ve illustrated example scenarios below but these profiles will continue to evolve as we add more enhancements and capabilities.
Meet the pedestrian
Use case: The pedestrian profile is ideal for short-range services like food and beverage deliveries that are carried on foot.
Example: A pedestrian can travel on most roads and ways. Unlike cars, they can use stairs and walk on hiking trails that go through parks. Routingkit will return anything tagged with “foot” as a valid way for a pedestrian to use. Pedestrians can go the wrong way down one-ways and of course do as many U-turns as they like — being careful not to drop the wine!
Speed: The default speed for pedestrians is 5 kph.
Meet the bike
Use case: The bike profile is ideal for short- to medium-range deliveries, like those required by local courier services.
Example: Cyclists can use most roads and ways. Routingkit will return only those tagged with “bicycle” as a valid way for a cyclist to use, ensuring that your delivery person and pad thai both arrive safely.
Speed: The default speed for bikes is 15 kph.
Meet the car
Use case: The car profile is ideal for medium to long-range routing problems like grocery delivery.
Example: Cars can travel on most roads and ways. Routingkit will return anything tagged with “motorcar” as a valid way for a car to use. Cars cannot travel on service roads and they must respect one-ways.
Speed: Putting the pedal to the metal, the car profile can travel at the maximum speed as denoted by the road or way type. For example, 90 kph on motorways and 25 kph on roads in residential areas.
Let’s look at the difference between the route for a car and the route for a pedestrian. We can see that the car has to start out going west to respect the one-way while the pedestrian is able to traverse directly toward the destination.
Meet the (customizable) truck
Use case: The truck profile is ideal for high-capacity and/or large item routing like furniture distribution or material sourcing.
Example: Trucks can travel on many of the same roads and ways as cars but cannot do u-turns. The truck profile is unique in that it is customizable by weight, length, height, width, and speed. These variables will impact the roads and ways the truck will be able to use. For example, a wide truck will not fit through narrow roads in Italy and a tall truck will have to avoid low bridges and overpasses in Germany.
Speed: They follow the same speed rules as the car, going at a maximum speed as denoted by the road or way type while also respecting the top speed configured in the truck profile.
Let’s look at the difference between the route for a truck and the route for a car. In this instance, we can see that the car takes one road directly from stop 1 to stop 2. The truck, on the other hand, takes a considerably longer route. If we look closer, we can see that the truck is avoiding a low bridge for a railroad crossing.
Custom vehicle profiles for route optimization
What if the vehicles in your fleet don’t match up with any of the standard profiles above? Not to worry. Create a custom profile that matches the attributes of your unique vehicle. For example, we can create custom profiles for a scooter and a motorcycle that specify attributes like maximum speed.
New profiles require the definition of a custom profile name, transportation mode (vehicle, bike, or pedestrian), flags to permit left turns and u-turns, and custom speeds per way type specified (e.g., a custom speed for traveling on highways).