### 3D Tiles Declarative Styling Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Provides an example of declarative styling using JSON and JavaScript expressions. This snippet colors features based on their 'Height' property, demonstrating conditional styling. ```json { "color": "(${Height} > 90) ? color('red') : color('white')" } ``` -------------------------------- ### Property Table Structure Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 An example JSON structure illustrating a property table, including its name, class, count, and properties. It shows how 'values', 'stringOffsets', and 'arrayOffsets' are defined for different property types. ```json { "propertyTables": [{ "name": "tree_survey_2021-09-29", "class": "tree", "count": 10, "properties": { "species": { "values": 2, "stringOffsets": 3 }, "age": { "values": 1 }, "height": { "values": 0 }, "diameter": { "values": 4 } } }] } ``` -------------------------------- ### 3D Tiles Extension Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Demonstrates how to include a custom vendor extension, 'VENDOR_collision_volume', within a 3D Tiles tile object. This extension adds specific collision volume data. ```json { "transform": [ 4.843178171884396, 1.2424271388626869, 0, 0, -0.7993325488216595, 3.1159251367235608, 3.8278032889280675, 0, 0.9511533376784163, -3.7077466670407433, 3.2168186118075526, 0, 1215001.7612985559, -4736269.697480114, 4081650.708604793, 1 ], "boundingVolume": { "box": [ 0, 0, 6.701, 3.738, 0, 0, 0, 3.72, 0, 0, 0, 13.402 ] }, "geometricError": 32, "content": { "uri": "building.glb" }, "extensions": { "VENDOR_collision_volume": { "box": [ 0, 0, 6.8, 3.8, 0, 0, 0, 3.8, 0, 0, 0, 13.5 ] } } } ``` -------------------------------- ### 3D Tiles Extras Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Illustrates the use of the 'extras' property to embed application-specific metadata, such as a 'name' for a tile object. This allows for custom data without altering the core specification. ```json { "transform": [ 4.843178171884396, 1.2424271388626869, 0, 0, -0.7993325488216595, 3.1159251367235608, 3.8278032889280675, 0, 0.9511533376784163, -3.7077466670407433, 3.2168186118075526, 0, 1215001.7612985559, -4736269.697480114, 4081650.708604793, 1 ], "boundingVolume": { "box": [ 0, 0, 6.701, 3.738, 0, 0, 0, 3.72, 0, 0, 0, 13.402 ] }, "geometricError": 32, "content": { "uri": "building.glb" }, "extras": { "name": "Empire State Building" } } ``` -------------------------------- ### Example glTF Root Node with Matrix Source: https://docs.ogc.org/cs/22-025r4/22-025r4 An example of a glTF root node definition, showcasing the 'matrix' property which can be used to apply transformations to the node. This example uses a column-major matrix. ```json "nodes": [ { "matrix": [1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1], "mesh": 0, "name": "rootNode" } ] ``` -------------------------------- ### Metadata Statistics Schema and Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON snippet illustrates the structure of metadata statistics within a 3D Tiles tileset. It defines a 'building' class with 'height' and 'buildingType' properties, and shows example statistics including min, max, custom '_mode' for height, and occurrences for buildingType. ```json { "schema": { "classes": { "building": { "properties": { "height": { "type": "SCALAR", "componentType": "FLOAT32" }, "owners": { "type": "STRING", "array": true }, "buildingType": { "type": "ENUM", "enumType": "buildingType" } } } }, "enums": { "buildingType": { "valueType": "UINT16", "values": [ {"name": "Residential", "value": 0}, {"name": "Commercial", "value": 1}, {"name": "Hospital", "value": 2}, {"name": "Other", "value": 3} ] } } }, "statistics": { "classes": { "building": { "count": 100000, "properties": { "height": { "min": 3.9, "max": 341.7, "_mode": 5.0 }, "buildingType": { "occurrences": { "Residential": 50000, "Commercial": 40950, "Hospital": 50 } } } } } } } ``` -------------------------------- ### Example Tile Structure with Bounding Volumes and Viewer Request Volume (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON snippet illustrates the structure of a tile within a 3D Tileset, including its transform, bounding volumes (tile and content), geometric error, and content URI. It also demonstrates the use of a viewerRequestVolume for controlling tile loading. ```json { "children": [{ "transform": [ 4.843178171884396, 1.2424271388626869, 0, 0, -0.7993325488216595, 3.1159251367235608, 3.8278032889280675, 0, 0.9511533376784163, -3.7077466670407433, 3.2168186118075526, 0, 1215001.7612985559, -4736269.697480114, 4081650.708604793, 1 ], "boundingVolume": { "box": [ 0, 0, 6.701, 3.738, 0, 0, 0, 3.72, 0, 0, 0, 13.402 ] }, "geometricError": 32, "content": { "uri": "building.glb" } }, { "transform": [ 0.968635634376879, 0.24848542777253732, 0, 0, -0.15986650990768783, 0.6231850279035362, 0.7655606573007809, 0, 0.19023066741520941, -0.7415493329385225, 0.6433637229384295, 0, 1215002.0371330238, -4736270.772726648, 4081651.6414821907, 1 ], "viewerRequestVolume": { "sphere": [0, 0, 0, 15] }, "boundingVolume": { "sphere": [0, 0, 0, 1.25] }, "geometricError": 0, "content": { "uri": "points.glb" } }] } ``` -------------------------------- ### Conditional Logic with Variables Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Provides an example of using variables within conditional expressions, such as in a 'show' property, to control feature visibility based on property values. This demonstrates how variables integrate into styling rules. ```json { "enabled" : true, "description" : null, "order" : 1, "name" : "Feature name" } ${enabled} === true ${description} === null ${order} === 1 ${name} === 'Feature name' "show" : "abs(${temperature}) > 20.0" { "color" : { "conditions" : [ ["${temperature} >= 0.5", "color('#00FFFF')"], ["${temperature} >= 0.0", "color('#FF00FF')"] ] } } ``` -------------------------------- ### Property Table JSON Schema Example Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Illustrates a JSON structure for a property table, defining its class, count, and properties. This example shows a 'tree_survey_2021-09-29' table for the 'tree' class, including some properties like 'species', 'age', and 'height'. ```json "schema": { ... }, "propertyTables": [{ "name": "tree_survey_2021-09-29", "class": "tree", "count": 10, "properties": { "species": { ... }, "age": { ... }, "height": { ... }, // "diameter" is not required and has been omitted from this table. } }] ``` -------------------------------- ### Generate Feature Table JSON and Binary for Positions Only Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This example demonstrates how to create a minimal Feature Table JSON and its corresponding binary buffer for four points located at the corners of a unit square. It defines the number of points and the byte offset for position data. ```javascript var featureTableJSON = { POINTS_LENGTH : 4, POSITION : { byteOffset : 0 } }; var featureTableBinary = new Buffer(new Float32Array([ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0 ]).buffer); ``` -------------------------------- ### Generate Feature Table JSON and Binary for Positions and Colors Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This example illustrates the creation of a Feature Table JSON and binary buffer for four points with specified positions and RGB colors. It includes the RTC_CENTER for relative positioning and defines byte offsets for both position and RGB data. ```javascript var featureTableJSON = { POINTS_LENGTH : 4, RTC_CENTER : [1215013.8, -4736316.7, 4081608.4], POSITION : { byteOffset : 0 }, RGB : { byteOffset : 48 } }; var positionBinary = new Buffer(new Float32Array([ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0 ]).buffer); var colorBinary = new Buffer(new Uint8Array([ 255, 0, 0, 0, 255, 0, 0, 0, 255, 255, 255, 0, ]).buffer); var featureTableBinary = Buffer.concat([positionBinary, colorBinary]); ``` -------------------------------- ### 3D Tiles Metadata JSON Structure Example Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON structure demonstrates the organization of buffers, buffer views, and availability information within a 3D Tiles subtree file. It shows how to define binary data storage and availability status for tiles, content, and child subtrees. ```json { "buffers": [ { "name": "Internal Buffer", "byteLength": 16 }, { "name": "External Buffer", "uri": "external.bin", "byteLength": 32 } ], "bufferViews": [ { "buffer": 0, "byteOffset": 0, "byteLength": 11 }, { "buffer": 1, "byteOffset": 0, "byteLength": 32 } ], "tileAvailability": { "constant": 1, }, "contentAvailability": [{ "bitstream": 0, "availableCount": 60 }], "childSubtreeAvailability": { "bitstream": 1 } } ``` -------------------------------- ### Set Quantized Positions and Oct-Encoded Normals (JavaScript) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This example shows how to position instances using quantized coordinates and define their orientation using oct-encoded normals (`NORMAL_UP_OCT32P`, `NORMAL_RIGHT_OCT32P`). It includes the Feature Table JSON with `QUANTIZED_VOLUME_OFFSET` and `QUANTIZED_VOLUME_SCALE`, and the corresponding binary buffers for quantized positions and normals. ```javascript var featureTableJSON = { INSTANCES_LENGTH : 4, QUANTIZED_VOLUME_OFFSET : [-250.0, 0.0, -250.0], QUANTIZED_VOLUME_SCALE : [500.0, 0.0, 500.0], POSITION_QUANTIZED : { byteOffset : 0 }, NORMAL_UP_OCT32P : { byteOffset : 24 }, NORMAL_RIGHT_OCT32P : { byteOffset : 40 } }; var positionQuantizedBinary = new Buffer(new Uint16Array([ 0, 0, 0, 65535, 0, 0, 0, 0, 65535, 65535, 0, 65535 ]).buffer); var normalUpOct32PBinary = new Buffer(new Uint16Array([ 32768, 65535, 32768, 65535, 32768, 65535, 32768, 65535 ]).buffer); var normalRightOct32PBinary = new Buffer(new Uint16Array([ 65535, 32768, 65535, 32768, 65535, 32768, 65535, 32768 ]).buffer); var featureTableBinary = Buffer.concat([positionQuantizedBinary, normalUpOct32PBinary, normalRightOct32PBinary]); ``` -------------------------------- ### Schema Definition Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 A simplified JSON structure representing a schema definition, which includes classes and enums. This forms the basis for defining metadata structures in various implementations. ```json { "schema": { "classes": { "tree": { ... }, }, "enums": { "speciesEnum": { ... } } } } ``` -------------------------------- ### Using Math.PI Constant in Styling Language Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Illustrates the usage of the Math.PI constant, representing the mathematical constant pi, within a styling expression. This example shows how to use Math.PI in a conditional 'show' property. ```Styling Language { "show" : "cos(${Angle} + Math.PI) < 0" } ``` -------------------------------- ### Set Feature Description using Meta Property Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Utilizes the 'meta' property to define non-visual attributes for a feature. This example sets a 'description' meta property to a string that includes the feature's name. ```json { "meta": { "description": "'Hello, ${featureName}.'" } } ``` -------------------------------- ### Set Instance Positions with Default Orientation (JavaScript) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This example demonstrates how to define the positions of four instances on the corners of a unit square using the `POSITION` semantic in the Feature Table JSON and provides the corresponding binary buffer with Float32Array data. It assumes default orientation. ```javascript var featureTableJSON = { INSTANCES_LENGTH : 4, POSITION : { byteOffset : 0 } }; var featureTableBinary = new Buffer(new Float32Array([ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0 ]).buffer); ``` -------------------------------- ### Identity Matrix Transform Example (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON snippet represents the identity matrix, which is the default value for a tile's 'transform' property when it is not explicitly defined. It signifies no transformation. ```json [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] ``` -------------------------------- ### Generate Feature Table JSON and Binary for Quantized Positions and Oct-encoded Normals Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This example shows how to generate a Feature Table JSON and binary buffer for points with quantized positions and oct-encoded normals. It utilizes QUANTIZED_VOLUME_OFFSET and QUANTIZED_VOLUME_SCALE for defining the quantized volume and specifies byte offsets for quantized positions and oct-encoded normals. ```javascript var featureTableJSON = { POINTS_LENGTH : 4, QUANTIZED_VOLUME_OFFSET : [-250.0, 0.0, -250.0], QUANTIZED_VOLUME_SCALE : [500.0, 0.0, 500.0], POSITION_QUANTIZED : { byteOffset : 0 }, NORMAL_OCT16P : { byteOffset : 24 } }; var positionQuantizedBinary = new Buffer(new Uint16Array([ 0, 0, 0, 65535, 0, 0, 0, 0, 65535, 65535, 0, 65535 ]).buffer); var normalOct16PBinary = new Buffer(new Uint8Array([ 128, 255, 128, 255, 128, 255, 128, 255 ]).buffer); var featureTableBinary = Buffer.concat([positionQuantizedBinary, normalOct16PBinary]); ``` -------------------------------- ### Tileset JSON Structure Example Source: https://docs.ogc.org/cs/22-025r4/22-025r4 A subset of the tileset JSON file used for Canary Wharf, illustrating the main top-level properties: 'asset', 'properties', 'geometricError', and 'root'. This JSON defines the metadata and structure for a 3D Tiles dataset. ```json { "asset": { "version": "1.1", "tilesetVersion": "e575c6f1-a45b-420a-b172-6449fa6e0a59" }, "properties": { "Height": { "minimum": 1, "maximum": 241.6 } }, "geometricError": 494.50961650991815, "root": { "boundingVolume": { "region": [ -0.0005682966577418737, 0.8987233516605286, 0.00011646582098558159, 0.8990603398325034, 0, 241.6 ] }, "geometricError": 268.37878244706053, "refine": "ADD", "content": { "uri": "0/0/0.glb", "boundingVolume": { "region": [ -0.0004001690908972599, 0.8988700116775743, 0.00010096729722787196, 0.8989625664878067, 0, 241.6 ] } }, "children": [...] } } ``` -------------------------------- ### Point Cloud Batch Table with Per-Point Properties (JavaScript) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Defines the structure for a Point Cloud feature table and batch table where each point has its own metadata. It includes byte offsets for positions and an example of binary data for positions. ```javascript var featureTableJSON = {     POINTS_LENGTH : 4,     POSITION : {         byteOffset : 0     } }; var featureTableBinary = new Buffer(new Float32Array([     0.0, 0.0, 0.0,     1.0, 0.0, 0.0,     0.0, 0.0, 1.0,     1.0, 0.0, 1.0 ]).buffer); var batchTableJSON = {     names : ['point1', 'point2', 'point3', 'point4'] }; ``` -------------------------------- ### Tile JSON Example: Multiple Contents with Groups Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON object demonstrates a root tile with multiple content entries, each assigned to a specific group. This structure allows for different representations of tile content (e.g., meshes, point clouds) to be organized and potentially styled or filtered independently. The 'contents' property is an array, mutually exclusive with the 'content' property. ```json { "root": { "refine": "ADD", "geometricError": 0.0, "boundingVolume": { "region": [-1.707, 0.543, -1.706, 0.544, 203.895, 253.113] }, "contents": [ { "uri": "buildings.glb", "group": 0 }, { "uri": "trees.glb", "group": 1 }, { "uri": "cars.glb", "group": 2 } ] } } ``` -------------------------------- ### Using Math.E Constant in Styling Language Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Demonstrates the use of the Math.E constant, representing Euler's number, in a styling expression. This example applies a color transformation based on temperature using Math.E. ```Styling Language { "color" : "color() * pow(Math.E / 2.0, ${Temperature})" } ``` -------------------------------- ### Point Cloud Batch Table with Batched Points (JavaScript) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Defines the structure for a Point Cloud feature table and batch table where points are grouped into batches. It includes the byte offsets and component types for position and batch IDs, and an example of binary data for positions and batch IDs. ```javascript var featureTableJSON = {     POINTS_LENGTH : 4,     BATCH_LENGTH : 2,     POSITION : {         byteOffset : 0     },     BATCH_ID : {         byteOffset : 48,         componentType : "UNSIGNED_BYTE"     } }; var positionBinary = new Buffer(new Float32Array([     0.0, 0.0, 0.0,     1.0, 0.0, 0.0,     0.0, 0.0, 1.0,     1.0, 0.0, 1.0 ]).buffer); var batchIdBinary = new Buffer(new Uint8Array([     0,     0,     1,     1 ]).buffer); var featureTableBinary = Buffer.concat([positionBinary, batchIdBinary]); var batchTableJSON = {     names : ['object1', 'object2'] }; ``` -------------------------------- ### 3D Tiles Styling: Complex Show Condition (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON style illustrates a more complex 'show' condition using a combination of regular expressions and numerical comparisons. It displays features where the 'County' property starts with 'Chest' and the 'YearBuilt' is 1970 or later. ```JSON { "show": "(regExp('^Chest').test(${County})) && (${YearBuilt} >= 1970)" } ``` -------------------------------- ### Batched 3D Model Vertex batchId Attribute Example Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Demonstrates how the `batchId` attribute is used in the Binary glTF section to associate vertices with specific models within a batch. Vertices can be ordered by `batchId` or interleaved. ```text batchId:  [0,   0,   0,   ..., 1,   1,   1,   ..., 2,   2,   2,   ...] position: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...] normal:   [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...] ``` ```text batchId:  [0,   1,   2,   ..., 2,   1,   0,   ..., 1,   2,   0,   ...] position: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...] normal:   [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...] ``` -------------------------------- ### Tile JSON Example: Non-Leaf Tile Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON object represents a non-leaf tile in a 3D Tileset. It includes bounding volume information, geometric error, refinement strategy, and content details, along with a placeholder for child tiles. The boundingVolume defines the spatial extent, geometricError indicates the error introduced if children are not rendered, and refine specifies the refinement method. ```json { "boundingVolume": { "region": [ -1.2419052957251926, 0.7395016240301894, -1.2415404171917719, 0.7396563300150859, 0, 20.4 ] }, "geometricError": 43.88464075650763, "refine" : "ADD", "content": { "boundingVolume": { "region": [ -1.2418882438584018, 0.7395016240301894, -1.2415422846940714, 0.7396461198389616, 0, 19.4 ] }, "uri": "2/0/0.glb" }, "children": [...] } ``` -------------------------------- ### Calculate Feature Color and Volume using Meta Properties Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Shows how 'meta' properties can be used to calculate dynamic values. 'featureColor' is derived from RGB components, and 'featureVolume' is calculated using height, width, and depth. ```json { "meta": { "featureColor": "rgb(${red}, ${green}, ${blue})", "featureVolume": "${height} * ${width} * ${depth}" } } ``` -------------------------------- ### Point Cloud Styling with Feature Semantics Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Demonstrates Point Cloud styling using feature table semantics such as COLOR and POSITION. This allows for more flexible styling based on the source data, like adjusting color or point size based on position or normal values. ```json { "color" : "${COLOR} * color('red')'", "show" : "${POSITION}.x > 0.5", "pointSize" : "${NORMAL}.x > 0 ? 2 : 1" } ``` -------------------------------- ### Implicit Tiling Configuration (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON object demonstrates how to configure implicit tiling for a tile within a tileset. It specifies the subdivision scheme (QUADTREE), the maximum number of available levels, subtree levels, and template URIs for locating content and subtree files. This enables efficient handling of sparse and massive datasets by defining regular spatial structures. ```json { "root": { "boundingVolume": { "region": [-1.318, 0.697, -1.319, 0.698, 0, 20] }, "refine": "REPLACE", "geometricError": 5000, "content": { "uri": "content/{level}/{x}/{y}.glb" }, "implicitTiling": { "subdivisionScheme": "QUADTREE", "availableLevels": 21, "subtreeLevels": 7, "subtrees": { "uri": "subtrees/{level}/{x}/{y}.json" } } } } ``` -------------------------------- ### Constructing Colors and Vectors with Variables Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Shows how variables can be used as arguments to construct color values (e.g., RGBA) or vector types (e.g., vec4). This is useful for dynamic styling based on feature attributes. ```javascript rgba(${red}, ${green}, ${blue}, ${alpha}) vec4(${temperature}) ``` -------------------------------- ### Tileset JSON Structure Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This section details the structure of the main tileset JSON file, which serves as the entry point for a 3D Tileset. It includes explanations of the 'asset', 'properties', 'geometricError', and 'root' top-level properties. ```APIDOC ## Tileset JSON Structure ### Description Provides a detailed breakdown of the 3D Tileset JSON file structure, including its primary components and their significance in defining a tileset. ### Method GET ### Endpoint /tileset.json ### Parameters #### Query Parameters - **tilesetVersion** (string) - Optional - Used to request a specific version of the tileset, useful for cache invalidation. ### Request Body None ### Response #### Success Response (200) - **asset** (object) - Metadata about the entire tileset. - **version** (string) - The 3D Tiles version. - **tilesetVersion** (string) - Optional application-specific version of the tileset. - **properties** (object) - Per-feature properties in the tileset, with minimum and maximum values. - **geometricError** (number) - The geometric error in meters, used for rendering decisions. - **root** (object) - Defines the root tile of the tileset. - **boundingVolume** (object) - The bounding volume of the root tile. - **geometricError** (number) - The geometric error for rendering the root tile's children. - **refine** (string) - How to refine the tile (e.g., ADD). - **content** (object) - Information about the tile's content. - **children** (array) - An array of child tiles. #### Response Example ```json { "asset": { "version": "1.1", "tilesetVersion": "e575c6f1-a45b-420a-b172-6449fa6e0a59" }, "properties": { "Height": { "minimum": 1, "maximum": 241.6 } }, "geometricError": 494.50961650991815, "root": { "boundingVolume": { "region": [ -0.0005682966577418737, 0.8987233516605286, 0.00011646582098558159, 0.8990603398325034, 0, 241.6 ] }, "geometricError": 268.37878244706053, "refine": "ADD", "content": { "uri": "0/0/0.glb", "boundingVolume": { "region": [ -0.0004001690908972599, 0.8988700116775743, 0.00010096729722787196, 0.8989625664878067, 0, 241.6 ] } }, "children": [...] } } ``` ``` -------------------------------- ### External Tilesets Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Explains how to use external tileset JSON files to create hierarchical tileset structures, allowing for modularity and the organization of large datasets. ```APIDOC ## External Tilesets ### Description Details the mechanism for referencing external tileset JSON files from within a tile's `content.uri`. This enables the creation of nested tileset structures, such as a global tileset containing individual city tilesets. ### Method GET ### Endpoint /{tileset_uri} ### Parameters #### Path Parameters - **tileset_uri** (string) - Required - The URI pointing to an external tileset JSON file. ### Request Body None ### Response #### Success Response (200) Returns the content of the referenced external tileset JSON file, following the same structure as the main tileset JSON. ### Notes on External Tilesets: - A tile referencing an external tileset cannot have its own `children` property. - Cycles are prohibited (a tileset cannot reference itself directly or indirectly). - Transformations are cumulative: a tile's transform is applied after its parent's and root tile's transforms. - If an external tileset defines `asset.tilesetVersion`, it overrides the parent's version. Otherwise, it inherits the parent's version. #### Response Example (Content of an external tileset) ```json { "asset": { "version": "1.1", "tilesetVersion": "external-version-123" }, "geometricError": 100.0, "root": { "boundingVolume": { ... }, "geometricError": 50.0, "content": { "uri": "city/data.glb" } } } ``` ``` -------------------------------- ### style.extras Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Application-specific data. ```APIDOC ## style.extras ### Description Application-specific data. ### Type `extras` ### Required No ``` -------------------------------- ### Regular Expression Functions and Operators Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Provides functions and operators for creating and testing regular expressions, mirroring JavaScript's RegExp constructor. Supports global, case-insensitive, multiline, unicode, and sticky flags. Includes test() and exec() methods, and =~ and !~ operators. ```javascript regExp() regExp(pattern : String, [flags : String]) ``` ```javascript regExp('a').test('abc') regExp('a(.)', 'i').exec('Abc') regExp('Building\s(\d)').exec(${Name}) ``` ```javascript regExp('a') =~ 'abc' 'abc' =~ regExp('a') regExp('a') !~ 'bcd' 'bcd' !~ regExp('a') ``` -------------------------------- ### 3D Tiles Extensions Used Declaration (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Shows how to declare extensions used within a tileset. The 'extensionsUsed' array lists all extensions referenced, ensuring compatibility and proper loading. ```json { "extensionsUsed": [ "VENDOR_collision_volume" ] } ``` -------------------------------- ### 3D Tiles Styling: Color with Opacity Control (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON style demonstrates setting both RGB color components and alpha (opacity) based on feature properties. It uses the 'rgba' function and a conditional expression to make features with a volume greater than 100 partially transparent. ```JSON { "color": "rgba(${red}, ${green}, ${blue}, (${volume} > 100 ? 0.5 : 1.0))" } ``` -------------------------------- ### 3D Tiles Styling: Default Show and Color (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON style sets default display properties for features. It ensures all features are visible ('show': 'true') and assigns a uniform white color ('color': 'color(\'#ffffff\')'). ```JSON { "show": "true", "color": "color('#ffffff')" } ``` -------------------------------- ### Meta Source: https://docs.ogc.org/cs/22-025r4/22-025r4 A series of property names and the expression to evaluate for the value of that property. ```APIDOC ## Meta ### Description A series of property names and the `expression` to evaluate for the value of that property. ### Properties #### extensions * **Type**: `extension` * **Description**: Dictionary object with extension-specific objects. * **Required**: No * **Additional properties are allowed.** * **Type of each property**: `object` #### extras * **Type**: `extras` * **Description**: Application-specific data. * **Required**: No ### Additional properties are allowed. ### Type of additional properties `style.expression` ### JSON schema `style.meta.schema.json` ``` -------------------------------- ### Define Variables and Use in Styling Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Defines reusable expressions ('NewHeight', 'HeightColor') that can be referenced in styling properties like 'color' and 'show'. This allows for more complex and maintainable style definitions. ```json { "defines": { "NewHeight": "clamp((${Height} - 0.5) / 2.0, 1.0, 255.0)", "HeightColor": "rgb(${Height}, ${Height}, ${Height})" }, "color": { "conditions": [ ["(${NewHeight} >= 100.0)", "color('#0000FF') * ${HeightColor}"], ["(${NewHeight} >= 50.0)", "color('#00FF00') * ${HeightColor}"], ["(${NewHeight} >= 1.0)", "color('#FF0000') * ${HeightColor}"] ] }, "show": "${NewHeight} < 200.0" } ``` -------------------------------- ### Vector Type Constructors (vec2, vec3, vec4) in OGC CS 22-025r4 Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Illustrates the various ways to construct `vec2`, `vec3`, and `vec4` types, following GLSL-like rules. This includes initialization with numbers, other vectors, or combinations thereof. ```javascript // vec2 constructors vec2(xy : Number) vec2(x : Number, y : Number) vec2(xy : vec2) vec2(xyz : vec3) vec2(xyzw : vec4) // vec3 constructors vec3(xyz : Number) vec3(x : Number, y : Number, z : Number) vec3(xyz : vec3) vec3(xyzw : vec4) vec3(xy : vec2, z : Number) vec3(x : Number, yz : vec2) // vec4 constructors vec4(xyzw : Number) vec4(x : Number, y : Number, z : Number, w : Number) vec4(xyzw : vec4) vec4(xy : vec2, z : Number, w : Number) vec4(x : Number, yz : vec2, w : Number) vec4(x : Number, y : Number, zw : vec2) vec4(xyz : vec3, w : Number) vec4(x : Number, yzw : vec3) ``` -------------------------------- ### Reference External Metadata Schema (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON snippet demonstrates how to reference an external metadata schema using a URI. This approach avoids duplication by allowing multiple tilesets to point to a single schema definition. ```json { "schemaUri": "https://example.com/metadata/buildings/1.0/schema.json" } ``` -------------------------------- ### Subtree JSON Structure for Metadata Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Illustrates the JSON structure for subtree metadata, including buffers, bufferViews, propertyTables for tiles and content, and availability information. It also shows how subtree metadata is directly encoded. ```json { "buffers": [ { "name": "Availability Buffer", "uri": "availability.bin", "byteLength": 48 }, { "name": "Metadata Buffer", "uri": "metadata.bin", "byteLength": 6512 } ], "bufferViews": [ { "buffer": 0, "byteOffset": 0, "byteLength": 11 }, { "buffer": 0, "byteOffset": 16, "byteLength": 32 }, { "buffer": 1, "byteOffset": 0, "byteLength": 2040 }, { "buffer": 1, "byteOffset": 2040, "byteLength": 1530 }, { "buffer": 1, "byteOffset": 3576, "byteLength": 344 }, { "buffer": 1, "byteOffset": 3920, "byteLength": 1024 }, { "buffer": 1, "byteOffset": 4944, "byteLength": 240 }, { "buffer": 1, "byteOffset": 5184, "byteLength": 122 }, { "buffer": 1, "byteOffset": 5312, "byteLength": 480 }, { "buffer": 1, "byteOffset": 5792, "byteLength": 480 }, { "buffer": 1, "byteOffset": 6272, "byteLength": 240 } ], "propertyTables": [ { "class": "tile", "count": 85, "properties": { "horizonOcclusionPoint": { "values": 2 }, "countries": { "values": 3, "arrayOffsets": 4, "stringOffsets": 5, "arrayOffsetType": "UINT32", "stringOffsetType": "UINT32" } } }, { "class": "content", "count": 60, "properties": { "attributionIds": { "values": 6, "arrayOffsets": 7, "arrayOffsetType": "UINT16" }, "minimumHeight": { "values": 8 }, "maximumHeight": { "values": 9 }, "triangleCount": { "values": 10, "min": 520, "max": 31902 } } } ], "tileAvailability": { "constant": 1 }, "contentAvailability": [ { "bitstream": 0, "availableCount": 60 } ], "childSubtreeAvailability": { "bitstream": 1 }, "tileMetadata": 0, "contentMetadata": [1], "subtreeMetadata": { "class": "subtree", "properties": { "attributionStrings": [ "Source A", "Source B", "Source C", "Source D" ] } } } ``` -------------------------------- ### Access Batch Table Height Data (JavaScript) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Demonstrates how to access and read 'height' values from a 3D Tiles Batch Table. It calculates the byte length of the height array and creates a Float32Array view into the binary buffer. Assumes `batchTableJSON`, `batchTableBinary`, `batchLength`, and helper functions `sizeInBytes` and `numberOfComponents` are available. ```javascript var height = batchTableJSON.height; var byteOffset = height.byteOffset; var componentType = height.componentType; var type = height.type; var heightArrayByteLength = batchLength * sizeInBytes(componentType) * numberOfComponents(type); // 10 * 4 * 1 var heightArray = new Float32Array(batchTableBinary.buffer, byteOffset, heightArrayByteLength); var heightOfFeature = heightArray[batchId]; ``` -------------------------------- ### Assign Building Metadata Entity (JSON) Source: https://docs.ogc.org/cs/22-025r4/22-025r4 This JSON represents a metadata entity for the 'building' class. It instantiates the class and provides specific values for its properties, such as height, owners, and building type. This entity can be assigned to tileset, tile, or tile content. ```json { "metadata": { "class": "building", "properties": { "height": 16.8, "owners": [ "John Doe", "Jane Doe" ], "buildingType": "Residential" } } } ``` -------------------------------- ### Style Object Source: https://docs.ogc.org/cs/22-025r4/22-025r4 Defines the properties and structure of a 3D Tiles style, including defines, show, color, meta, extensions, and extras. ```APIDOC ## A.29. Style ### Description A 3D Tiles style. ### Properties | Property | Type | Description | Required | Default | |---|---|---|---|---| | **defines** | `object` | A dictionary object of `expression` strings mapped to a variable name key that may be referenced throughout the style. If an expression references a defined variable, it is replaced with the evaluated result of the corresponding expression. | No | | | **show** | One of `style.booleanExpression`, `style.conditions` | A `boolean expression` or `conditions` property which determines if a feature should be shown. | No | `true` | | **color** | One of `style.colorExpression`, `style.conditions` | A `color expression` or `conditions` property which determines the color blended with the feature’s intrinsic color. | No | `color('#FFFFFF')` | | **meta** | `style.meta` | A `meta` object which determines the values of non-visual properties of the feature. | No | | | **extensions** | `extension` | Dictionary object with extension-specific objects. | No | | | **extras** | `extras` | Application-specific data. | No | | ### Additional properties are allowed. ### JSON schema `style.schema.json` ## style.defines ### Description A dictionary object of `expression` strings mapped to a variable name key that may be referenced throughout the style. If an expression references a defined variable, it is replaced with the evaluated result of the corresponding expression. ### Type `object` ### Required No ### Additional properties are allowed. ### Type of each property `style.expression` ## style.show ### Description A `boolean expression` or `conditions` property which determines if a feature should be shown. ### Type One of `style.booleanExpression`, `style.conditions` ### Required No, default: `true` ```