> For the complete documentation index, see [llms.txt](https://multiset.gitbook.io/multiset/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://multiset.gitbook.io/multiset/unity-sdk/on-cloud-localization.md).

# On-Cloud Localization

### Localization Manager Options

<figure><img src="/files/PdOiXkf6HkgJRo4QmPcQ" alt=""><figcaption></figcaption></figure>

**Auto Localize**: Automatic start localization at the start of the AR session

**Relocalization**: Trigger Localization request when AR session tracking is lost/limited; also trigger localization when the app comes from background.

**Number of Frame:** The number of camera frames to be sent in a single localization request can lead to better accuracy; however, an increased number of frames will also lengthen the localization response time.

**Frame Capture Interval:** Increase the frame capture interval between subsequent camera frames; a longer interval helps improve localization accuracy in areas with low features.

**Background Localization:** Trigger Localization request during an AR session, helps in reducing drift by recalibration with the map

### How to Use the LocalizeFrame Method in the Unity SDK

The LocalizeFrame method is a key part of the Map Localization Manager script in our Unity SDK. This method simplifies the process of initiating a new localization request for the current frame in your AR application. Below is a detailed explanation of how to use this public method effectively. sending a Localization request

The LocalizeFrame method is designed to trigger a localization request that attempts to determine the device’s precise position and orientation in the AR environment based on available map data.

Method Definition

```csharp
public void LocalizeFrame()
{
    RequestForLocalization();
}
```

The LocalizeFrame method internally calls the RequestForLocalization method, which handles the actual process of communicating with the localization service. By exposing LocalizeFrame as a public method, we enable developers to easily trigger localization at specific points in their application.

### When to Use LocalizeFrame

You can call LocalizeFrame in scenarios where you need to:

1\. Recalibrate the device’s position after a significant change in its environment.

2\. Ensure the accuracy of the device’s localization during a user interaction.

3\. Handle scenarios where the localization state is lost or degraded.

### Set MapSpace reference in Map Localization Manager

To ensure accurate placement and alignment of AR objects in the localized environment, developers must place them under the MapSpace GameObject in the Unity hierarchy. Additionally, set a reference to the MapSpace GameObject in the Map Localization Manager. This is essential because the position and rotation of the MapSpace GameObject are dynamically updated during localization, allowing all child AR objects to move and rotate accordingly, maintaining their relative positions in the real world.

<figure><img src="/files/5S9zuTfQOtkhshff1wGr" alt="" width="354"><figcaption></figcaption></figure>

### Localization Callbacks

1. Localization init(): Event that is triggered when localization starts, You can use this event to trigger localization animation, loaders or any custom logic for your app.
2. Localization Success(): Event that is triggered when the localization response comes as a success. You can use this event to trigger localization success events in your app.
3. Localization Failure(): Event that triggered on failed localization event, you can call the localization event again in case of failure.

<figure><img src="/files/VRQKNMrhldpeLvmWsOk3" alt="" width="249"><figcaption></figcaption></figure>

### Example script to call Localization frame dynamically

```csharp
using UnityEngine;

public class LocalizationExample : MonoBehaviour
{
    // Reference to the Map Localization Manager script
    private MapLocalizationManager mapLocalizationManager;

    void Start()
    {
        // Get the Map Localization Manager component
        mapLocalizationManager = FindObjectOfType<MapLocalizationManager>();

        if (mapLocalizationManager == null)
        {
            Debug.LogError("MapLocalizationManager not found! Please ensure it is added to the scene.");
        }
    }

    void Update()
    {
        // Trigger localization when a specific condition is met (e.g., user presses a button)
        if (Input.GetKeyDown(KeyCode.L)) // Replace 'L' with any preferred key
        {
            if (!string.IsNullOrWhiteSpace(mapLocalizationManager?.mapOrMapsetId))
            {
                mapLocalizationManager.LocalizeFrame();
                Debug.Log("Localization request initiated.");
            }
            else
            {
                Debug.LogError("Localization cannot be triggered because mapOrMapsetId is not set.");
            }
        }
    }
}
```

### Using Localization confidence value

In the localization API response, you will find a confidence field indicating the accuracy of the position and rotation. Higher confidence values suggest highly accurate positioning and rotation, while lower values indicate potential errors.

Normalized confidence values range from 0 to 1. By default, we do not apply any confidence-based filters in

Developers, based on their application accuracy requirements, can apply a confidence-based filter in the localization step. For example, if you are using localization in a BIM model AR overlay application and require an accuracy of less than 5 cm, you would set a confidence-based filter of 0.8 or above. Thus, only localization responses with confidence greater than 0.8 will be


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://multiset.gitbook.io/multiset/unity-sdk/on-cloud-localization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
