配置标记的海拔高度
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以自定义添加到 3D 地图中的标记的海拔高度。
以下代码示例演示了如何使用 Marker
结构体配置标记的高度和高度模式,以拉伸标记并设置其高度。
Swift
@State var extrudedMarker: Marker = .init(
position: .init(
latitude: 37.78980534,
longitude: -122.3969349,
altitude: 50.0),
altitudeMode: .relativeToGround,
collisionBehavior: .required,
extruded: true,
drawsWhenOccluded: true,
sizePreserved: true,
zIndex: 0,
label: "Extruded marker"
)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["# Configure marker altitude\n\nSelect platform: [Android](/maps/documentation/maps-3d/android-sdk/configure-marker-altitude \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/configure-marker-altitude \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\nYou can customize the altitude of markers that you add to a 3D map.\n\n\nThe following code sample demonstrates how use the [`Marker` struct](/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker) configure the altitude and altitude mode of a marker to extrude it and set its altitude. \n\n### Swift\n\n```swift\n@State var extrudedMarker: Marker = .init(\n position: .init(\n latitude: 37.78980534,\n longitude: -122.3969349,\n altitude: 50.0),\n altitudeMode: .relativeToGround,\n collisionBehavior: .required,\n extruded: true,\n drawsWhenOccluded: true,\n sizePreserved: true,\n zIndex: 0,\n label: \"Extruded marker\"\n)\n\n \n```"]]