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, maxDecodedSizeKb: UInt32 = NSDKMeshDownloader.defaultMaxDecodedSizeKb, 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 size cap in kilobytes, counting bytes served from the on-disk
cache as well as downloaded ones. Once exceeded, no new nodes are scheduled;
already-completed chunks are still delivered. 0 means no cap.
maxDecodedSizeKbUInt32
Cumulative budget in kilobytes for what the delivered chunks occupy
once decoded, cached or downloaded: vertices, UVs, indices and per-vertex colours at
4 bytes each, plus texture bytes as received. Once reached, no new nodes are
scheduled; already-completed chunks are still delivered. 0 means no budget.
pollingIntervalTimeInterval
Interval between polls (default: 0.1 seconds).