GoogleMaps3D Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
Polygon
struct Polygon
extension Polygon : Copyable, Equatable, Escapable, Hashable, Identifiable, MapContent
A 3D polygon that can be placed on a map.
Map(mode: .hybrid) {
Polygon(
outerCoordinates: [
.init(latitude: 37.7749, longitude: -122.4194, altitude: 0),
.init(latitude: 37.7740, longitude: -122.4184, altitude: 0),
.init(latitude: 37.7750, longitude: -122.4174, altitude: 0),
]
)
}
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values a
and b
,
a == b
implies that a != b
is false
.
Declaration
Swift
static func == (a: Polygon, b: Polygon) -> Bool
-
A type representing the stable identity of the entity associated with
an instance.
Declaration
Swift
@available(watchOS, introduced: 6.0)
@available(macOS, introduced: 10.15)
@available(iOS, introduced: 13.0)
@available(tvOS, introduced: 13.0)
typealias ID = String
-
Declaration
Swift
struct StyleOptions
extension Polygon.StyleOptions : Equatable, Hashable
-
Declaration
Swift
func add(coordinator: RenderingCoordinator)
-
Specifies how altitudes in the coordinates are interpreted.
Default value: clampToGround.
-
The draw order compared to other polys.
Default value: 0.
Declaration
Swift
let drawOrder: Int32
-
Hashes the essential components of this value by feeding them into the
given hasher.
Implement this method to conform to the Hashable
protocol. The
components used for hashing must be the same as the components compared
in your type’s ==
operator implementation. Call hasher.combine(_:)
with each of these components.
Important
In your implementation of hash(into:)
,
don’t call finalize()
on the hasher
instance provided,
or replace it with a different instance.
Doing so may become a compile-time error in the future.
Declaration
Swift
func hash(into hasher: inout Hasher)
-
The hash value.
Hash values are not guaranteed to be equal across different executions of
your program. Do not save hash values to use during a future execution.
Important
hashValue
is deprecated as a
Hashable
requirement. To
conform to
Hashable
, implement the
hash(into:)
requirement instead.
The compiler provides an implementation for
hashValue
for you.
Declaration
Swift
var hashValue: Int { get }
-
The id used to store the polygon as KML feature in the KML document.
It’s created and used only internally.
-
-
Inner boundary of the polygon. A Polygon can contain multiple inner coordinates,
which create multiple cut-outs inside the polygon.
-
Outer boundary of the polygon.
-
Declaration
Swift
func remove(coordinator: RenderingCoordinator)
-
-
Style options of the polygon.
-
Declaration
Swift
func update(coordinator: RenderingCoordinator)
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."],[],[],null,["# GoogleMaps3D Framework Reference\n\nPolygon\n=======\n\n struct Polygon\n\n extension Polygon : Copyable, Equatable, Escapable, Hashable, Identifiable, MapContent\n\nA 3D polygon that can be placed on a map. \n\n Map(mode: .hybrid) {\n Polygon(\n outerCoordinates: [\n .init(latitude: 37.7749, longitude: -122.4194, altitude: 0),\n .init(latitude: 37.7740, longitude: -122.4184, altitude: 0),\n .init(latitude: 37.7750, longitude: -122.4174, altitude: 0),\n ]\n )\n }\n\n- `\n ``\n ``\n `\n\n ### [==(_:_:)](#/s:12GoogleMaps3D7PolygonV2eeoiySbAC_ACtFZ)\n\n `\n ` \n Returns a Boolean value indicating whether two values are equal.\n\n Equality is the inverse of inequality. For any values `a` and `b`,\n `a == b` implies that `a != b` is `false`. \n\n #### Declaration\n\n Swift \n\n static func == (a: Polygon, b: Polygon) -\u003e Bool\n\n- `\n ``\n ``\n `\n\n ### [ID](#/s:12GoogleMaps3D7PolygonV2IDa)\n\n `\n ` \n A type representing the stable identity of the entity associated with\n an instance. \n\n #### Declaration\n\n Swift \n\n @available(watchOS, introduced: 6.0)\n @available(macOS, introduced: 10.15)\n @available(iOS, introduced: 13.0)\n @available(tvOS, introduced: 13.0)\n typealias ID = String\n\n- `\n ``\n ``\n `\n\n ### [StyleOptions](../Structs/Polygon/StyleOptions.html)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n struct StyleOptions\n\n extension ../Structs/Polygon.html.StyleOptions : Equatable, Hashable\n\n- `\n ``\n ``\n `\n\n ### [add(coordinator:)](#/s:12GoogleMaps3D7PolygonV3add11coordinatoryAA20RenderingCoordinatorC_tF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n func add(coordinator: RenderingCoordinator)\n\n- `\n ``\n ``\n `\n\n ### [altitudeMode](#/s:12GoogleMaps3D7PolygonV12altitudeModeAA08AltitudeE0Ovp)\n\n `\n ` \n Specifies how altitudes in the coordinates are interpreted.\n Default value: clampToGround. \n\n #### Declaration\n\n Swift \n\n let altitudeMode: ../Enums/AltitudeMode.html\n\n- `\n ``\n ``\n `\n\n ### [drawOrder](#/s:12GoogleMaps3D7PolygonV9drawOrders5Int32Vvp)\n\n `\n ` \n The draw order compared to other polys.\n Default value: 0. \n\n #### Declaration\n\n Swift \n\n let drawOrder: Int32\n\n- `\n ``\n ``\n `\n\n ### [hash(into:)](#/s:12GoogleMaps3D7PolygonV4hash4intoys6HasherVz_tF)\n\n `\n ` \n Hashes the essential components of this value by feeding them into the\n given hasher.\n\n Implement this method to conform to the `Hashable` protocol. The\n components used for hashing must be the same as the components compared\n in your type's `==` operator implementation. Call `hasher.combine(_:)`\n with each of these components. \n Important\n\n In your implementation of `hash(into:)`,\n don't call `finalize()` on the `hasher` instance provided,\n or replace it with a different instance.\n Doing so may become a compile-time error in the future. \n\n #### Declaration\n\n Swift \n\n func hash(into hasher: inout Hasher)\n\n- `\n ``\n ``\n `\n\n ### [hashValue](#/s:12GoogleMaps3D7PolygonV9hashValueSivp)\n\n `\n ` \n The hash value.\n\n Hash values are not guaranteed to be equal across different executions of\n your program. Do not save hash values to use during a future execution. \n Important\n `hashValue` is deprecated as a `Hashable` requirement. To conform to `Hashable`, implement the [hash(into:)](../Structs/Polygon.html#/s:12GoogleMaps3D7PolygonV4hash4intoys6HasherVz_tF) requirement instead. The compiler provides an implementation for `hashValue` for you. \n\n #### Declaration\n\n Swift \n\n var hashValue: Int { get }\n\n- `\n ``\n ``\n `\n\n ### [id](#/s:12GoogleMaps3D7PolygonV2idSSvp)\n\n `\n ` \n The id used to store the polygon as KML feature in the KML document.\n It's created and used only internally. \n\n #### Declaration\n\n Swift \n\n let id: String\n\n- `\n ``\n ``\n `\n\n ### [init(outerCoordinates:innerCoordinates:altitudeMode:drawOrder:)](#/s:12GoogleMaps3D7PolygonV16outerCoordinates05innerE012altitudeMode9drawOrderACSayAA14LatLngAltitudeVG_SayAJGAA0mH0Os5Int32Vtcfc)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n init(outerCoordinates: [../Structs/LatLngAltitude.html], innerCoordinates: [[../Structs/LatLngAltitude.html]] = [], altitudeMode: ../Enums/AltitudeMode.html = .clampToGround, drawOrder: Int32 = 0)\n\n- `\n ``\n ``\n `\n\n ### [innerCoordinates](#/s:12GoogleMaps3D7PolygonV16innerCoordinatesSaySayAA14LatLngAltitudeVGGvp)\n\n `\n ` \n Inner boundary of the polygon. A Polygon can contain multiple inner coordinates,\n which create multiple cut-outs inside the polygon. \n\n #### Declaration\n\n Swift \n\n let innerCoordinates: [[../Structs/LatLngAltitude.html]]\n\n- `\n ``\n ``\n `\n\n ### [outerCoordinates](#/s:12GoogleMaps3D7PolygonV16outerCoordinatesSayAA14LatLngAltitudeVGvp)\n\n `\n ` \n Outer boundary of the polygon. \n\n #### Declaration\n\n Swift \n\n let outerCoordinates: [../Structs/LatLngAltitude.html]\n\n- `\n ``\n ``\n `\n\n ### [remove(coordinator:)](#/s:12GoogleMaps3D7PolygonV6remove11coordinatoryAA20RenderingCoordinatorC_tF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n func remove(coordinator: RenderingCoordinator)\n\n- `\n ``\n ``\n `\n\n ### [style(_:)](#/s:12GoogleMaps3D7PolygonV5styleyA2C12StyleOptionsVF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n func style(_ style: Polygon.../Structs/Polygon/StyleOptions.html) -\u003e Polygon\n\n- `\n ``\n ``\n `\n\n ### [styleOptions](#/s:12GoogleMaps3D7PolygonV12styleOptionsAC05StyleE0Vvp)\n\n `\n ` \n Style options of the polygon. \n\n #### Declaration\n\n Swift \n\n var styleOptions: Polygon.../Structs/Polygon/StyleOptions.html\n\n- `\n ``\n ``\n `\n\n ### [update(coordinator:)](#/s:12GoogleMaps3D7PolygonV6update11coordinatoryAA20RenderingCoordinatorC_tF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n func update(coordinator: RenderingCoordinator)"]]