Skip to main content
←API Reference ←NSDK ←NSDKMeshDownloader

requestLocationMeshByAsset


Declaration​

func requestLocationMeshByAsset(vpsMapAssetId: String, latitude: Double, longitude: Double, getTexture: Bool, maxChunks: UInt32 = 0, maxSizeKb: UInt32 = 0, pollingInterval: TimeInterval = 0.1) -> AsyncThrowingStream<MeshDownloaderChunk, Error>

Summary​

Downloads mesh chunks for a portal asset, streaming each chunk as it completes.
Initiates a network request to the portal API for the given vpsMapAssetId. Graph nodes are
sorted by proximity to the provided GPS position and downloaded sequentially, closest first.
Each decoded chunk is yielded to the returned stream immediately upon completion, enabling
incremental mesh generation without waiting for the full download.

Returns​

An AsyncThrowingStream that yields MeshDownloaderChunk values as they
arrive and finishes when all chunks have been delivered.

Throws​

  • - CancellationError if the Task running this function was cancelled. - MeshDownloaderResults/Error if the download encountered an error.

Parameters​

NameTypeSummary
vpsMapAssetIdString
The portal VPS map asset ID string.
latitudeDouble
User latitude in decimal degrees, used to sort nodes closest-first.
longitudeDouble
User longitude in decimal degrees.
getTextureBool
If true, texture bytes are included in each chunk.
maxChunksUInt32
Maximum number of graph nodes to download. 0 means no limit.
maxSizeKbUInt32
Cumulative download cap in kilobytes. Once exceeded, no new nodes are
scheduled; already-completed chunks are still delivered. 0 means no cap.
pollingIntervalTimeInterval
Interval between polls (default: 0.1 seconds).