What is the source type for uploading .laz file?

I am new to cesium, and using rest API, can you please tell what should be the source type for uploading .laz file ?

Hello,

The source type for LAZ files should be POINT_CLOUD. Here is some documentation that could be useful to you:

  1. Ion REST API documentation – Cesium
  2. Upload with REST – Cesium
  3. https://github.com/CesiumGS/cesium-ion-rest-api-examples/tree/main/tutorials/rest-api

Here is the example code from the repository in item 3 above revised for a LAZ file:

'use strict';

const AWS = require('aws-sdk');
const fs = require('fs');
const request = require('request-promise');

// Replace <your-access-token> below with a token from your ion account.
// This example requires a token with assets:list, assets:read, and assets:write scopes.
// Tokens page: https://cesium.com/ion/tokens
const accessToken = '<your-access-token>';

// Replace this with the path to your LAZ file on your local machine.
const input = '../../_las/your-laz-filename.laz';

async function main() {
    // Step 1 POST information about the data to /v1/assets
    console.log('Creating new asset: Your LAZ Asset Name');

    const response = await request({
        url: 'https://api.cesium.com/v1/assets',
        method: 'POST',
        headers: { Authorization: `Bearer ${accessToken}` },
        json: true,
        body: {
            name: 'Your LAZ Asset Name',
            description: '...',
            type: '3DTILES',
            options: {
                sourceType: 'POINT_CLOUD',
                geometryCompression: 'DRACO'
            }
        }
    });

    // Step 2 Use response.uploadLocation to upoad the file to ion
    console.log('Asset created. Uploading your-laz-filename.laz');
    const uploadLocation = response.uploadLocation;
    const s3 = new AWS.S3({
        apiVersion: '2006-03-01',
        region: 'us-east-1',
        signatureVersion: 'v4',
        endpoint: uploadLocation.endpoint,
        credentials: new AWS.Credentials(
            uploadLocation.accessKey,
            uploadLocation.secretAccessKey,
            uploadLocation.sessionToken)
    });

    await s3.upload({
        Body: fs.createReadStream(input),
        Bucket: uploadLocation.bucket,
        Key: `${uploadLocation.prefix}your-laz-filename.laz`
    }).on('httpUploadProgress', function (progress) {
        console.log(`Upload: ${((progress.loaded / progress.total) * 100).toFixed(2)}%`);
    }).promise();

    // Step 3 Tell ion we are done uploading files.
    const onComplete = response.onComplete;

    await request({
        url: onComplete.url,
        method: onComplete.method,
        headers: { Authorization: `Bearer ${accessToken}` },
        json: true,
        body: onComplete.fields
    });

    // Step 4 Monitor the tiling process and report when it is finished.
    async function waitUntilReady() {
        const assetId = response.assetMetadata.id;

        // Issue a GET request for the metadata
        const assetMetadata = await request({
            url: `https://api.cesium.com/v1/assets/${assetId}`,
            headers: { Authorization: `Bearer ${accessToken}` },
            json: true
        });

        const status = assetMetadata.status;

        if (status === 'COMPLETE') {
            console.log('Asset tiled successfully');
            console.log(`View in ion: https://cesium.com/ion/assets/${assetMetadata.id}`);
        } else if (status === 'DATA_ERROR') {
            console.log('ion detected a problem with the uploaded data.');
        } else if (status === 'ERROR') {
            console.log('An unknown tiling error occurred, please contact support@cesium.com.');
        } else {
            if (status === 'NOT_STARTED') {
                console.log('Tiling pipeline initializing.');
            } else { // IN_PROGRESS
                console.log(`Asset is ${assetMetadata.percentComplete}% complete.`);
            }

            // Not done yet, check again in 10 seconds
            setTimeout(waitUntilReady, 10000);
        }
    }

    waitUntilReady();
}

main().catch(e => {
    console.log(e.message);
});