# MapLocalizationManager

#### Map Localization Manager

The MapLocalizationManager is the core component for handling Visual Positioning System (VPS) localization within the MultiSet SDK. It manages the entire process from capturing camera frames to querying the MultiSet backend and aligning the digital content (mapSpace) with the real world upon a successful localization.

#### **Description**

This manager is responsible for localizing the device against a pre-existing 3D map or a set of maps. It can be configured to start localization automatically, run in the background to continuously refine the device's position, and re-localize if AR tracking is lost. It uses the device's AR camera to capture a sequence of images, which are then sent to the MultiSet API for pose estimation. The manager also provides a set of UnityEvent callbacks to allow other scripts to react to the different stages of the localization process.

## **Properties**

This section details the publicly accessible fields of the MapLocalizationManager that can be configured in the Unity Editor or via script.

| Property                 | Type             | Description                                                                                                                                                                         |
| ------------------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| localizationType         | LocalizationType | An enum to specify the type of localization. This can be either Map (for a single map) or MapSet (for a collection of maps).                                                        |
| mapOrMapsetCode          | string           | The unique identifier for the map or map set you want to localize against. This code is obtained from the MultiSet developer portal.                                                |
| autoLocalize             | bool             | If set to true, the manager will automatically attempt to localize as soon as the SDK is authenticated.                                                                             |
| backgroundLocalization   | bool             | When enabled, the manager will periodically send localization requests in the background to maintain or improve the device's pose over time.                                        |
| bgLocalizationDuration   | float            | The time interval in seconds between background localization attempts. The value is clamped between 15 and 180 seconds.                                                             |
| relocalization           | bool             | If enabled, the manager will automatically try to re-localize when the AR session's tracking state becomes limited or lost.                                                         |
| numberOfFrames           | int              | The number of camera frames to capture for a single localization request. A higher number can improve accuracy but increases processing time. The value is clamped between 4 and 6. |
| frameCaptureInterval     | float            | The time delay in seconds between capturing each frame for a localization request. The value is clamped between 0.4 and 0.8 seconds.                                                |
| showAlert                | bool             | If true, a toast message will be displayed on the screen to indicate the success or failure of a localization attempt.                                                              |
| geoCoordinatesInResponse | bool             | If set to true, the localization response will include the geo-coordinates corresponding to the device's estimated pose.                                                            |
| passGeoPose              | bool             | If set to true, the manager will attempt to acquire the device's GPS coordinates (latitude, longitude, altitude) and include them in the localization request as a hint.            |
| hintRadius               | int              | Search radius in meters for spatial filtering (default: 25m). The value is clamped between 1 and 100. Only applies when geoHint or hintPosition is provided.                        |
| use2DFiltering           | bool             | When true, skip altitude (Y-axis) in geoHint spatial filtering. Uses only horizontal distance (X and Z axes). Only applies when geoHint is provided.                                |
| hintPosition             | string           | An X,Y,Z position string used to provide a spatial hint for background localization queries. This is managed internally by the SDK.                                                 |
| hintMapCodes             | List\<string>    | Used when localizationType is MapSet. You can populate this list with specific map codes to provide a hint to the backend, potentially speeding up localization.                    |
| LocalizationInit         | UnityEvent       | A UnityEvent that is invoked when the localization process is initiated by calling LocalizeFrame().                                                                                 |
| LocalizationRequested    | UnityEvent       | A UnityEvent that is invoked just before the captured frames are sent to the MultiSet API.                                                                                          |
| LocalizationSuccess      | UnityEvent       | A UnityEvent that is invoked when the device has been successfully localized and the pose has been applied to the mapSpace.                                                         |
| LocalizationFailure      | UnityEvent       | A UnityEvent that is invoked when the localization process fails for any reason (e.g., no pose found, network error).                                                               |

***

## Methods

This section describes the publicly accessible methods of the MapLocalizationManager.

**LocalizeFrame()**

Manually starts the localization process.

**Declaration**

```
public void LocalizeFrame()
```

**Description**\
Calling this method will begin the sequence of capturing the specified numberOfFrames from the AR camera. Once the frames are collected and pass a blur check, they are sent to the MultiSet backend to request localization. This is the primary method to call if you have autoLocalize disabled and want to trigger localization based on user input or another event.

<br>


---

# Agent Instructions: 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:

```
GET https://docs.multiset.ai/unity-sdk/api-reference/maplocalizationmanager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
