This article outlines the step-by-step process of converting a 2D rooftop polygonal layer to 3DML. This method has two main advantages over extending 2D polygons to the ground option - it offers better streaming speed and performance, in TerraExplorer Desktop and particularly in TerraExplorer for Web, and it includes illumination that enhances the 3D effect.
In the workflow described below, the 2D polygonal layer is converted to Cesium 3D Tiles using Safe FME Workbench v2020.2. The 3D Tiles layer is then loaded into TerraExplorer, where it is converted to 3DML using the Mesh Converter tool. If the 2D polygon layer has attribute data, it can also be used in TerraExplorer to classify the 3DML. This enables you to visually distinguish different areas of the mesh layer, access the attribute data of the classification features and perform spatial and attribute queries on the polygon feature layer that is classifying the mesh layer. The classification is dynamic, reflecting any changes to the polygon features, and requires no pre-processing.
In this article:
- Step 1: Convert the 2D polygons to Cesium 3D Tiles using FME
- Step 2: Convert the Cesium 3D Tiles to 3DML using TerraExplorer's SLMeshConverter.exe tool
2D Polygons Extended to the Ground vs. 3DML
Step 1: Convert the 2D polygons to Cesium 3D Tiles using Feature Manipulation Engine (FME)
Getting Started:
This article requires basic knowledge of working with FME.
- Install the FME Workbench latest version from the Safe Software website. A software license is required.
- Download FME Reprojection Grid Files. These files contain vertical datum and additional reprojection options for FME Desktop. Follow the instructions to install it under your C:\Program Files\FME\Reproject installation folder.
- Download the FME workbench projects and the WGS84_egm.txt file attached at the end of this article.
- Download the sample data for this article.
- Configure the FME project:
a. Open the project in FME Desktop.
b. Disconnect the sample ESRI Reader input shapefile from the 3DForcer transformer.
c. Add a new ESRI Reader and load your 2D rooftops' polygonal layer.
d. Connect your input to the 3DForcer transformer.
e. Set the output directory.
Example 1:
This example demonstrates how to convert a WGS84 EPSG:4326 projection 2D polygonal shapefile with absolute Z only for the roofs' height. The layer has no information about the buildings' absolute or true altitude.
- Follow the Getting Started steps to open 'Example 1 - WGS84 projection with roofs z values only.fmw' FME project and to connect your input layer to the project.
- The 3DForcer transformation turns 2D data into 3D data in case the input has no Z value.
- The CsMapReprojector transformer fakes the source coordinate system by declaring it as Ellipsoidal 3D Coordinate system - EPSG:4979 and reprojecting it to EPSG:4326 with EGM96 vertical datum.
- The CoordinateExtractor transformer extracts the Z value from the layer's geometry.
- The Extruder transformer extrudes the buildings based on the geometry Z value. The buildings will be extruded from the height of the roof to 0 meters absolute height.
- Use the AppearanceSetter transformer to set the Diffuse Color.
- Run the project to convert the 2D polygons to Cesium 3D Tiles.
Example 2:
This example demonstrates how to convert a local projection 2D polygonal shapefile without Z value, using the absolute roofs' height from the attribute table.
- Follow the Getting Started steps to open the 'Example 2 - Local Projection absolute roof values from attribute table.fmw' FME project and to connect your input layer to the project.
- The Reprojector transformer reprojects the local projection layer to EPSG:4326.
- The 3DForcer transformer turns 2D data into 3D data in case the input has no Z value.
- The CsMapReprojector transformer fakes the source coordinate system by declaring it as Ellipsoidal 3D Coordinate system - EPSG:4979 and reprojecting it to EPSG:4326 with EGM96 vertical datum.
- The Extruder transformer extrudes the buildings based on the attribute table's absolute roofs height. The buildings will be extruded from the height of the roof to 0 meters absolute height.
- Use the AppearanceSetter transformer to set the Diffuse Color.
- Run the project to convert the 2D polygons to Cesium 3D Tiles.
Step 2: Convert the Cesium 3D Tiles to 3DML using TerraExplorer's SLMeshConverter.exe tool
- Open File Explorer, and browse to your TerraExplorer installation folder.
- Click the Start button , type "cmd", and then select Command Prompt from the list.
- In the command prompt window, type the following to convert the Cesium 3D Tiles to 3DML:
"C:\Program Files\Skyline\TerraExplorer Pro\SLMeshConverter.exe" -cmd convert -f 3dml -acr 1 -in "[input_source_path]\tileset.json" -out "[output_source_path]\[3DML_name].3dml" -wktout “[projection_file_path]\WGS84_egm.txt" -vdat convert_z
Where:
[input_source_path] = Path of the 3D Tiles created by FME
[output_source_path] = Output path for the 3DML
[3DML_name] = Name of the created 3DML
[projection_file_path] = Path of the WGS84_egm.txt file
For Example:
"C:\Program Files\Skyline\TerraExplorer Pro\SLMeshConverter.exe" -cmd convert -f 3dml -acr 1 -in "C:\MyData\tileset.json" -out "C:\MyData\Out\My3DML.3dml" -wktout “C:\MyData\WGS84_egm.txt" -vdat convert_z - Once finished, load the 3DML into your TerraExplorer Desktop project.
- Open the layer's properties sheet, and set:
- Replace Terrain With = No.
-
Max Visibility Distance - Increase from 30,000 to 300,000,000
- Use the 2D polygonal layer as a classification layer and add a tooltip or attributes popup message. For an angular roof polygonal layer, it is recommended to set the Ignore Geometry Z Value to Yes.