GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSPolyline
GMSPolyline
specifies the available options for a polyline that exists on the Earth’s surface.
It is drawn as a physical line between the points specified in path
.
-
The path that describes this polyline.
Declaration
Swift
@NSCopying var path: GMSPath? { get set }
Objective-C
@property (nonatomic, copy, nullable) GMSPath *path;
-
The width of the line in screen points. Defaults to 1.
Declaration
Swift
var strokeWidth: CGFloat { get set }
Objective-C
@property (nonatomic) CGFloat strokeWidth;
-
The UIColor
used to render the polyline. Defaults to [UIColor blueColor]
.
Declaration
Swift
var strokeColor: UIColor { get set }
Objective-C
@property (nonatomic) UIColor *_Nonnull strokeColor;
-
Whether this line should be rendered with geodesic correction.
Declaration
Swift
var geodesic: Bool { get set }
Objective-C
@property (nonatomic) BOOL geodesic;
-
Convenience constructor for GMSPolyline
for a particular path. Other properties will have
default values.
Declaration
Swift
convenience init(path: GMSPath?)
Objective-C
+ (nonnull instancetype)polylineWithPath:(nullable GMSPath *)path;
-
An array containing GMSStyleSpan
, the spans used to render this polyline.
If this array contains fewer segments than the polyline itself, the final segment will be applied
over the remaining length. If this array is unset or empty, then strokeColor
is used for the
entire line instead.
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSArray<GMSStyleSpan *> *spans;
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\u003eGMSPolyline\u003c/code\u003e is an object used to represent a line on a map, connecting multiple points defined by a \u003ccode\u003eGMSPath\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers customizable attributes including line width (\u003ccode\u003estrokeWidth\u003c/code\u003e), color (\u003ccode\u003estrokeColor\u003c/code\u003e), and whether it follows the Earth's curvature (\u003ccode\u003egeodesic\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSPolyline\u003c/code\u003e can also have styled segments with varying colors or patterns, determined by its \u003ccode\u003espans\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eTo create a polyline, use the designated constructor \u003ccode\u003epolylineWithPath:\u003c/code\u003e providing the desired path for the line.\u003c/p\u003e\n"]]],[],null,["# GoogleNavigation Framework Reference\n\nGMSPolyline\n===========\n\n @interface GMSPolyline : ../Classes/GMSOverlay.html\n\n`GMSPolyline` specifies the available options for a polyline that exists on the Earth's surface.\nIt is drawn as a physical line between the points specified in `path`.\n- `\n ``\n ``\n `\n\n ### [path](#/c:objc(cs)GMSPolyline(py)path)\n\n `\n ` \n The path that describes this polyline. \n\n #### Declaration\n\n Swift \n\n @NSCopying var path: ../Classes/GMSPath.html? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) ../Classes/GMSPath.html *path;\n\n- `\n ``\n ``\n `\n\n ### [strokeWidth](#/c:objc(cs)GMSPolyline(py)strokeWidth)\n\n `\n ` \n The width of the line in screen points. Defaults to 1. \n\n #### Declaration\n\n Swift \n\n var strokeWidth: CGFloat { get set }\n\n Objective-C \n\n @property (nonatomic) CGFloat strokeWidth;\n\n- `\n ``\n ``\n `\n\n ### [strokeColor](#/c:objc(cs)GMSPolyline(py)strokeColor)\n\n `\n ` \n The `UIColor` used to render the polyline. Defaults to `[UIColor blueColor]`. \n\n #### Declaration\n\n Swift \n\n var strokeColor: UIColor { get set }\n\n Objective-C \n\n @property (nonatomic) UIColor *_Nonnull strokeColor;\n\n- `\n ``\n ``\n `\n\n ### [geodesic](#/c:objc(cs)GMSPolyline(py)geodesic)\n\n `\n ` \n Whether this line should be rendered with geodesic correction. \n\n #### Declaration\n\n Swift \n\n var geodesic: Bool { get set }\n\n Objective-C \n\n @property (nonatomic) BOOL geodesic;\n\n- `\n ``\n ``\n `\n\n ### [+polylineWithPath:](#/c:objc(cs)GMSPolyline(cm)polylineWithPath:)\n\n `\n ` \n Convenience constructor for `GMSPolyline` for a particular path. Other properties will have\n default values. \n\n #### Declaration\n\n Swift \n\n convenience init(path: ../Classes/GMSPath.html?)\n\n Objective-C \n\n + (nonnull instancetype)polylineWithPath:(nullable ../Classes/GMSPath.html *)path;\n\n- `\n ``\n ``\n `\n\n ### [spans](#/c:objc(cs)GMSPolyline(py)spans)\n\n `\n ` \n An array containing [GMSStyleSpan](../Classes/GMSStyleSpan.html), the spans used to render this polyline.\n\n If this array contains fewer segments than the polyline itself, the final segment will be applied\n over the remaining length. If this array is unset or empty, then [strokeColor](../Classes/GMSPolyline.html#/c:objc(cs)GMSPolyline(py)strokeColor) is used for the\n entire line instead. \n\n #### Declaration\n\n Swift \n\n var spans: [../Classes/GMSStyleSpan.html]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSArray\u003c../Classes/GMSStyleSpan.html *\u003e *spans;"]]