> For the complete documentation index, see [llms.txt](https://docs.multiset.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/localizationresult.md).

# LocalizationResult

The result delivered on a successful localization: computed pose versus raw server pose, geo coordinates, GeoPose and the supporting enums.

## Overview

`LocalizationResult` is delivered to [`onLocalizationSuccess(result:)`](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/multisetcallback.md) when a pose is returned and accepted. It carries the computed pose that the SDK applied, the raw server values behind it, and optional geographic data.

{% hint style="info" %}
From iOS SDK 2.4.0 and above, the SDK keeps this result for you and converts with it, so you do not need to work with the pose or the GeoPose quaternion yourself. Read the map's pose, the device's position and heading, and positions for content given in latitude and longitude at any time. See [Polling API](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/polling-api.md).
{% endhint %}

***

## Properties

| Property              | Type               | Description                                                                             |
| --------------------- | ------------------ | --------------------------------------------------------------------------------------- |
| `mapCode`             | `String`           | The map code where localization succeeded                                               |
| `mapCodes`            | `[String]`         | All map codes returned, which may be several for a MapSet                               |
| `position`            | `SIMD3<Float>`     | Position of the map origin in the AR session frame                                      |
| `rotation`            | `simd_quatf`       | Rotation of the map origin in the AR session frame                                      |
| `confidence`          | `Float?`           | Confidence score of the localization (0.0 to 1.0)                                       |
| `geoCoordinates`      | `GeoCoordinates?`  | Geographic position, when `geoCoordinatesInResponse` is enabled                         |
| `geoPose`             | `GeoPose?`         | Full geographic pose, including orientation, when `geoCoordinatesInResponse` is enabled |
| `estimatedPosition`   | `SIMD3<Float>?`    | Raw camera position the server returned, in the map frame                               |
| `estimatedRotation`   | `simd_quatf?`      | Raw camera rotation the server returned, in the map frame                               |
| `queryCameraPosition` | `SIMD3<Float>?`    | AR camera position that produced this fix, in the AR session frame                      |
| `queryCameraRotation` | `simd_quatf?`      | AR camera rotation that produced this fix, in the AR session frame                      |
| `timestamp`           | `Date`             | When the result was produced                                                            |
| `mode`                | `LocalizationMode` | The localization mode used                                                              |

### Computed pose versus raw pose

`position` and `rotation` are the **computed** pose: where the map origin sits in the AR session frame, which is what the SDK applies to the scene. This is the pair almost every app wants. It is not the camera's pose in the map; that is `estimatedPosition` / `estimatedRotation`, for the moment the query frame was captured.

`estimatedPosition` / `estimatedRotation` and `queryCameraPosition` / `queryCameraRotation` are the untransformed inputs the computed pose was derived from. They are exposed for diagnostics, for logging a fix faithfully, and for apps that need to recompute the transform themselves.

```swift
func onLocalizationSuccess(result: LocalizationResult) {
    print("Localized in \(result.mapCode) at \(result.position)")

    if let confidence = result.confidence {
        print("Confidence: \(confidence)")
    }

    if let geo = result.geoCoordinates {
        print("Lat \(geo.latitude), lon \(geo.longitude)")
    }
}
```

***

## GeoCoordinates

Geographic position of the localized pose. Populated only when `geoCoordinatesInResponse` is enabled and the map is georeferenced in the portal.

| Property    | Type      | Description                                                                    |
| ----------- | --------- | ------------------------------------------------------------------------------ |
| `latitude`  | `Double`  | WGS-84 latitude                                                                |
| `longitude` | `Double`  | WGS-84 longitude                                                               |
| `altitude`  | `Double?` | Height above the WGS84 ellipsoid in metres, or `nil` when the server sent none |

***

## GeoPose

The full geographic pose the server returns when `geoCoordinatesInResponse` is enabled. `GeoCoordinates` carries only the position and is kept for existing integrations. `GeoPose` additionally exposes the orientation quaternion and the frame specification, which is what you need to draw a heading or record a pose faithfully.

Every field is optional, because the server may omit the block or any part of it.

| Property     | Type                  | Description                                                                                         |
| ------------ | --------------------- | --------------------------------------------------------------------------------------------------- |
| `frameModel` | `String?`             | The geodetic model, for example `"WGS-84"`                                                          |
| `frameName`  | `String?`             | The local tangent frame, for example `"Y-Up-ENU"`. Needed to read `quaternion` as a compass heading |
| `position`   | `GeoPose.Position?`   | Geographic position in the frame named by `frameName`                                               |
| `quaternion` | `GeoPose.Quaternion?` | Orientation within that frame                                                                       |

**GeoPose.Position**

| Property    | Type     |
| ----------- | -------- |
| `latitude`  | `Double` |
| `longitude` | `Double` |
| `altitude`  | `Double` |

**GeoPose.Quaternion**

| Property | Type    |
| -------- | ------- |
| `x`      | `Float` |
| `y`      | `Float` |
| `z`      | `Float` |
| `w`      | `Float` |

```swift
if let geoPose = result.geoPose,
   let position = geoPose.position,
   let quaternion = geoPose.quaternion {
    print("Frame: \(geoPose.frameName ?? "unknown")")
    print("Position: \(position.latitude), \(position.longitude)")
    print("Heading quaternion: \(quaternion.x), \(quaternion.y), \(quaternion.z), \(quaternion.w)")
}
```

***

## Supporting Enums

### LocalizationMode

| Value          | Description                                     |
| -------------- | ----------------------------------------------- |
| `.singleFrame` | Single frame capture, quick but lower accuracy  |
| `.multiFrame`  | Multi-frame capture, slower but higher accuracy |

### QueryMode

Applies to single-frame and multi-frame localization. See [Query Mode](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/multisetconfig.md#query-mode).

| Value   | Description                                                     |
| ------- | --------------------------------------------------------------- |
| `.vps1` | Standard matching. Fastest response, best for well-mapped areas |
| `.vps2` | Deep search. Recovers a pose in harder or sparsely mapped areas |

### TrackingState

| Value       | Description                       |
| ----------- | --------------------------------- |
| `.tracking` | AR tracking is working normally   |
| `.paused`   | AR tracking is temporarily paused |
| `.stopped`  | AR tracking has stopped           |

### LocalizationStage

The stage of a localization or object tracking run. See [Showing a Run's Progress](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/lifecycle-and-runtimes.md#showing-a-runs-progress). The enum may gain cases, so a `switch` over it needs `@unknown default`.

| Value                            | Description             |
| -------------------------------- | ----------------------- |
| `.idle`                          | No run in progress      |
| `.capturing(captured:required:)` | Frames are being taken  |
| `.uploading`                     | The query is going out  |
| `.awaitingResponse`              | The server is searching |

### RecoveryPhase

| Value                 | Description                                                                   |
| --------------------- | ----------------------------------------------------------------------------- |
| `.none`               | No recovery in progress                                                       |
| `.waitingForTracking` | Tracking broke after a fix; the recovery starts once tracking is normal again |
| `.realigning`         | Tracking is back and the scene is being matched to the map again              |

### AnchorTrust

| Value           | Description                                                         |
| --------------- | ------------------------------------------------------------------- |
| `.provisional`  | The anchor rests on one viewpoint, such as a single-frame first fix |
| `.corroborated` | A second viewpoint agreed with it                                   |
| `.trusted`      | Enough viewpoints agree, or the anchor came from a multi-frame fix  |

***

## Related

* [MultiSetCallback](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/multisetcallback.md)
* [Polling API](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/polling-api.md)
* [MultiSetConfig](https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/multisetconfig.md)
* [ARLocalizationView](https://docs.multiset.ai/native-sdk/ios-swift-native/sample-views/arlocalizationview.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.multiset.ai/native-sdk/ios-swift-native/api-reference/localizationresult.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
