GLRoute


@interface GLRoute : NSObject

Class to load route data

  • Cancels request that was started

    Declaration

    Objective-C

    + (void)cancelRequest:(int64_t)requestID;

    Parameters

    requestID

    ID of request to cancel

  • Requests route data for given points

    Declaration

    Objective-C

    + (int64_t)requestRouteWithPoints:(const GLRoutePoint *_Nonnull)points
                                count:(NSInteger)count
                                 mode:(GLMapRouteMode)mode
                               locale:(NSString *_Nonnull)locale
                                units:(GLUnitSystem)units
                      completionBlock:
                          (GLRouteCompletionBlock _Nullable)completionBlock;

    Parameters

    points

    points of the route

    count

    number of points

    mode

    mode of the route

    completionBlock

    block to be called when results are ready

    Return Value

    requestID that can be used to cancel request

  • Requests route data. You should pass correct request in JSON format. See reference at: https://github.com/valhalla/valhalla-docs/blob/master/turn-by-turn/api-reference.md E.g. json = @{locations:[{lat:42.358528,lon:-83.271400,street:Appleton},{lat:42.996613,lon:-78.749855,street:Ranch Trail}],costing:auto,costing_options:{auto:{country_crossing_penalty:2000.0}},directions_options:{units:miles},id:my_work_route}

    Declaration

    Objective-C

    + (int64_t)requestRouteWithJSON:(NSString *_Nonnull)json
                    completionBlock:
                        (GLRouteCompletionBlock _Nullable)completionBlock;

    Parameters

    json

    request in JSON format,

    completionBlock

    block to be called when results are ready

    Return Value

    requestID that can be used to cancel request

  • Requests offline route data for given points

    Declaration

    Objective-C

    + (int64_t)offlineRequestRouteWithConfig:(NSString *_Nonnull)config
                                      points:(const GLRoutePoint *_Nonnull)points
                                       count:(NSInteger)count
                                        mode:(GLMapRouteMode)mode
                                      locale:(NSString *_Nonnull)locale
                                       units:(GLUnitSystem)units
                             completionBlock:
                                 (GLRouteCompletionBlock _Nullable)completionBlock;

    Parameters

    config

    Contents of configuration file for routing engine Valhalla. See valhalla.json inside the demoApp.

    points

    points of the route

    count

    number of points

    mode

    mode of the route

    completionBlock

    block to be called when results are ready

    Return Value

    requestID that can be used to cancel request

  • Requests offline route data. You should pass correct request in JSON format. See reference at: https://github.com/valhalla/valhalla-docs/blob/master/turn-by-turn/api-reference.md E.g. json = @{locations:[{lat:42.358528,lon:-83.271400,street:Appleton},{lat:42.996613,lon:-78.749855,street:Ranch Trail}],costing:auto,costing_options:{auto:{country_crossing_penalty:2000.0}},directions_options:{units:miles},id:my_work_route}

    Declaration

    Objective-C

    + (int64_t)offlineRequestRouteWithConfig:(NSString *_Nonnull)config
                                        JSON:(NSString *_Nonnull)json
                             completionBlock:
                                 (GLRouteCompletionBlock _Nullable)completionBlock;

    Parameters

    config

    Contents of configuration file for routing engine Valhalla. See valhalla.json inside the demoApp.

    json

    request in JSON format,

    completionBlock

    block to be called when results are ready

    Return Value

    requestID that can be used to cancel request

  • Finds index where given point must be inserted to array of reference points. It’s used, for example, to add waypoint to route.

    Declaration

    Objective-C

    + (NSUInteger)findInsertionIndex:(GLMapPoint *_Nonnull)point
                              points:(const GLMapPoint *_Nonnull)points
                         pointsCount:(NSInteger)pointsCount;

    Parameters

    point

    At input defines point to insert. At output contains point that is located on route.

    points

    Array of reference GLMapPoints

    pointsCount

    Number of points in array

    Return Value

    NSNotFound if given point is too far from track.

  • Initializes route with custom maneuvers;

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithManeuvers:
                                  (NSArray<GLRouteManeuver *> *_Nonnull)maneuvers
                                       language:(NSString *_Nullable)language;

    Parameters

    maneuvers

    Custom maneuvers of route

  • Returns track data that can be used to display track of route

    Declaration

    Objective-C

    - (GLMapTrackData *_Nullable)trackDataWithColor:(GLMapColor)trackColor;

    Parameters

    trackColor

    color of route track

    Return Value

    track data of route

  • Returns track data that can be used to display track of route

    Declaration

    Objective-C

    - (GLMapTrackData *_Nullable)trackDataWithCallback:
        (GLMapTrackDataColorBlock _Nonnull)colorBlock;

    Parameters

    colorBlock

    block to generate gradient

    Return Value

    track data of route

  • Total length of track

    Declaration

    Objective-C

    @property (readonly, atomic) double length;
  • Estimated duration of the track

    Declaration

    Objective-C

    @property (readonly, atomic) double duration;
  • Finds maneuver that go after given manuver

    Declaration

    Objective-C

    - (GLRouteManeuver *_Nullable)getNextManeuver:
        (GLRouteManeuver *_Nonnull)maneuver;

    Parameters

    maneuver

    refrence maneuver

    Return Value

    next maneuver of the route

  • Finds maneuver that go before given manuver

    Declaration

    Objective-C

    - (GLRouteManeuver *_Nullable)getPreviousManeuver:
        (GLRouteManeuver *_Nonnull)maneuver;

    Parameters

    maneuver

    refrence maneuver

    Return Value

    previous maneuver of the route

  • Finds nearest point on route

    Declaration

    Objective-C

    - (void)findNearestPoint:(GLMapPoint *_Nonnull)point
                      height:(CGFloat *_Nullable)height;

    Parameters

    point

    on input contains refrence point. on output contains nearest point

    height

    height in result point or NAN if heightData is nil

  • All maneuvers of the route

    Declaration

    Objective-C

    @property (readonly, atomic) NSArray<GLRouteManeuver *> *_Nullable allManeuvers;
  • Unparsed server response

    Declaration

    Objective-C

    @property (readonly, atomic) NSString *_Nullable serverResponse;
  • Language of instructions in maneuvers

    Declaration

    Objective-C

    @property (readonly, atomic) NSString *_Nullable language;
  • Height data

    Declaration

    Objective-C

    @property (readonly, atomic) GLRouteElevation *_Nullable heightData;