<br />

The Geospatial API uses a combination of [VPS](https://developers.google.com/ar/develop/geospatial#global_localization_with_vps) and GPS data to generate high-accuracy Geospatial transforms. The API can be used in any place where 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 transforms.
- In outdoor environments with few or no overhead obstructions, the Geospatial API may be able to use available GPS location data to generate Geospatial transforms with high accuracy.

You can determine VPS availability at a given horizontal position before the AR session starts and use it to create more specific experiences --- for example, to present an "Enter AR" button only when VPS is available.

## Enable the ARCore API

Your app must enable the [ARCore API](https://developers.google.com/ar/develop/ios/geospatial/enable#enable_the_arcore_api) to check VPS availability.

## Check VPS availability in your app

The Geospatial API can be used in any place where the device is able to determine its location. If your AR experience hinges on VPS coverage, you can use [`GARSession#checkVPSAvailabilityAtCoordinate:completionHandler:`](https://developers.google.com/ar/reference/ios/interface/GARSession#checkvpsavailabilityatcoordinate:completionhandler:) to obtain a [`GARVPSAvailabilityFuture`](https://developers.google.com/ar/reference/ios/interface/GARVPSAvailabilityFuture), an asynchronous task that checks the VPS availability at a given horizontal position.

Once you have the [`GARVPSAvailabilityFuture`](https://developers.google.com/ar/reference/ios/interface/GARVPSAvailabilityFuture), you can obtain its result by polling or through a callback.


### Poll the result

Use [`GARFuture.state`](https://developers.google.com/ar/reference/ios/interface/GARFuture#state) to obtain the state of the `Future`. There are three different states:

- `GARFutureStatePending`: The operation is not yet complete, so no result is known.
- `GARFutureStateCancelled`: The operation has been cancelled by [`GARFuture#cancel`](https://developers.google.com/ar/reference/ios/interface/GARFuture#cancel). Any registered callback will never be called.
- `GARFutureStateDone`: The operation is complete. Use [`GARVPSAvailabilityFuture.result`](https://developers.google.com/ar/reference/ios/interface/GARVPSAvailabilityFuture#result) to obtain the result.

You may continue checking [`GARFuture.state`](https://developers.google.com/ar/reference/ios/interface/GARFuture#state) until the task is complete.

### Obtain the result through a callback

You can also obtain the result of a `Future` through a callback. Use [`GARSession#checkVPSAvailabilityAtCoordinate:completionHandler:`](https://developers.google.com/ar/reference/ios/interface/GARSession#checkvpsavailabilityatcoordinate:completionhandler:) and supply a `completionHandler`. This `completionHandler` will be called on the Main thread soon after the `Future` has state `GARFutureStateDone`.

## Cancel the `Future`

Use [`GARFuture#cancel`](https://developers.google.com/ar/reference/ios/interface/GARFuture#cancel) to attempt to cancel the `Future`. Due to thread parallelism, it may be possible that your cancel attempt does not actually succeed.

`GARFuture#cancel` returns `YES` if this attempt was successful, and `NO` otherwise.

## Use the Geospatial API without 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/ios/geospatial/obtain-device-pose) to determine the exact location of the user's device in the real world.