获取设备相机的地理空间转换
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将应用的设置配置为使用 Geospatial API 后,您就可以获取设备相机的 GAREarth.cameraGeospatialTransform
。此转换在 GAREarth
对象中进行管理,包含以下信息:
- 位置(以纬度和经度表示)
- 海拔高度
- 大致相当于用户在 EUS 坐标系中朝向的方向,其中 X+ 指向东方,Y+ 指向上方,Z+ 指向南方
调整姿势以提高准确性
当设备处于默认屏幕方向的竖屏状态时,由于与 AR 跟踪自然对齐,俯仰角 (X+) 和滚动角 (Z+) 通常是精确的。不过,偏航角 (Y+) 可能会因 VPS 数据可用性和相应位置的时间条件而异。您的应用可能需要进行调整以提高准确性。
GARGeospatialTransform.orientationYawAccuracy
提供 GARGeospatialTransform.eastUpSouthQTarget
的不确定性半径,以度为单位。此值表示局部偏航角 (Y+) 估算值的标准差。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eAccess the device camera's geospatial transform to get the user's location, altitude, and orientation in the real world.\u003c/p\u003e\n"],["\u003cp\u003eAdjust the yaw angle for accuracy as it can vary due to VPS data availability and local conditions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGARGeospatialTransform.orientationYawAccuracy\u003c/code\u003e property provides the uncertainty radius for the yaw angle estimate.\u003c/p\u003e\n"],["\u003cp\u003eUse the geospatial data to place anchors and interact with the real-world environment through your AR app.\u003c/p\u003e\n"]]],["After configuring the Geospatial API, the `GAREarth.cameraGeospatialTransform` provides location (latitude/longitude), altitude, and device orientation. Orientation uses the EUS coordinate system (X+ east, Y+ up, Z+ south). While pitch and roll are generally accurate, yaw can vary. `GARGeospatialTransform.orientationYawAccuracy` indicates yaw uncertainty. To proceed, use the data to place a Geospatial anchor, by obtaining the anchor's pose.\n"],null,["# Obtain the device camera's Geospatial transform\n\nOnce you have configured your app's settings to use the Geospatial API, you can obtain the device camera's [`GAREarth.cameraGeospatialTransform`](/ar/reference/ios/interface/GAREarth#camerageospatialtransform). This transform, managed in a [`GAREarth`](/ar/reference/ios/interface_g_a_r_earth) object, contains the following information:\n\n- Location, expressed in latitude and longitude\n- Altitude\n- An orientation approximating the direction the user is facing in the EUS coordinate system with X+ pointing east, Y+ pointing up, and Z+ pointing south\n\nAdjust the pose for accuracy\n----------------------------\n\nWhen the device is upright in the default orientation, the pitch (X+) and roll (Z+) angles tend to be precise due to a natural alignment with AR tracking. However, the yaw (Y+) angles can vary depending on VPS data availability and temporal conditions at the location. Your app may have to make adjustments for accuracy.\n\n[`GARGeospatialTransform.orientationYawAccuracy`](/ar/reference/ios/interface/GARGeospatialTransform#orientationyawaccuracy) provides the radius of uncertainty for [`GARGeospatialTransform.eastUpSouthQTarget`](/ar/reference/ios/interface_g_a_r_geospatial_transform#abd5921fc07dca0e1e2c9ce3c1c2e637b), measured in degrees. This value indicates the standard deviation of the estimate for the local-level yaw (Y+) angle.\n\nWhat's next\n-----------\n\n- Place a [Geospatial anchor](/ar/develop/ios/geospatial/anchors#wgs84_anchors) by obtaining the anchor's Geospatial pose."]]