Vehicle Profile
Following example will guide you through setting up the MapTrip SDK for normal truck routing.
The MapTrip SDK can be used for car and truck routing. Therefore, it is important to set the right speed profile and vehicle attributes. Consequently, the MapTrip SDK provides different VehicleProfiles as list by calling VehicleProfile.getVehicleProfileIterator() or VehicleProfile.getVehicleProfileIteratorByName(name).
At first, you will need to get the right VehicleProfile based on the profile name for your purposes. You will usually selected between car (types_fast.txt) or truck (types_truck_highway.txt).
1 2 3 4 5 6 7 8 | |
Next, you want to customize vehicle attributes, e.g.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Finally, activate the profile:
1 2 3 4 5 6 7 8 | |
Overall you can use the speed profile independent of vehicle attributes. This comes in handy if you only care about the right speed profile or you want to add attributes to a car, e.g. to serve as sprinter.
In summary, make sure that you
- Use getVehicleProfileIteratorByName("types_truck_highway.txt") to directly fetch the desired profile.
- Use setter methods (setVehicleHeight, setVehicleTotalWeight, etc.) to customize.
- Call setVehicleAttributesEnabled(true) if you want to use it.
- Call setAsActiveProfile() to activate it for routing.