Skip to main content
API Reference SwiftyNsdk

NsdkMapStorage

A storage system for managing device-generated maps....

Declaration

final class NsdkMapStorage

Summary

A storage system for managing device-generated maps. The map storage feature provides capabilities for capturing, storing, and managing map data from AR sessions. This data can be persisted and used for Visual Positioning System (VPS) localization and map updates.


Methods

NameTypeSummary
addMapvoid
Adds previously serialized map data to the map storage.
- Parameter map: The serialized map data to add. It should be encoded as a
DeviceMap protobuf and can be obtained from mapData(), mapUpdate(),
or mergeMapUpdate(existingMap:mapUpdate:).
- Throws: NsdkError.invalidArgumentor NsdkError.nullArgument
indicating a problem with the map argument . Check NSDK's C logs for more information.
clearvoid
Clears the map storage.
This method removes all stored map data and localization data
- Note: Must not be called if VPS is running. If called,
localization data will be discarded and the session state will be undefined.
createRootAnchorString?
Creates an anchor on the existing map located at the origin of the current AR session, if possible.
The root anchor represents the origin point of the map coordinate system and can be
used with VPS for localization.
- Returns: The payload of the root anchor, encoded as a base64 string if available, nil if otherwise.
extractMapMetadataMapMetadata?
Extracts metadata from a map relative to a specified anchor.
Render the feature points in the metadata relative to the specified anchor to visualize the map.
This is only possible when the anchor is linked directly to the map's node(s), or if
the anchor's nodes are reachable to the map's nodes from the currently active
transform graph.
- Parameter anchorPayload: The base64-encoded payload of the anchor that the
returned points will be relative to.
- Parameter map: The map buffer to extract metadata from.
- Returns: The metadata of the map if successful, nil if otherwise.
- Throws: NsdkError.invalidArgumentor NsdkError.nullArgument
indicating a problem with either argument. Check NSDK's C logs for more information.
mapDataNsdkBuffer?
Gets the complete map data.
This function returns all the map data accumulated during the AR session, serialized as a
DeviceMap protobuf. This data can be saved, shared, and/or used for localization.
- Returns: The serialized map data buffer if available, nil if no map data exists.
mapUpdateNsdkBuffer?
Gets the latest map update data.
This method returns the incremental map changes (new nodes and edges) that have been added
since the last update.
- Returns: The serialized map update if available, nil if no updates exist.
mergeMapUpdateNsdkBuffer
Merges a map update into an existing map.
This method combines incremental map updates with a base map to produce
a merged map buffer containing the complete map data.
- Parameter existingMap: The existing map to merge the update into.
- Parameter mapUpdate: The map update to merge into the existing map.
- Returns: The merged map buffer
- Throws: NsdkError of type NsdkError.invalidArgumentor
NsdkError.nullArgument indicating a problem with either
argument . Check NSDK's C logs for more information.