LuciadFusion can handle Building Information Modeling (BIM) data as two separate services:
-
An OGC3DTILES service containing the geometry
-
A WFS service containing the feature information
LuciadFusion supports multiple data formats that represent BIM data, like Binz, IFC, or Revit. This tutorial shows you how to visualize and handle these services in LuciadRIA.
See the LuciadFusion documentation for information about setting up the two services. |
Visualizing the BIM geometry information
The geometry is served as an OGC3DTILES service. You must load it as such:
-
Find the endpoint URL of the service.
-
Create an
OGC3DTilesModel
. -
Create a
Tileset3DLayer
.-
You must specify the
idProperty
, because we need that property to handle selection. See Program: Register a selection listener. -
You can pass other options to the layer constructor. See the
TileSet3DLayer
documentation for more information.
-
-
Add the layer to the map.
TileSet3DLayer
const tilesetUrl = "https://fusionurl/ogc/3dtiles/dataset/tileset.json";
const model: OGC3DTilesModel = await OGC3DTilesModel.create(tilesetUrl);
const ogc3dTilesLayer = new TileSet3DLayer(model, {
idProperty: "FeatureID",
selectable: true
});
map.layerTree.addChild(ogc3dTilesLayer);
You can register a selection handler with the Map
to detect when a user clicks in the view, and find the FeatureID of the object clicked by the user.
map.on("SelectionChanged", () => {
const selectedObjects = map.selectedObjects;
if (selectedObjects.length === 1 && selectedObjects[0].selected.length === 1) {
const feature = selectedObjects[0].selected[0] as Feature;
const featureID = feature.properties["FeatureID"];
}
});
Visualizing the BIM feature information
The feature information is served as a WFS service. You can query it using a WFSFeatureStore
object.
To create such an object, follow these steps:
-
Find the endpoint URL of the service.
-
Create a
WFSCapabilities
object. -
Find the feature type name. Program: Create a
WFSFeatureStore
assumes that there is only one feature type. -
Create the feature store.
WFSFeatureStore
const featuresUrl = "https://fusionurl/ogc/wfs/dataset_features";
const wfsCapabilities = await WFSCapabilities.fromURL(featuresUrl);
const typeName = wfsCapabilities.featureTypes[0].name;
const featureStore = WFSFeatureStore.createFromCapabilities(wfsCapabilities, typeName, {outputFormat: "json"});
You can use the WFSFeatureStore
to perform queries on the WFS service.
We highlight two use cases as examples: Requesting all FeatureIDs of the dataset and Requesting all information of a given FeatureID.
For more information about writing queries for a WFS service, see the WFSFeatureStore.query()
documentation.
Requesting all FeatureIDs of the dataset
const cursor: Cursor = await Promise.resolve(featureStore.query({propertyNames: ["FeatureID"]}));
while (cursor.hasNext()) {
const feature: Feature = cursor.next();
const featureId = Number.parseInt(feature.id as string);
// ...
// note: feature.properties will have all null values
}
Requesting all information of a given FeatureID
const cursor: Cursor = await Promise.resolve(featureStore.query({filter: identifiers([featureID])}));
while (cursor.hasNext()) {
const feature: Feature = cursor.next();
const featureProps = feature.properties;
// ...
}
Apart from the feature data that was present in the BIM data, the returned data also contains the bounding box of the requested feature. This snippet illustrates how to use that in your LuciadRIA application to fit the view to a given feature.
const shape: Shape = createExtrudedShape(
feature.geometry.reference,
feature.geometry,
feature.properties.MinZ,
feature.properties.MaxZ);
map.mapNavigator.fit({bounds: shape.bounds!, animate: true});
Note that you can’t use the feature.geometry
directly:
because the GeoJSON geometry only contains 2D data, you must re-construct the 3D bounding box using the feature’s MinZ
and MaxZ
properties.