Add a polygon to a map
Stay organized with collections
Save and categorize content based on your preferences.
Select platform:
Android
iOS
You can add a polygon to a 3D map.
The following code sample demonstrates how use the Polygon
struct to add a 3D polygon and position it in 3D space.
Swift
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),
]
)
}
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-09-12 UTC.
[null,null,["Last updated 2025-09-12 UTC."],[],[],null,[]]