Skip to main content
←API Reference ←NSDK ←NSDKVps2Session

localize


Declaration​

func localize(siteId: String) throws

Summary​

Requests localization to a site, identified by its site ID.
Localizes against the site's production-deployed VPS assets and only those: an
asset that has not been deployed to production cannot be localized against.
Asynchronous: observe $latestLocalization for the outcome.
Requests are additive: calling this again does not disturb a request already in
flight, and the sites accumulate.

Throws​

  • NSDKError.invalidArgument if the site ID is empty.
Notice

Note: Starts the session if it is not already active.

Parameters​

NameTypeSummary
siteIdString
The identifier of the site to localize to.

Overload 1​

func localize(siteId: String, assetId: String) throws

Summary​

Requests localization to one VPS map asset of a site.
Like localize(siteId:), but assetId narrows it to that single asset of any
deployment, including non-production ones. assetId is the VPS map asset's ID, as a
UUID (32 hex digits, optionally 0x-prefixed, or the canonical 8-4-4-4-12 form). This
is not the ID of the asset group's mesh or splat. An empty string localizes against the
site's production-deployed assets, exactly as localize(siteId:) does.
Asynchronous: observe $latestLocalization for the outcome. When the site has no
localizable asset with that ID, the request fails with an assets-not-found error in
the localization request records. stopLocalize(siteId:) with the site's ID stops it.

Throws​

  • NSDKError.invalidArgument if the site ID is empty, or assetId is neither empty nor a UUID.
Notice

Note: Starts the session if it is not already active.

Parameters​

NameTypeSummary
siteIdString
The identifier of the site the asset belongs to.
assetIdString
The VPS map asset's ID, or empty for the site's production assets.

Overload 2​

func localize(latitude: Double, longitude: Double, radiusMeters: Double = 0) throws

Summary​

Requests localization near a geographic coordinate.
Looks up every site holding VPS assets within radiusMeters of the coordinate and
localizes against all of their assets. The radius is the only way to narrow the
search. Asynchronous: observe $latestLocalization for the outcome.
Requests are additive: calling this again does not disturb a request already in
flight, and the assets accumulate.

Throws​

  • NSDKError.invalidArgument if a coordinate is out of range, the radius is negative, or any argument is not a finite number.
Notice

Note: Starts the session if it is not already active.

Notice

Warning: Submitted assets stay in the localization set until stopLocalize(siteId:) removes them. Every extra asset grows each cloud localization request, so keep radiusMeters small.

Parameters​

NameTypeSummary
latitudeDouble
Latitude of the search centre, in the range [-90, 90].
longitudeDouble
Longitude of the search centre, in the range [-180, 180].
radiusMetersDouble
Search radius in meters. Pass 0 (the default) to use the
default radius of 100 m. Must not be negative.