# AREarthManager

Provides localization in Earth-relative coordinates.

`https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARCoreExtensionsConfig#geospatialmode` must be `GeospatialMode.Enabled` in order to make use of the Geospatial API. Not all devices support `GeospatialMode.Enabled`, use `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#isgeospatialmodesupported` to find whether the current device supports enabling this mode.

`https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#camerageospatialpose` should only be used when `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` is `TrackingState.Tracking`, and otherwise should not be used. If the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` does not become `Tracking`, then `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthstate` may contain more information on this failure.

## Summary

### Inheritance

Inherits from: [`UnityEngine::MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html)

| ### Properties ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#camerageospatialpose` | `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` Gets the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` for the camera in the latest frame, describing the geodedic position of the device. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthstate` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#earthstate` Gets the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthstate` for the latest frame. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` | `https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.TrackingState.html` Gets the tracking state of Earth for the latest frame. |

| ### Public static functions ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailability(double latitude, double longitude)` | `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/VpsAvailabilityPromise#classGoogle_1_1XR_1_1ARCoreExtensions_1_1VpsAvailabilityPromise` **[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** Please use `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailabilityasync` instead. Gets the availability of the Visual Positioning [System](https://docs.microsoft.com/en-us/dotnet/api/System) (VPS) at a specified horizontal position. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailabilityasync(double latitude, double longitude)` | `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/VpsAvailabilityPromise#classGoogle_1_1XR_1_1ARCoreExtensions_1_1VpsAvailabilityPromise` Gets the availability of the Visual Positioning [System](https://docs.microsoft.com/en-us/dotnet/api/System) (VPS) at a specified horizontal position. |

| ### Public functions ||
|---|---|
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#convert(https://docs.unity3d.com/ScriptReference/Pose.html pose)` | `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` Gets the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` from a local pose relative to camera, relative to the last frame. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#convert(https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose geospatialPose)` | `https://docs.unity3d.com/ScriptReference/Pose.html` Gets the local pose relative to camera from the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose`. |
| `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#isgeospatialmodesupported(https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#geospatialmode mode)` | `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#featuresupported` Checks whether the provided `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#geospatialmode` is supported on this device. |

## Properties

### CameraGeospatialPose

```c#
GeospatialPose CameraGeospatialPose
```
Gets the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` for the camera in the latest frame, describing the geodedic position of the device.

The position of the pose is located at the device's camera, while the orientation closely approximates the orientation of the display.

Note: This pose is only valid when `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` is `TrackingState.Tracking`; otherwise, it should not be used.

### EarthState

```c#
EarthState EarthState
```
Gets the `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthstate` for the latest frame.

### EarthTrackingState

```c#
TrackingState EarthTrackingState
```
Gets the tracking state of Earth for the latest frame.

## Public static functions

### CheckVpsAvailability

```c#
VpsAvailabilityPromise CheckVpsAvailability(
  double latitude,
  double longitude
)
```
Gets the availability of the Visual Positioning [System](https://docs.microsoft.com/en-us/dotnet/api/System) (VPS) at a specified horizontal position.

The availability of VPS in a given location helps to improve the quality of Geospatial localization and tracking accuracy. See the [developer's guide on VPS availability](https://developers.google.com/ar/develop/unity-arf/geospatial/check-vps-availability).

This launches an asynchronous operation used to query the Google Cloud ARCore API. See `https://developers.google.com/ar/reference/unity-arf/other` for information on obtaining results and cancelling the operation.

Your app must be properly set up to communicate with the Google Cloud ARCore API in order to obtain a result from this call. See [Enable the Geospatial API](https://developers.google.com/ar/develop/unity-arf/geospatial/enable) for more details on required permissions and setup steps.


| Details ||
|---|---|
| Parameters | |---|---| | `latitude` | The latitude in degrees. | | `longitude` | The longitude in degrees. | |
| **Returns** | Returns a `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/VpsAvailabilityPromise#classGoogle_1_1XR_1_1ARCoreExtensions_1_1VpsAvailabilityPromise`. See `https://developers.google.com/ar/reference/unity-arf/other` for more information on how to retrieve results from the Promise. |

**[Deprecated.](https://developers.google.com/ar/reference/unity-arf/deprecated/deprecated)** Please use `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailabilityasync` instead.

### CheckVpsAvailabilityAsync

```c#
VpsAvailabilityPromise CheckVpsAvailabilityAsync(
  double latitude,
  double longitude
)
```
Gets the availability of the Visual Positioning [System](https://docs.microsoft.com/en-us/dotnet/api/System) (VPS) at a specified horizontal position.

The availability of VPS in a given location helps to improve the quality of Geospatial localization and tracking accuracy. See the [developer's guide on VPS availability](https://developers.google.com/ar/develop/unity-arf/geospatial/check-vps-availability).

This launches an asynchronous operation used to query the Google Cloud ARCore API. See `https://developers.google.com/ar/reference/unity-arf/other` for information on obtaining results and cancelling the operation.

Your app must be properly set up to communicate with the Google Cloud ARCore API in order to obtain a result from this call. See [Enable the Geospatial API](https://developers.google.com/ar/develop/unity-arf/geospatial/enable) for more details on required permissions and setup steps.


| Details ||
|---|---|
| Parameters | |---|---| | `latitude` | The latitude in degrees. | | `longitude` | The longitude in degrees. | |
| **Returns** | Returns a `https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/VpsAvailabilityPromise#classGoogle_1_1XR_1_1ARCoreExtensions_1_1VpsAvailabilityPromise` used in a [Unity Coroutine](https://docs.unity3d.com/Manual/Coroutines.html). It updates its results in frame update events. See [Check VPS Availability](https://developers.google.com/ar/develop/unity-arf/geospatial/check-vps-availability) for a usage example. |

## Public functions

### Convert

```c#
GeospatialPose Convert(
  Pose pose
)
```
Gets the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` from a local pose relative to camera, relative to the last frame.

The rotation quaternion of `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` is a rotation with respect to an East-Up-North coordinate frame. An identity quaternion will have the anchor oriented such that X+ points to the east, Y+ points up away from the center of the earth, and Z+ points to the north.

`https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` must be in the `TrackingState.Tracking` state for this to return a valid pose. The `Heading` property will be zero for a `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` returned by this method.


| Details ||
|---|---|
| Parameters | |---|---| | `pose` | The pose to be converted. | |
| **Returns** | A `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose`. |

### Convert

```c#
Pose Convert(
  GeospatialPose geospatialPose
)
```
Gets the local pose relative to camera from the `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose`.

`https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#earthtrackingstate` must be in the `TrackingState.Tracking` state for this to return a valid pose.


| Details ||
|---|---|
| Parameters | |---|---| | `geospatialPose` | A `https://developers.google.com/ar/reference/unity-arf/struct/Google/XR/ARCoreExtensions/GeospatialPose#structGoogle_1_1XR_1_1ARCoreExtensions_1_1GeospatialPose` with valid `Latitude`, `Longitude`, `Altitude` and `EunRotation`. | |
| **Returns** | A `Pose`. |

### IsGeospatialModeSupported

```c#
FeatureSupported IsGeospatialModeSupported(
  GeospatialMode mode
)
```
Checks whether the provided `https://developers.google.com/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#geospatialmode` is supported on this device.

The current list of supported devices is documented on the [ARCore supported devices](https://developers.google.com/ar/devices) page. A device may be incompatible with a given mode due to insufficient sensor capabilities.


| Details ||
|---|---|
| Parameters | |---|---| | `mode` | The desired geospatial mode. | |
| **Returns** | Indicates whether the given mode is supported on this device. It will return `FeatureSupported.Unknown` if the session is still under initialization. |