FNC Maps Openrouteservice Travelmode TRUCK - Truck properties

I use OpenRouteService for the calculation of the route, because I want to apply for the calculation of the routes for trucks. I can select "tmTruck" as DirectionTravelMode, but the weight of the truck must also be taken into account. Is there a possibility to include the weight and other data of the truck in the routine "GetDirections", so that these are taken into account for the calculation of the routes (e.g. bridges, above a certain weight, which cannot be driven on, etc.). If not, is it planned for the future?

Hi,

Unfortunately it's currently not supported to include truck data in the GetDirections call.
However this is a good suggestion and we'll investigate if this feature can be added in a future version.

I have built the consideration of the weight of the truck into TTMSFNCDirectionsOpenRouteServiceDirections.GetPostData. In this direction, the properties could possibly be queried and included. I have currently hard coded 18 tonnes. Perhaps you could take this as an approach and include the truck properties in GetPostData :smile:

function TTMSFNCDirectionsOpenRouteServiceDirections.GetPostData(AOriginLatitude, AOriginLongitude,
ADestinationLatitude, ADestinationLongitude: Double; AAlternatives: Boolean = False;
ATravelMode: TTMSFNCDirectionsTravelMode = tmDriving;
AWayPoints: TTMSFNCMapsCoordinateRecArray = nil; ALocale: string = ''; AAvoidTolls: Boolean = False): string;
var
coords, tolls, alts, lang, options: string;
I, wpcount: Integer;

function CoordToStr(Latitude, Longitude: Double): string;
begin
Result := '[' + FloatToStrDot(Longitude) + ',' + FloatToStrDot(Latitude) + ']';
end;

begin
wpcount := 0;
coords := CoordToStr(AOriginLatitude, AOriginLongitude);
if Assigned(AWayPoints) then
begin
wpcount := Length(AWayPoints);
for I := 0 to wpcount - 1 do
begin
coords := coords + ', ' + CoordToStr(AWayPoints[I].Latitude, AWayPoints[I].Longitude);
end;
end;
coords := coords + ', ' + CoordToStr(ADestinationLatitude, ADestinationLongitude);

if ATravelMode in [tmDriving, tmTruck] then
begin
options := ',"options":{';
if AAvoidTolls then
options := '"avoid_features":["tollways"]';

//My changes
if ATravelMode = tmTruck then begin
if AAvoidTolls then
options := options + ',';

options := options + '"vehicle_type": "hgv", "profile_params": {"restrictions": {"weight": 18}}}';

end;
options := options + '}';
end;

if wpcount <= 0 then
begin
if AAlternatives then
alts := ',"alternative_routes":{"target_count":2}';
end;

if ALocale <> '' then
lang := ', "language": "' + ALocale + '"';

Result := '{"coordinates":[' + coords + ']' + lang + alts + options + '}';

Hi,

Thank you for this code, unfortunately not every service included in the TTMSFNCDirections component supports truck options, so we'll have to investigate a way to expose and event or additional properties to include without confusing options with other services. We could make a specific openroute service component for directions that includes more options for truck driving mode, specifically for openrouteservice.

Are there any news on this topic? Are you planning to implement this feature in the future? Is there anything we can do?

This feature would be really helpful for our customers when they are planning routes with for different truck sizes.

Hi

We plan to include this in a future version of TMS FNC Maps.
Unfortunately I'm unable to provide a timeframe for now.

Alternatively; we already added Truck Options for Here Directions a while ago.
Specifics can be found in the online help: