Skip to main content
RadarRoute represents a route between an origin and a destination, including distance, duration, and geometry information.

Properties

distance
RadarRouteDistance
required
The distance of the route.
duration
RadarRouteDuration
required
The duration of the route.
geometry
RadarRouteGeometry
required
The geometry of the route.

Instance Methods

dictionaryValue

func dictionaryValue() -> [String: Any]
- (NSDictionary *_Nonnull)dictionaryValue;
Converts the route to a dictionary representation.

Returns

A dictionary representation of the route.

Example

// Get routing information
Radar.getDistance(
    origin: origin,
    destination: destination,
    modes: [.car],
    units: .imperial
) { (status, routes) in
    if let route = routes?.car {
        print("Distance: \(route.distance.text)")
        print("Duration: \(route.duration.text)")
        
        if let coordinates = route.geometry.coordinates {
            print("Route has \(coordinates.count) points")
        }
    }
}
// Get routing information
[Radar getDistanceFromOrigin:origin
                 destination:destination
                       modes:RadarRouteModeCar
                       units:RadarRouteUnitsImperial
           completionHandler:^(RadarStatus status, RadarRoutes * _Nullable routes) {
    RadarRoute *route = routes.car;
    if (route) {
        NSLog(@"Distance: %@", route.distance.text);
        NSLog(@"Duration: %@", route.duration.text);
        
        if (route.geometry.coordinates) {
            NSLog(@"Route has %lu points", (unsigned long)route.geometry.coordinates.count);
        }
    }
}];

See Also

Build docs developers (and LLMs) love