All Products
Search
Document Center

PolarDB:ST_ImportIFC

Last Updated:Mar 28, 2026

Imports an Industry Foundation Classes (IFC) file into a database. Returns true on success and creates three tables prefixed with the value you provide.

Syntax

Syntax 1 — import from object storage:

boolean ST_ImportIFC(cstring prefix, cstring url, cstring options default '{}');

Syntax 2 — import from binary data:

boolean ST_ImportIFC(cstring prefix, bytea content, cstring options default '{}');

Parameters

ParameterDescription
prefixThe prefix applied to all three output table names.
urlThe path to the IFC file in object storage. Use this parameter when the file is stored in an Object Storage Service (OSS) bucket. For supported path formats, see Object storage paths.
contentThe binary representation of the IFC file. Use this parameter to import the file by passing its binary data directly, instead of a URL.
optionsA JSON object that controls the import behavior. Defaults to {}.

Options fields

FieldTypeDefaultDescription
schemaStringpublicThe schema of the destination tables.
projectStringA project name written to the project_name column of every imported record. Use this field when one database stores data from multiple sub-projects.

Output tables

A successful import creates three tables in the database.

[prefix]_ifc_elem — IFC objects

Stores all IFC objects and their attributes. Query this table to retrieve building elements, spatial structure elements, and their properties.

FieldTypeDescription
idserialRow ID.
familytextThe IFC class family of the element, typically IfcBuildingElement or IfcSpatialStructureElement.
project_uuidtextUUID of the root IfcProject node in the IFC file.
project_nametextThe project name set via the project option. Empty if not specified.
parent_uuidtextUUID of the parent element. Set to root for elements of type IfcProject.
uuidtextUUID of the element, matching the UUID in the source IFC file.
nametextName of the element, inherited from the Name attribute of IfcRoot.
attrsjsonbFixed attributes of the element. Extend with additional types and attributes as needed.
props_setjsonbNon-fixed property sets of the element. Corresponds to IfcRelDefinesByProperties.
elementsfmeshThe geometric entity of the element.

[prefix]_ifc_geom_elem — Geometry components

Stores all geometric objects. Query this table to retrieve and analyze the geometry of building components.

FieldTypeDescription
idserialRow ID.
project_uuidtextUUID of the project. Matches project_uuid in the IFC object table.
project_nametextThe project name set via the project option. Empty if not specified.
geometry_idtextThe geometry ID of the element. The value consists of the geometric and material characteristics of the element.
geom_elementsfmeshThe geometry data of the element.

[prefix]_ifc_material_elem — Materials

Stores all material objects. Query this table to look up material definitions associated with building components.

FieldTypeDescription
idserialRow ID.
project_uuidtextUUID of the project. Matches project_uuid in the IFC object table.
project_nametextThe project name set via the project option. Empty if not specified.
material_nametextThe name of the material.
material_elementmaterialThe material data of the element.

Limitations

The following data is not imported:

  • IfcOpeningElement — openings such as door and window cutouts are skipped.

  • Orphan nodes — nodes that cannot be attached to an IfcProject node are skipped.

  • IfcElementType — element type definitions are temporarily skipped.

Examples

Example 1: Import from an OSS bucket without a project name.

SELECT ST_ImportIFC(
  'Building',
  'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_ifc'
);
---------
t

Example 2: Import from an OSS bucket with a project name.

SELECT ST_ImportIFC(
  'Building',
  'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_ifc',
  '{"project":"building_1"}'
);
---------
t

Replace the following placeholders with your actual values:

PlaceholderDescription
<ak>Your Alibaba Cloud AccessKey ID.
<ak_secret>Your Alibaba Cloud AccessKey secret.