Routing profiles
Every navigation trip needs a routing profile: JSON that describes vehicle type, dimensions, and routing preferences. Pass the profile as the fourth argument to createTrip.
Built-in profile constants
@trimblemaps/navigation-react-native exports sample profile payloads:
| Export | Typical use |
|---|---|
MEDIUM_DUTY_STRAIGHT_JSON
| Medium-duty straight truck |
HEAVY_DUTY_STRAIGHT_JSON
| Heavy-duty / HGV |
FULL_VAN_JSON
| Van / light commercial |
import {
createTrip,
createWaypoint,
MEDIUM_DUTY_STRAIGHT_JSON,
HEAVY_DUTY_STRAIGHT_JSON,
} from "@trimblemaps/navigation-react-native";
const vanProfile = {
name: "Medium Duty Straight",
json: MEDIUM_DUTY_STRAIGHT_JSON,
};
const hgvProfile = {
name: "Heavy Duty Straight",
json: HEAVY_DUTY_STRAIGHT_JSON,
};
const vanTrip = createTrip(
[origin, destination],
"Van route",
undefined,
vanProfile,
);
const hgvTrip = createTrip(
[origin, destination],
"HGV route",
undefined,
hgvProfile,
);
For production, use routing profile JSON from your Trimble account or generate profiles with the same schema your native apps use. See Customizing the vehicle profile on the CoPilot Native Nav SDK site for field-level concepts.
Changing profile during navigation
Changing profile means a new directions request for the same stops. After the user selects a different profile, build a new Trip and call updateTripAndReroute on NavigationView:
await navigationRef.current?.updateTripAndReroute(hgvTrip);
Start the initial route with startNavigation(vanTrip, options) before calling updateTripAndReroute when the profile changes.
Relation to maps route display
Displaying a static route on a custom map uses @trimblemaps/plugins-react-native (see Routing on the map). That API does not provide turn-by-turn guidance. Use @trimblemaps/navigation-react-native for guided navigation.