GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSPolygon
GMSPolygon
defines a polygon that appears on the map. A polygon (like a polyline) defines a
series of connected coordinates in an ordered sequence; additionally, polygons form a closed loop
and define a filled region.
-
The path that describes this polygon. The coordinates composing the path must be valid.
Declaration
Swift
@NSCopying var path: GMSPath? { get set }
Objective-C
@property (nonatomic, copy, nullable) GMSPath *path;
-
The array of GMSPath
instances that describes any holes in this polygon. The coordinates
composing each path must be valid.
Declaration
Swift
var holes: [GMSPath]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSArray<GMSPath *> *holes;
-
The width of the polygon outline in screen points. Defaults to 1.
Declaration
Swift
var strokeWidth: CGFloat { get set }
Objective-C
@property (nonatomic) CGFloat strokeWidth;
-
The color of the polygon outline. Defaults to nil.
Declaration
Swift
var strokeColor: UIColor? { get set }
Objective-C
@property (nonatomic, nullable) UIColor *strokeColor;
-
The fill color. Defaults to blueColor.
Declaration
Swift
var fillColor: UIColor? { get set }
Objective-C
@property (nonatomic, nullable) UIColor *fillColor;
-
Whether this polygon should be rendered with geodesic correction.
Declaration
Swift
var geodesic: Bool { get set }
Objective-C
@property (nonatomic) BOOL geodesic;
-
Provides the Core Animation layer for this GMSPolygon
.
Declaration
Objective-C
@property (nonatomic, readonly) GMSPolygonLayer *_Nonnull layer;
-
Convenience constructor for GMSPolygon
for a particular path. Other properties will have
default values.
Declaration
Swift
convenience init(path: GMSPath?)
Objective-C
+ (nonnull instancetype)polygonWithPath:(nullable GMSPath *)path;
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\u003eGMSPolygon\u003c/code\u003e is an object used to represent a closed polygon on a map, including a filled region and an optional outline.\u003c/p\u003e\n"],["\u003cp\u003eIt is defined by a path (\u003ccode\u003eGMSPath\u003c/code\u003e) and can have optional holes represented by an array of \u003ccode\u003eGMSPath\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eThe polygon's appearance can be customized with properties like \u003ccode\u003estrokeWidth\u003c/code\u003e, \u003ccode\u003estrokeColor\u003c/code\u003e, and \u003ccode\u003efillColor\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSPolygon\u003c/code\u003e can be rendered with geodesic correction and offers access to its Core Animation layer.\u003c/p\u003e\n"],["\u003cp\u003eA convenience constructor is provided for creating polygons with a specified path.\u003c/p\u003e\n"]]],["`GMSPolygon` defines a closed, filled region on a map using connected coordinates. Key properties include: `path` (defining the polygon's outline), `holes` (inner cutouts), `strokeWidth` (outline thickness), `strokeColor` (outline color), `fillColor` (region color), and `geodesic` (geodesic correction). The polygon has an associated `layer` for Core Animation. A `polygonWithPath` constructor initializes the object with a specific path.\n"],null,["# GoogleNavigation Framework Reference\n\nGMSPolygon\n==========\n\n @interface GMSPolygon : ../Classes/GMSOverlay.html\n\n`GMSPolygon` defines a polygon that appears on the map. A polygon (like a polyline) defines a\nseries of connected coordinates in an ordered sequence; additionally, polygons form a closed loop\nand define a filled region.\n- `\n ``\n ``\n `\n\n ### [path](#/c:objc(cs)GMSPolygon(py)path)\n\n `\n ` \n The path that describes this polygon. The coordinates composing the path must be valid. \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 ### [holes](#/c:objc(cs)GMSPolygon(py)holes)\n\n `\n ` \n The array of [GMSPath](../Classes/GMSPath.html) instances that describes any holes in this polygon. The coordinates\n composing each path must be valid. \n\n #### Declaration\n\n Swift \n\n var holes: [../Classes/GMSPath.html]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSArray\u003c../Classes/GMSPath.html *\u003e *holes;\n\n- `\n ``\n ``\n `\n\n ### [strokeWidth](#/c:objc(cs)GMSPolygon(py)strokeWidth)\n\n `\n ` \n The width of the polygon outline 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)GMSPolygon(py)strokeColor)\n\n `\n ` \n The color of the polygon outline. Defaults to nil. \n\n #### Declaration\n\n Swift \n\n var strokeColor: UIColor? { get set }\n\n Objective-C \n\n @property (nonatomic, nullable) UIColor *strokeColor;\n\n- `\n ``\n ``\n `\n\n ### [fillColor](#/c:objc(cs)GMSPolygon(py)fillColor)\n\n `\n ` \n The fill color. Defaults to blueColor. \n\n #### Declaration\n\n Swift \n\n var fillColor: UIColor? { get set }\n\n Objective-C \n\n @property (nonatomic, nullable) UIColor *fillColor;\n\n- `\n ``\n ``\n `\n\n ### [geodesic](#/c:objc(cs)GMSPolygon(py)geodesic)\n\n `\n ` \n Whether this polygon 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 ### [layer](#/c:objc(cs)GMSPolygon(py)layer)\n\n `\n ` \n Provides the Core Animation layer for this `GMSPolygon`. \n\n #### Declaration\n\n Swift \n\n var layer: ../Classes/GMSPolygonLayer.html { get }\n\n Objective-C \n\n @property (nonatomic, readonly) ../Classes/GMSPolygonLayer.html *_Nonnull layer;\n\n- `\n ``\n ``\n `\n\n ### [+polygonWithPath:](#/c:objc(cs)GMSPolygon(cm)polygonWithPath:)\n\n `\n ` \n Convenience constructor for `GMSPolygon` 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)polygonWithPath:(nullable ../Classes/GMSPath.html *)path;"]]