Routing and Distance
Location: src/screens/RouteScreen.tsx
Utilizes SSMap.findRoute() to calculate paths, calculate distances and estimated travel times,
and draw routes between multiple waypoints.
Find a route
const points = waypoints.map(wp => [wp[0], wp[1]] as [number, number]);
// Standard route calculation
const routeResult = await SSMap.findRoute(points, VehicleType.Car);
const route = routeResult.routes[0];
// Extract distance (in meters) and duration (in seconds)
const distanceInMeters = route.distance;
const durationInSeconds = route.duration;
const distanceKm = (distanceInMeters / 1000).toFixed(2); // e.g. "14.25 km"
const durationMin = Math.round(durationInSeconds / 60); // e.g. 28 min
// Decode geometry string into coordinates array for Map rendering
const decodedCoords = SSMap.coordsDecode(route.geometry);
See also: React Native Map SDK overview, Optimize Route, Draw Shapes.