Skip to main content
RadarRouteGeometry represents the geometry of a route as an array of coordinates that define the path.

Properties

coordinates
RadarCoordinate[]
The geometry of the route as an array of RadarCoordinate objects. Each coordinate represents a point along the route path.

Instance Methods

dictionaryValue

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

Returns

A dictionary representation of the route geometry.

Example

// Get routing information with geometry
Radar.getDistance(
    origin: origin,
    destination: destination,
    modes: [.car],
    units: .imperial
) { (status, routes) in
    if let geometry = routes?.car?.geometry {
        if let coordinates = geometry.coordinates {
            print("Route has \(coordinates.count) points")
            
            // Access individual coordinates
            for coordinate in coordinates {
                let coord = coordinate.coordinate
                print("Point: \(coord.latitude), \(coord.longitude)")
            }
        }
    }
}
// Get routing information with geometry
[Radar getDistanceFromOrigin:origin
                  destination:destination
                        modes:RadarRouteModeCar
                        units:RadarRouteUnitsImperial
            completionHandler:^(RadarStatus status, RadarRoutes * _Nullable routes) {
    RadarRouteGeometry *geometry = routes.car.geometry;
    if (geometry && geometry.coordinates) {
        NSLog(@"Route has %lu points", (unsigned long)geometry.coordinates.count);
        
        // Access individual coordinates
        for (RadarCoordinate *coordinate in geometry.coordinates) {
            CLLocationCoordinate2D coord = coordinate.coordinate;
            NSLog(@"Point: %f, %f", coord.latitude, coord.longitude);
        }
    }
}];

See Also

Build docs developers (and LLMs) love