downloadByAsset
Declaration
fun downloadByAsset( vpsMapAssetId: String, latitude: Double, longitude: Double, getTexture: Boolean, maxChunks: Int = 0, maxSizeKb: Int = 0, maxDecodedSizeKb: Int = DEFAULT_MAX_DECODED_SIZE_KB, ): Flow<NSDKResult<MeshDownloaderData, MeshDownloaderError>>
Summary
Returns
A Flow that emits NSDKResult.Success for each chunk and a terminal NSDKResult.Error if the download fails or the size limit is reached. The download starts when the Flow is collected. Cancelling the collection, or ending it early with an operator such as first() or take(), does not stop the native download, which has no cancel: it runs until it completes or reaches its limits. Bound it with maxChunks, maxSizeKb and maxDecodedSizeKb rather than by stopping collection.
Parameters
| Name | Type | Summary |
|---|---|---|
| vpsMapAssetId | String | The VPS map (VPS_INFO) asset ID from the Sites API. |
| latitude | Double | User latitude in decimal degrees, used to sort chunks closest-first. |
| longitude | Double | User longitude in decimal degrees, used to sort chunks closest-first. |
| getTexture | Boolean | If true, texture bytes are included in each chunk. |
| maxChunks | Int | Maximum number of mesh nodes to download. Pass 0 for no limit. |
| maxSizeKb | Int | Cumulative size cap in kilobytes, counting bytes served from the on-disk cache as well as downloaded ones. Pass 0 for no limit. |
| maxDecodedSizeKb | Int | 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. Pass 0 for no budget. |
Streams mesh chunks for a VPS map asset, sorted closest-first by GPS position.
MeshDownloader resolves the mesh sibling for
vpsMapAssetIdvia SitesManager, thendownloads chunks. The flow completes normally once all chunks have been delivered. Any
failure is emitted as a terminal
NSDKResult.Errorwhosecodeis the relevantMeshDownloaderError, ending the flow.