All Products
Search
Document Center

PolarDB:ST_As3dTiles

Last Updated:Mar 28, 2026

Converts a sfmesh object into 3D Tiles format and stores the result in your database.

Syntax

boolean ST_As3dTiles(sfmesh sfmesh_object, cstring table_name, cstring options default '{}');

Prerequisites

Before calling ST_As3dTiles, import the sfmesh object using ST_ImportIFC.

Parameters

ParameterDescription
sfmesh_objectThe sfmesh object to convert.
table_nameThe name of the output table.
optionsConversion options as a JSON string. Default value: '{}'.

Return values

ValueDescription
trueThe data was exported successfully.
falseThe export failed.

Options

OptionTypeDefaultDescription
schemaStringpublicThe schema of the output table.
projectStringThe project name. Stored as the project_name field in each record.
parallelInteger1The degree of parallelism (DOP). Higher values speed up processing but consume more memory. Maximum value: 16.
size_thresholdInteger2048The tile splitting threshold, in KB. Geometric objects larger than this value are split until each tile falls below the threshold.
sridIntegerThe spatial reference identifier (SRID) of the target sfmesh object. If the SRID of the source and target objects differ, an error is returned. If not specified, the output has no SRID.
methodStringoctThe splitting method. Valid values: oct (octree), quad (quadtree), bsp (BSP tree).
filter_percentFloat0.1The filtering ratio. Valid values: 0 to 1. For each non-leaf node tile, objects whose volume is less than this ratio of the tile volume are excluded.
tileset_prefixStringThe prefix of the 3D Tiles tileset endpoint URL.
enable_tile_optionBooleanfalseSpecifies whether to enable the built-in tile attributes of the sfmesh object.
merge_materialBooleantrueSpecifies whether to merge geometry that shares the same material. Enabling this option can reduce output file size.
with_extensionBooleanfalseSpecifies whether to add a suffix to the URI of B3DM and tileset in the generated tileset file.
vertex_thresholdFloat0.0001The vertex merge threshold. Set to 0 to skip vertex merging. Otherwise, vertices within each tile whose spacing is less than this value are merged.
update_normalBooleanfalseSpecifies whether to recalculate normal data after vertex merging.
divide_factorFloat5The geometricError calculation factor. Doubling this value halves geometricError for non-leaf nodes.

Usage notes for options

Vertex merging and normal data

When threshold-based vertex merging is enabled:

  • Original normal data is deleted.

  • Enable update_normal to recalculate normals after merging, preserving accurate shading and lighting.

  • The visual result varies depending on the vertex merge threshold.

  • Recalculating normals for objects that had no normal data increases the output volume.

`geometricError` tuning

If geometricError for non-leaf nodes is too large, increase divide_factor. Doubling divide_factor halves geometricError.

Output tables

The function creates three tables in your database:

[table_name] — primary table (tile metadata)

FieldTypeDescription
project_iduuidThe project ID. Auto-generated.
project_nametextThe project name. Empty if the project option is not specified. In most cases, the table is used to store the tables of multiple sub-projects.
sridintegerNot used.
anchorgeometryThe 3D anchor point of the project. The center point of the sfmesh project projected into the WGS 84 coordinate system.
extentgeometryNot used.
auxtextNot used.
tiletablevarchar(64)Not used.

[table_name]_tile — tile table (all tile data)

FieldTypeDescription
project_iduuidThe project ID. Same as in [table_name].
project_nametextThe project name. Same as in [table_name].
uiduuidThe tile ID. Auto-generated.
lodintegerNot used.
parentuuidNot used.
childrenuuid[]Not used.
auxjsonbNot used.
tilesceneThe tile entity.

[table_name]_tileset — tileset table (tileset.json details)

FieldTypeDescription
project_iduuidThe project ID. Same as in [table_name].
project_nametextThe project name. Same as in [table_name].
uiduuidThe ID of the tileset.json entry. For the project root node, this equals project_id.
tilesetjsonbThe tileset.json entity.

Examples

Basic conversion

SELECT ST_As3dTiles(sfmesh_obj, 'test_table')
FROM t_sfmesh
WHERE id = 1;

---------
t

Enable parallel processing

SELECT ST_As3dTiles(sfmesh_obj, 'test_table', '{"parallel": 2}')
FROM t_sfmesh
WHERE id = 1;

---------
t

Set project name, splitting method, and size threshold

SELECT ST_As3dTiles(sfmesh_obj, 'test_table', '{"project":"test_proj", "method":"oct", "size_threshold":20}')
FROM t_sfmesh
WHERE id = 1;

---------
t