GLRouteRequest


@interface GLRouteRequest : NSObject

Requests route. When offline config is provided computes route offline on device, otherwise requests from server.

  • Default initializer

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Return Value

    Returns new instance

  • User defined reqest. 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

    - (nonnull instancetype)initWithJSON:(nonnull NSString *)json;

    Parameters

    json

    Request in JSON format

    Return Value

    New instance

  • Starts request

    Declaration

    Objective-C

    - (int64_t)startWithCompletion:
        (nonnull GLRouteRequestCompletionBlock)completion;

    Parameters

    completion

    block that will be called when request is done

  • Cancels request that was started

    Declaration

    Objective-C

    + (void)cancel:(int64_t)requestID;

    Parameters

    requestID

    ID of request to cancel

  • Adds point

    Declaration

    Objective-C

    - (void)addPoint:(GLRoutePoint)point;

    Parameters

    point

    Point to add

  • Makes request offline

    Declaration

    Objective-C

    - (void)setOfflineWithConfig:(nonnull NSString *)config;

    Parameters

    config

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

  • If YES order of middle points can be changed to make route better. By default is NO.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) BOOL optimize;
  • Mode of the route. By default GLRouteMode_Drive

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) GLRouteMode mode;
  • Unit system for instructions. By default GLUnitSystem_International

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) GLUnitSystem unitSystem;
  • Locale for instructions. By default first value from +[NSLocale preferredLanguages]

    Declaration

    Objective-C

    @property (atomic, strong, readwrite) NSString *_Nonnull locale;
  • Request that will be sent

    Declaration

    Objective-C

    @property (atomic, readonly) NSString *_Nonnull json;
  • This value indicates the willingness to take ferries. This is a range of values between 0 and 1. Values near 0 attempt to avoid ferries and values near 1 will favor ferries. Note that sometimes ferries are required to complete a route so values of 0 are not guaranteed to avoid ferries entirely. The default value is 0.5.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float useFerry;
  • This value indicates the willingness to take highways. This is a range of values between 0 and 1. Values near 0 attempt to avoid highways and values near 1 will favor highways. The default value is 1.0. Note that sometimes highways are required to complete a route so values of 0 are not guaranteed to avoid highways entirely.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float useHighways;
  • This value indicates the willingness to take roads with tolls. This is a range of values between 0 and 1. Values near 0 attempt to avoid tolls and values near 1 will not attempt to avoid them. The default value is 0.5. Note that sometimes roads with tolls are required to complete a route so values of 0 are not guaranteed to avoid them entirely.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float useTolls;
  • The type of bicycle. The default type is GLRoute.BikeType.HYBRID. Road: a road-style bicycle with narrow tires that is generally lightweight and designed for speed on paved surfaces. Hybrid or City: a bicycle made mostly for city riding or casual riding on roads and paths with good surfaces. Cross: a cyclo-cross bicycle, which is similar to a road bicycle but with wider tires suitable to rougher surfaces. Mountain: a mountain bicycle suitable for most surfaces but generally heavier and slower on paved surfaces.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite)
        GLRouteBikeType bikeType;
  • A cyclist’s propensity to use roads alongside other vehicles. This is a range of values from 0 to 1, where 0 attempts to avoid roads and stay on cycleways and paths, and 1 indicates the rider is more comfortable riding on roads. Based on the use_roads factor, roads with certain classifications and higher speeds are penalized in an attempt to avoid them when finding the best path. The default value is 0.5.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float useRoads;
  • A cyclist’s desire to tackle hills in their routes. This is a range of values from 0 to 1, where 0 attempts to avoid hills and steep grades even if it means a longer (time and distance) path, while 1 indicates the rider does not fear hills and steeper grades. Based on the use_hills factor, penalties are applied to roads based on elevation change and grade. These penalties help the path avoid hilly roads in favor of flatter roads or less steep grades where available. Note that it is not always possible to find alternate paths to avoid hills (for example when route locations are in mountainous areas). The default value is 0.5.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float useHills;
  • This value is meant to represent how much a cyclist wants to avoid roads with poor surfaces relative to the bicycle type being used. This is a range of values between 0 and 1. When the value is 0, there is no penalization of roads with different surface types; only bicycle speed on each surface is taken into account. As the value approaches 1, roads with poor surfaces for the bike are penalized heavier so that they are only taken if they significantly improve travel time. When the value is equal to 1, all bad surfaces are completely disallowed from routing, including start and end points. The default value is 0.25.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float avoidBadSurfaces;
  • A penalty in seconds added to each transition onto a path with steps or stairs. Higher values apply larger cost penalties to avoid paths that contain flights of steps.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float stepPenalty;
  • A factor that modifies (multiplies) the cost when alleys are encountered. Pedestrian routes generally want to avoid alleys or narrow service roads between buildings. The default value is 2.0.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite) float alleyFactor;
  • This value indicates the maximum difficulty of hiking trails that is allowed. Values between 0 and 6 are allowed. The values correspond to sac_scale values within OpenStreetMap, see reference https://wiki.openstreetmap.org/wiki/Key:sac_scale. The default value is 1 which means that well cleared trails that are mostly flat or slightly sloped are allowed. Higher difficulty trails can be allowed by specifying a higher value for max_hiking_difficulty.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite)
        int8_t maxHikingDifficulty;