This topic describes the ST_As3dTiles function. This function converts a sfmesh object into the 3D Tiles format and stores the converted object in your database.
Syntax
boolean ST_As3dTiles(sfmesh sfmesh_object, cstring table_name, cstring options default '{}');Return values
Return value | Description |
true | Indicates that the data is exported as expected. |
false | Indicates that the data is not exported. |
Parameters
Parameter | Description |
sfmesh_object | The sfmesh object that you want to convert. |
table_name | The table name. |
options | The options in JSON strings that you can configure. |
Usage notes
This function converts a sfmesh object into the 3D Tiles format and stores the converted object in your database. Before you use the ST_As3dTiles function to convert the object, you must use the ST_ImportIFC function to import the object. For more information about the ST_ImportIFC function, see ST_ImportIFC.
The following table describes the options that you can configure.
Option | Type | Description | Default value | Example |
schema | String | The schema of the required table. | public | ganos |
project | String | The project name. The name is used as the project_name field value of each record. | - | project_1 |
parallel | Integer | The degree of parallelism (DOP). If you increase the DOP, data import is accelerated, but may consume a large amount of memory. You can specify an appropriate value based on the actual data or the running status of the database. The maximum value of this option is 16. | 1 | 16 |
size_threshold | Integer | The splitting threshold. Unit: KB. Geometric objects larger than this threshold in size are split until each tile is smaller than this threshold in size. | 2048 | 4096 |
srid | Integer | The spatial reference identifier (SRID) of the destination sfmesh object. If the SRID of the source sfmesh object is inconsistent with that of the destination sfmesh object, an error is reported. If you do not specify this option, the destination sfmesh object does not have an SRID. | - | 2326 |
method | String | The splitting method. Valid values:
| oct | bsp |
filter_percent | Float | The filtering ratio. Valid values: | 0.1 | 0.01 |
tileset_prefix | String | The prefix of the 3D Tiles tileset endpoint. | - | http://your_server/foo/bar |
enable_tile_option | Boolean | Specifies whether to enable the built-in tile attributes of a sfmesh object. | false | true |
merge_material | Boolean | Specifies whether to merge the geometry with the same material. If this option is set to true, the file volume may be reduced. | true | false |
with_extension | Boolean | Specifies whether to add a suffix to the URI of B3DM/Tileset in the generated tileset file. If this option is set to true, a suffix is added to the URL. | false | true |
vertex_threshold | Float | The vertex merge threshold. If this option is set to 0, no vertex merge operation is performed. Otherwise, points whose vertex spacing is less than the threshold in each tile are merged. | 0.0001 | 0.01 |
update_normal | Boolean | Specifies whether to re-calculate the normal data. | false | true |
divide_factor | Float | The calculation factor of geometricError. | 5 | 10 |
If you enable threshold-based vertex merge, original normal data is deleted. To ensure that the newly merged geometry maintains accurate shading and lighting attributes after the vertex merge, you can enable the
update_normaloption to re-calculate the normal data.After you enable threshold-based vertex merge and the system re-calculates the normal data, the display effect may vary based on the vertex merge threshold.
When the system re-calculates the normal data of an object that has no such data, the generated volume value increases.
If
geometricErrorgenerated for non-leaf nodes is excessively large, you can modify thedivide_factoroption. For example, you can double the value of thedivide_factoroption. In this case,geometricErroris reduced by half.
After the project is imported to your database, the following tables are generated in the database:
[table_name]: the primary table that stores the tile metadata.[table_name]_tile: the tile table that stores all tile data of the project.[table_name]_tileset: the table that stores details abouttileset.jsoncorresponding to the project.
Structure of the [table_name] table:
Field | Type | Description | Remarks |
project_id | uuid | The project ID. | The project ID is automatically generated |
project_name | text | The project name. | If you do not specify this field, the project name column does not contain data. In most cases, the table is used to store the tables of multiple sub-projects. |
srid | integer | This field is left empty. | - |
anchor | geometry | The 3D point at which the project is anchored. | The center point projection of the sfmesh project is transformed into the WGS 84 coordinate system. |
extent | geometry | This field is left empty. | - |
aux | text | This field is left empty. | - |
tiletable | varchar(64) | This field is left empty. | - |
Structure of the [table_name]_tile table:
Field | Type | Description | Remarks |
project_id | uuid | The project ID. | The project ID is the same as that of the [table_name] table. |
project_name | text | The project name. | The project name is the same as that of the [table_name] table. |
uid | uuid | The tile ID. | The tile ID is automatically generated. |
lod | integer | This field is left empty. | - |
parent | uuid | This field is left empty. | - |
children | uuid[] | This field is left empty. | - |
aux | jsonb | This field is left empty. | - |
tile | scene | The entity of the tile. | - |
Structure of the [table_name]_tileset table:
Field | Type | Description | Remarks |
project_id | uuid | The project ID. | The project ID is the same as that of the [table_name] table. |
project_name | text | The project name. | The project name is the same as that of the [table_name] table. |
uid | uuid | The ID of | If the node is the root node of the project, the field value is the same as the value of the project_id field. |
tileset | jsonb | The entity of | - |
Examples
SELECT ST_As3dTiles(sfmesh_obj, 'test_table')
FROM t_sfmesh
WHERE id = 1;
---------
t
Parallel
SELECT ST_As3dTiles(sfmesh_obj, 'test_table', '{"parallel": 2}')
FROM t_sfmesh
WHERE id = 1;
---------
t
More options
SELECT ST_As3dTiles(sfmesh_obj, 'test_table', '{"project":"test_proj", "method":"oct", "size_threshold":20}')
FROM t_sfmesh
WHERE id = 1;
---------
t