You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps SDK for iOS

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps SDK for iOS
  3. Create appropriate keys
Continue

GMSPolygon Class Reference

GMSPolygon Class Reference

Overview

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.

Inherits GMSOverlay.

Static Public Member Functions

(instancetype) + polygonWithPath:
 Convenience constructor for GMSPolygon for a particular path.

Properties

GMSPathpath
 The path that describes this polygon.
NSArray< GMSPath * > * holes
 The array of GMSPath instances that describes any holes in this polygon.
CGFloat strokeWidth
 The width of the polygon outline in screen points.
UIColor * strokeColor
 The color of the polygon outline.
UIColor * fillColor
 The fill color.
BOOL geodesic
 Whether this polygon should be rendered with geodesic correction.
NSString * title
 Title, a short description of the overlay.
GMSMapViewmap
 The map this overlay is on.
BOOL tappable
 If this overlay should cause tap notifications.
int zIndex
 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays.
id userData
 Overlay data.

Member Function Documentation

+ (instancetype) polygonWithPath: (nullable GMSPath *)  path

Convenience constructor for GMSPolygon for a particular path.

Other properties will have default values.


Property Documentation

- (GMSPath*) path [read, write, copy]

The path that describes this polygon.

The coordinates composing the path must be valid.

- (NSArray<GMSPath *>*) holes [read, write, copy]

The array of GMSPath instances that describes any holes in this polygon.

The coordinates composing each path must be valid.

- (CGFloat) strokeWidth [read, write, assign]

The width of the polygon outline in screen points.

Defaults to 1.

- (UIColor*) strokeColor [read, write, assign]

The color of the polygon outline.

Defaults to nil.

- (UIColor*) fillColor [read, write, assign]

The fill color.

Defaults to blueColor.

- (BOOL) geodesic [read, write, assign]

Whether this polygon should be rendered with geodesic correction.

- (NSString*) title [read, write, copy, inherited]

Title, a short description of the overlay.

Some overlays, such as markers, will display the title on the map. The title is also the default accessibility text.

- (GMSMapView*) map [read, write, assign, inherited]

The map this overlay is on.

Setting this property will add the overlay to the map. Setting it to nil removes this overlay from the map. An overlay may be active on at most one map at any given time.

- (BOOL) tappable [read, write, assign, inherited]

If this overlay should cause tap notifications.

Some overlays, such as markers, will default to being tappable.

- (int) zIndex [read, write, assign, inherited]

Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays.

Equal values result in undefined draw ordering. Markers are an exception that regardless of zIndex, they will always be drawn above tile layers and other non-marker overlays; they are effectively considered to be in a separate z-index group compared to other overlays.

- (id) userData [read, write, assign, inherited]

Overlay data.

You can use this property to associate an arbitrary object with this overlay. Google Maps SDK for iOS neither reads nor writes this property.

Note that userData should not hold any strong references to any Maps objects, otherwise a retain cycle may be created (preventing objects from being released).

Send feedback about...

Google Maps SDK for iOS
Google Maps SDK for iOS
Need help? Visit our support page.