GLRouteRequest
Objective-C
@interface GLRouteRequest : NSObject
Swift
class 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;
Swift
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;
Swift
convenience init(json: String)
Parameters
json
Request in JSON format
Return Value
New instance
-
Starts request
Declaration
Objective-C
- (int64_t)startWithCompletion: (nonnull GLRouteRequestCompletionBlock)completion;
Swift
func start(completion: @escaping GLRouteRequestCompletionBlock) -> Int64
Parameters
completion
block that will be called when request is done
-
Cancels request that was started
Declaration
Objective-C
+ (void)cancel:(int64_t)requestID;
Swift
class func cancel(_ requestID: Int64)
Parameters
requestID
ID of request to cancel
-
Adds point
Parameters
point
Point to add
-
A location to exclude or avoid
Declaration
Objective-C
- (void)addExcludeLocation:(GLRoutePoint)point;
Swift
func addExcludeLocation(_ point: GLRoutePoint)
Parameters
point
Point to avoid
-
Roads intersecting this polygon will be avoided during path finding. If you only need to avoid a few specific roads, it’s much more efficient to use exclude locations.
Declaration
Objective-C
- (void)addExcludePolygon:(nonnull GLMapGeoPoint *)points count:(NSUInteger)count;
Swift
func addExcludePolygon(_ points: UnsafeMutablePointer<GLMapGeoPoint>, count: UInt)
Parameters
points
points of polygin exterior ring
count
numer of points
-
This is the local date and time at the location.
Declaration
Objective-C
- (void)setDateTime:(nonnull NSString *)date type:(GLRouteDateTimeType)type;
Swift
func setDateTime(_ date: String, type: GLRouteDateTimeType)
Parameters
date
the date and time is specified in ISO 8601 format (YYYY-MM-DDThh:mm) in the local time zone of departure or arrival. For example “2016-07-03T08:06”
type
type of date and time
-
Name your route request. If id is specified, the naming will be sent thru to the response.
Declaration
Objective-C
- (void)setRequestID:(nonnull NSString *)requestID;
Swift
func setRequestID(_ requestID: String)
Parameters
requestID
request id
-
Makes request offline
Declaration
Objective-C
- (void)setOfflineWithConfig:(nonnull NSString *)config;
Swift
func setOfflineWithConfig(_ config: String)
Parameters
config
Contents of configuration file for routing engine Valhalla. See valhalla.json inside the demoApp.
-
Sets routing mode and uses default options for it.
Declaration
Objective-C
- (void)setModeWithDefaultOptions:(GLRouteMode)mode;
Swift
func setModeWithDefaultOptions(_ mode: GLRouteMode)
Parameters
mode
routing mode
-
Sets navigation mode to auto
Declaration
Objective-C
- (void)setAutoWithOptions:(CostingOptionsAuto)options;
Swift
func setAutoWithOptions(_ options: CostingOptionsAuto)
Parameters
options
options
-
Sets navigation mode to cycle
Declaration
Objective-C
- (void)setBicycleWithOptions:(CostingOptionsBicycle)options;
Swift
func setBicycleWithOptions(_ options: CostingOptionsBicycle)
Parameters
options
options
-
Sets navigation mode to walk
Declaration
Objective-C
- (void)setPedestrianWithOptions:(CostingOptionsPedestrian)options;
Swift
func setPedestrianWithOptions(_ options: CostingOptionsPedestrian)
Parameters
options
options
-
Sets navigation mode to straight
Declaration
Objective-C
- (void)setStraightWithOptions:(CostingOptionsStraight)options;
Swift
func setStraightWithOptions(_ options: CostingOptionsStraight)
Parameters
options
options
-
Sets navigation mode to bus
Declaration
Objective-C
- (void)setBusWithOptions:(CostingOptionsAuto)options;
Swift
func setBusWithOptions(_ options: CostingOptionsAuto)
Parameters
options
options
-
Sets navigation mode to bikeshare
Declaration
Objective-C
- (void)setBikeshareWithOptions:(CostingOptionsBicycle)options;
Swift
func setBikeshareWithOptions(_ options: CostingOptionsBicycle)
Parameters
options
options
-
Sets navigation mode to truck
Declaration
Objective-C
- (void)setTruckWithOptions:(CostingOptionsTruck)options;
Swift
func setTruckWithOptions(_ options: CostingOptionsTruck)
Parameters
options
options
-
Sets navigation mode to taxi
Declaration
Objective-C
- (void)setTaxiWithOptions:(CostingOptionsAuto)options;
Swift
func setTaxiWithOptions(_ options: CostingOptionsAuto)
Parameters
options
options
-
Sets navigation mode to scooter
Declaration
Objective-C
- (void)setMotorScooterWithOptions:(CostingOptionsMotorScooter)options;
Swift
func setMotorScooterWithOptions(_ options: CostingOptionsMotorScooter)
Parameters
options
options
-
Sets navigation mode to motorcycle
Declaration
Objective-C
- (void)setMotorcycleWithOptions:(CostingOptionsMotorcycle)options;
Swift
func setMotorcycleWithOptions(_ options: CostingOptionsMotorcycle)
Parameters
options
options
-
If YES order of middle points can be changed to make route better. By default is NO.
Declaration
Objective-C
@property BOOL optimize;
Swift
var optimize: Bool { get set }
-
Mode of the route. By default GLRouteMode_Auto
-
Unit system for instructions. By default GLUnitSystem_International
Declaration
Objective-C
@property GLUnitSystem unitSystem;
Swift
var unitSystem: GLUnitSystem { get set }
-
Locale for instructions. By default first value from
+[NSLocale preferredLanguages]
Declaration
Objective-C
@property (strong) NSString *_Nonnull locale;
Swift
var locale: String { get set }
-
Request that will be sent
Declaration
Objective-C
@property (readonly) NSString *_Nonnull json;
Swift
var json: String { get }
-
A number denoting how many alternate routes should be provided. There may be no alternates or less alternates than the user specifies. Alternates are not yet supported on multipoint routes (that is, routes with more than 2 locations). They are also not supported on time dependent routes. By default = 2
Declaration
Objective-C
@property NSInteger alternates;
Swift
var alternates: Int { get set }