I3SConverter class
The I3SConverter class converts a 3D Tiles tileset to I3S layer.
Usage
import {I3SConverter} from '@loaders.gl/tile-converter';
const converter = new I3SConverter();
const tilesetJson = await converter.convert({
inputUrl: TILESET_URL,
outputPath: 'data',
tilesetName: 'BatchedColors'
});
// The converted tiles are written to the specified output path
const rootTileJson = await fs.readFile('data/BatchedColors/layers/0/nodes/root/index.json', 'utf8');
Methods
constructor()
Constructs a new I3SConverter instance.
convert(options: object): object
Converts a tileset to I3S SLPK format
options.inputUrl: stringthe url to read the tileset fromoptions.outputPath: stringthe output filenameoptions.tilesetName: stringthe output name of the tilesetoptions.maxDepth: numberThe max tree depth of conversionoptions.egmFilePath: stringlocation of *.pgm file to convert heights from ellipsoidal to gravity-related format or "None" to not use it. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.htmloptions.token: stringION token of input tilesetoptions.draco: booleanDefault:true. Whether the converter creates DRACO compressed geometry in path "layers/0/nodes/xxx/geometries/1" along with non-compressed geometry in path "layers/0/nodes/xxx/geometries/0"options.mergeMaterials: booleanDefault:true. Whether the converter should try to merge PBR materials. Iftrue, the converter will try to merge PBR materials, joining textures in an atlas. This operation allows to create one I3S node for one 3DTiles tile. If one material has a texture but another doesn't have, materials are not merged and the 3DTiles tile will be splitted into 2 I3S nodes.options.generateTextures: booleanWhether the converter should generate additional texture of another format. For non-compressed source texture format (JPG, PNG) the converter creates additional KTX2 texture. For compressed source texture (KTX2) the converter creates additional JPG texture. To encode and decode KTX2 Basis Universal Supercompressed GPU Texture Codec is used.options.generateBoundingVolumes: booleanWhether the converter generate new bounding volumes from the mesh vertices. The default behavior is convertion bounding volumes (box, sphere or region) from 3DTiles tileset data. If this option is settruethe converter will ignore source bounding volume and generate new bounding volume (oriented bounding box and minimal bounding sphere) from the geometry POSITION attribute.options.instantNodeWriting: booleanWhether the converter should keep JSON resources (3DNodeIndexDocuments and nodePages) on disk during conversion. The default behavior is the converter keeps JSON resources in memory till the end of conversion. Those resources need to be updated during conversion (adding child nodes and neighbor nodes). If this option is settruethe converter will keep JSON resources on disk all the time. Use this option for large datasets when the nodes tree is large and "memory overflow" error occurs. Instant node writing saves memory usage in cost of conversion speed (>2 times slower).options.metadataClass: stringOne of the list of feature metadata classes, detected by converter on "analyze" stageoptions.analyze: booleanAnalyze the input tileset content without conversion.options.validate: booleanEnable Validation.
Validation
By specifying the --validate parameter, the tile-converter will perform checks on the tileset data. The following checks are performed:
- Bounding volume validation
- Refinement type validation