Configure your app's settings so that it can use the [Geospatial API](https://developers.google.com/ar/develop/geospatial).

## Prerequisites

Make sure that you understand [fundamental AR concepts](https://developers.google.com/ar/develop/fundamentals)
and how to [configure an ARCore session](https://developers.google.com/ar/develop/unity-arf/session-config) before proceeding.

See the
[Introduction to the Geospatial API](https://developers.google.com/ar/develop/geospatial) for more
information about the Geospatial API.

If you're new to developing with ARCore, see [Getting started](https://developers.google.com/ar/develop/getting-started)
for information about software and hardware requirements, prerequisities and
other information specific to the platforms you are using.

To use the ARCore Geospatial API, your project must support
[AR Foundation](https://developers.google.com/ar/develop/unity-arf/getting-started-ar-foundation#requirements)
and the [ARCore Extensions for AR Foundation](https://developers.google.com/ar/develop/unity-arf/getting-started-extensions).

## Enable the ARCore API

Before using the Visual Positioning System (VPS) in your app, you must first
enable the [**ARCore API**](https://developers.google.com/ar/develop/authorization?platform=unity-arf-ios)
in a new or existing Google Cloud project. This service is responsible for
hosting, storing, and resolving Geospatial anchors.

Keyless authorization is preferred, but API Key authorization is also supported.

## Add required libraries to your app

After authorizing your app to call the ARCore API, you must add libraries to
enable Geospatial features in your app.

1. Navigate to **Edit** \> **Project Settings** \> **XR Plug-In Management** \> **ARCore Extensions** . Make sure that **iOS Support Enabled** is selected.
2. Under **Optional Features** , select **Geospatial**.

![](https://developers.google.com/static/ar/develop/unity-arf/geospatial/images/enable-geospatial-ios.png)

## Enable Geospatial capabilities in the session configuration

Once Geospatial functionality has been enabled in your app, enable Geospatial capabilities in your app's [AR session configuration](https://developers.google.com/ar/develop/unity-arf/session-config) so that it can communicate with the ARCore API:

1. Ensure that the project **Assets** folder contains an **ARCoreExtensionsConfig** scriptable object. To create one, right-click in the **Assets** pane and select **Create** \> **XR** \> **ARCore Extensions Config**.
2. Select the **ARCoreExtensionsConfig** scriptable object in your **Assets** folder and set the **Geospatial Mode** to **Enabled**.

   ![](https://developers.google.com/static/ar/develop/unity-arf/geospatial/images/enable-geospatial-mode.png)
3. Configure the **ARCore Extensions** game object to use the **ARCoreExtensionsConfig** configuration. In the **Hierarchy** pane, locate the **ARCore Extensions** game object you created when you initially set up ARCore Extensions, and connect the **ARCore Extensions Config** field to the **ARCoreExtensionsConfig** scriptable object in your **Assets** folder.

   ![](https://developers.google.com/static/ar/develop/unity-arf/geospatial/images/connect-arcore-extensions-config.png)

## Prompt user to allow usage of device data

Apps that use the ARCore Geospatial API must present the user with a prompt to
acknowledge and allow the use of data from their device. See
[User privacy requirements](https://developers.google.com/ar/develop/privacy-requirements) for more
information.

## Check device compatibility

Not all devices that support ARCore also support the Geospatial API. To check
the user's device for compatibility, call
[`AREarthManager.IsGeospatialModeSupported()`](https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#isgeospatialmodesupported).
If this returns `FeatureSupported.Unsupported` do not attempt to configure the
session.

## Ask user for location permissions at runtime

To enable Unity's location services in a script that triggers the runtime
permission requests, do the following:

1. In **Project Settings \> iOS \> Other Settings \> Location Usage Description**,
   enter the name of the app that is requesting permissions.

2. Enable Unity's location services to trigger the runtime
   permission request, as follows:

       public void OnEnable()
       {
           Input.location.Start();
       }

       public void OnDisable()
       {
           Input.location.Stop();
       }

   See Unity's
   [`LocationService`](https://docs.unity3d.com/ScriptReference/LocationService.html)
   documentation for more information.

## Check Geospatial availability at the device's current location

Because the Geospatial API uses a combination of [VPS](https://developers.google.com/ar/develop/geospatial#global_localization_with_vps) and GPS to determine a Geospatial pose, the API can be used as long as the device is able to determine its location. In areas with low GPS accuracy, such as indoor spaces and dense urban environments, the API will rely on VPS coverage to generate high accuracy poses. Under typical conditions, VPS can be expected to provide positional accuracy of approximately 5 meters, and rotational accuracy of 5 degrees. Use [`AREarthManager.CheckVpsAvailability()`](https://developers.google.com/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/AREarthManager#checkvpsavailability) to determine if a given location has VPS coverage.

The Geospatial API can also be used in areas that do not have VPS coverage. In outdoor environments with few or no overhead obstructions, GPS may be sufficient to generate a pose with high accuracy.

## What's next

- [Obtain the device camera's Geospatial pose](https://developers.google.com/ar/develop/unity-arf/geospatial/obtain-device-pose) to determine the exact location of the user's device in the real world.
- [Check VPS availability](https://developers.google.com/ar/develop/unity-arf/geospatial/check-vps-availability) at a device's given location.