All Products
Search
Document Center

PolarDB:ST_As3dTiles

Last Updated:Mar 28, 2026

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

Syntax

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

Parameters

ParameterDescription
sfmesh_objectThe sfmesh object to convert.
table_nameThe name of the output table.
optionsA JSON string of configuration options. Defaults to {}.

Return values

ValueDescription
trueThe object was exported successfully.
falseThe export failed.

Usage notes

Before calling ST_As3dTiles, import the sfmesh object using ST_ImportIFC.

Options

OptionTypeDefaultDescriptionExample
schemaStringpublicThe schema of the output table.ganos
projectStringThe project name. Used as the project_name field in each record.project_1
parallelInteger1The degree of parallelism (DOP). Higher values speed up export but increase memory usage. Set this based on your data size and database load. Maximum value: 16.16
size_thresholdInteger2048The splitting threshold in KB. Geometric objects larger than this size are split until each tile is smaller than the threshold.4096
sridIntegerThe spatial reference identifier (SRID) of the output sfmesh object. If the source and output SRIDs differ, an error is returned. If not specified, the output has no SRID.2326
methodStringoctThe splitting method. Valid values: oct (octree), quad (quadtree), bsp (BSP tree).bsp
filter_percentFloat0.1The filtering ratio. Valid values: 0 to 1. At 0.1, objects whose volume is less than 10% of the tile volume are excluded from each non-leaf node tile.0.01
tileset_prefixStringThe prefix of the 3D Tiles tileset endpoint.http://your_server/foo/bar
enable_tile_optionBooleanfalseSpecifies whether to enable the built-in tile attributes of the sfmesh object.true
merge_materialBooleantrueSpecifies whether to merge geometry that shares the same material. Setting this to true may reduce file size.false
with_extensionBooleanfalseSpecifies whether to add a file extension to B3DM and tileset URIs in the generated tileset file.true
vertex_thresholdFloat0.0001The vertex merge threshold. Set to 0 to disable vertex merging. Otherwise, vertices within each tile whose spacing is less than this threshold are merged.0.01
update_normalBooleanfalseSpecifies whether to recalculate normal data.true
divide_factorFloat5The calculation factor for geometricError.10

Vertex merging and normal data

Enabling threshold-based vertex merging deletes the original normal data. To preserve correct shading and lighting after merging, set update_normal to true to recalculate normals. Note that:

  • The visual result may vary depending on the vertex merge threshold.

  • Recalculating normals for an object that has no normal data increases the generated file size.

geometricError tuning

If geometricError values for non-leaf nodes are too large, reduce them by increasing divide_factor. Doubling divide_factor halves the resulting geometricError.

Generated tables

After the export completes, ST_As3dTiles creates three tables in your database:

  • [table_name] — the primary table storing tile metadata

  • [table_name]_tile — stores all tile data for the project

  • [table_name]_tileset — stores the tileset.json details for the project

`[table_name]` table structure:

FieldTypeDescriptionRemarks
project_iduuidThe project ID.Auto-generated.
project_nametextThe project name.Blank if the project option was not specified. Typically used when the table holds multiple sub-projects.
sridintegerLeft blank.
anchorgeometryThe 3D anchor point of the project.The center point of the sfmesh project, projected into the WGS 84 coordinate system.
extentgeometryLeft blank.
auxtextLeft blank.
tiletablevarchar(64)Left blank.

`[table_name]_tile` table structure:

FieldTypeDescriptionRemarks
project_iduuidThe project ID.Same as in the [table_name] table.
project_nametextThe project name.Same as in the [table_name] table.
uiduuidThe tile ID.Auto-generated.
lodintegerLeft blank.
parentuuidLeft blank.
childrenuuid[]Left blank.
auxjsonbLeft blank.
tilesceneThe tile entity.

`[table_name]_tileset` table structure:

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

Examples

Basic export:

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

Export with parallelism:

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

Export with multiple options:

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