This article explains how to convert Binz data to GeoJSON. By converting Binz data to GeoJSON, you can preserve the metadata inside the Binz data.
Why do it?
If you want to visualize a Binz dataset, you can convert it to OCG 3D Tiles, as explained in the Converting Binz data to OGC 3D Tiles tutorial. The OGC 3D Tiles conversion process converts only the Binz geometry, not the metadata inside the Binz data. It stores only a unique identifier, called FeatureID, inside the OGC 3D Tiles data for each item. To prevent the loss of the metadata defined inside the Binz data, you must also convert it in another way.
To associate the OGC 3D Tiles data with the metadata inside the Binz data, you must convert the so-called Feature data model. This model contains the metadata defined in the Binz data. You can convert it to the GeoJSON format. This conversion maintains the metadata stored inside the Binz dataset, together with the bounding box of each item. The FeatureID stored inside the OGC 3D Tiles data is also present as an identifier in the GeoJSON data.
|
LuciadFusion can natively serve the metadata of Binz data as a WFS service. For that use case, you don’t need a manual conversion to GeoJSON. You can query the WFS service to retrieve the properties for a list of FeatureIDs. You can also query the WFS for items based on property values. This way, it’s possible to link the FeatureID contained in the OGC 3D Tiles with the original metadata inside the Binz data. Check the LuciadFusion Serving BIM data article for more information on how to serve the Binz data as a WFS service. |
To convert the Binz data to GeoJSON, you have two options: you can perform the conversion programmatically, or you can run the Binz data conversion script from the command line.
Converting Binz data to GeoJSON in your code
To convert Binz data to GeoJSON, you must first decode the features model. This model contains the metadata of the individual elements in the Binz data, such as doors and walls. A bounding box is also available, but not the full geometry.
To convert Binz data to GeoJSON:
-
Decode the Binz data into a features
ILcdModelusing theTLcdBinzModelDecoder.ILcdModelDecoder decoder = new TLcdBinzModelDecoder(); ILcdModel model = decoder.decodeSource(new TLcdBIMDataSource(sourceName, TLcdBIMDataSource.Type.FEATURES)); -
Encode the features model to GeoJSON using a
TLcdGeoJsonModelEncoder:TLcdGeoJsonModelEncoder encoder = new TLcdGeoJsonModelEncoder(); encoder.export(model, destinationFile);
The resulting GeoJSON dataset is written to the given destinationFile file.
Converting Binz data to GeoJSON from the command line
To convert Binz data to GeoJSON, you use the same command line script as for converting the Binz data to OGC 3D Tiles.
Make sure to pass the -g option on the command line to generate the GeoJSON output.
For example:
bim.converter.sh -g -i /data/Formats/Binz/someBinzFile.binz -o /project/3dtilesoutput