GoogleRidesharingConsumer Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMTSTrafficData
An object that holds the traffic data for a stretch of road.
-
The array of LatLngs that make the polyline representing the path for a stretch of data. Note
that this path may vary subtly from the path for the route. For example, there might be
additional points needed where speed types change.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<GMTSLatLng *> *_Nonnull routePath;
-
The array of GMTSSpeedReadingSpans
objects for a segment of the polyline path.
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<GMTSSpeedReadingSpan *> *_Nonnull speedReadingSpans;
-
Initializes the object by passing the traffic data attributes.
Declaration
Objective-C
- (nonnull instancetype)
initWithRoutePath:(nonnull NSArray<GMTSLatLng *> *)routePath
speedReadingSpans:
(nonnull NSArray<GMTSSpeedReadingSpan *> *)speedReadingSpans;
Parameters
routePath
|
The list of LatLngs that make up the route.
|
speedReadingSpans
|
The array of GMTSSpeedReadingSpans objects for the route.
|
-
Use -initWithRoutePath:speedReadingSpans
instead.
Declaration
Objective-C
- (nonnull instancetype)init;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMTSTrafficData\u003c/code\u003e is an object that contains traffic data for a road segment.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eroutePath\u003c/code\u003e property provides an array of LatLngs representing the polyline path of the traffic data, which may slightly differ from the actual route path.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003espeedReadingSpans\u003c/code\u003e property provides an array of \u003ccode\u003eGMTSSpeedReadingSpan\u003c/code\u003e objects that describe speed information for the polyline path.\u003c/p\u003e\n"],["\u003cp\u003eThe designated initializer is \u003ccode\u003e-initWithRoutePath:speedReadingSpans:\u003c/code\u003e, which takes an array of LatLngs and an array of speed reading spans to initialize the traffic data object.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e-init\u003c/code\u003e method is unavailable, and you should use the \u003ccode\u003e-initWithRoutePath:speedReadingSpans\u003c/code\u003e method instead.\u003c/p\u003e\n"]]],["`GMTSTrafficData` holds traffic information for a road segment. It contains `routePath`, an array of `LatLngs` defining the polyline path, which may vary slightly from the main route. `speedReadingSpans`, an array of `GMTSSpeedReadingSpans` objects, represents speed data along the path. Initialization requires both `routePath` and `speedReadingSpans`. `Init` method is unavailable, use `-initWithRoutePath:speedReadingSpans` instead.\n"],null,["# GoogleRidesharingConsumer Framework Reference\n\nGMTSTrafficData\n===============\n\n @interface GMTSTrafficData : ../Classes/GMTCImmutableData.html\n\nAn object that holds the traffic data for a stretch of road.\n- `\n ``\n ``\n `\n\n ### [routePath](#/c:objc(cs)GMTSTrafficData(py)routePath)\n\n `\n ` \n The array of LatLngs that make the polyline representing the path for a stretch of data. Note\n that this path may vary subtly from the path for the route. For example, there might be\n additional points needed where speed types change. \n\n #### Declaration\n\n Swift \n\n var routePath: [../Classes/GMTSLatLng.html] { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSArray\u003c../Classes/GMTSLatLng.html *\u003e *_Nonnull routePath;\n\n- `\n ``\n ``\n `\n\n ### [speedReadingSpans](#/c:objc(cs)GMTSTrafficData(py)speedReadingSpans)\n\n `\n ` \n The array of `GMTSSpeedReadingSpans` objects for a segment of the polyline path. \n\n #### Declaration\n\n Swift \n\n var speedReadingSpans: [../Classes/GMTSSpeedReadingSpan.html] { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSArray\u003c../Classes/GMTSSpeedReadingSpan.html *\u003e *_Nonnull speedReadingSpans;\n\n- `\n ``\n ``\n `\n\n ### [-initWithRoutePath:speedReadingSpans:](#/c:objc(cs)GMTSTrafficData(im)initWithRoutePath:speedReadingSpans:)\n\n `\n ` \n Initializes the object by passing the traffic data attributes. \n\n #### Declaration\n\n Swift \n\n init(routePath: [../Classes/GMTSLatLng.html], speedReadingSpans: [../Classes/GMTSSpeedReadingSpan.html])\n\n Objective-C \n\n - (nonnull instancetype)\n initWithRoutePath:(nonnull NSArray\u003c../Classes/GMTSLatLng.html *\u003e *)routePath\n speedReadingSpans:\n (nonnull NSArray\u003c../Classes/GMTSSpeedReadingSpan.html *\u003e *)speedReadingSpans;\n\n #### Parameters\n\n |---------------------------|-------------------------------------------------------------|\n | ` `*routePath*` ` | The list of LatLngs that make up the route. |\n | ` `*speedReadingSpans*` ` | The array of `GMTSSpeedReadingSpans` objects for the route. |\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)GMTSTrafficData(im)init)\n\n `\n ` \n Unavailable \n Use `-initWithRoutePath:speedReadingSpans` instead. \n\n #### Declaration\n\n Objective-C \n\n - (nonnull instancetype)init;"]]