2D to Simple 3D Model: Extrude Building Outlines

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.2


Extrude 2D CAD building outlines to create a simple 3D model. The results can be displayed in Google Earth after writing to KML. This illustrates a typical approach for making a basic 3D city model. The source is building_outlines.dwg, a CAD dataset of building footprints. First, the building height information is merged into the DWG, then this value is used to extrude the footprints into 3D buildings. Finally, the buildings are reprojected to the LL84 coordinate system so that they can be written to KML.



Learn how to quickly extrude 2D CAD building outlines to 3D. We'll use AutoCAD DWG data with height information from a CSV table as the source, merge the data, extrude to 3D, then write out to Google Earth KML.


Source Data

CAD (DWG) building outlines


building_outlines.dwg displayed in FME Data Inspector


Step-By-Step Instructions

1. Read Data
Read in the building outline geometries from the building_outlines.dwg AutoCAD source file found in the Files section with the DWG/DXF reader. In the reader Parameters, set the Group Entities By to Attribute Schema  to expose extended entity data of the DWG file.


Next, read in the outline_heights.csv using a CSV reader for the height attribute information. In the Parameters, change the Attribute Definition to Manual, and change the mean_height attribute Type to real64. Both data sets share an attribute that stores an identifier for every building. We will use this information to join the height of the buildings with their outlines.


2. Join Data Sets: FeatureMerger
Use a FeatureMerger to join the building outline geometries to the CSV reader containing heights for each building. To preserve the geometry of the building outlines, the building outlines (DWG) are connected as the Requestor and the outline heights (CSV) as the Supplier. 


In the parameters, the attribute to join on is a unique identifier of the outlines called outline_id. In the Merge Parameters, set Feature Merge Type: to Attributes Only, since the DWG outlines will be receiving the mean height attributes from the CSV. The result is a mean height attribute on each footprint feature. 


3. Extruding Building Outlines
Extrusion is defined as the extension of an object by an additional dimension. The 2D outline polygons become 3D solids based on the height values of the building. Add an Extruder and connect it to the Merged output port on the FeatureMerger. In the parameters, set the Direction to Vertical, then set Distance to the attribute, mean_height.


4. Reproject: CsmapReprojector
To write data to a KML file, it needs to have a coordinate system. The KML writer will automatically reproject features to LL84 if they are tagged with a coordinate system. If there is no coordinate system set, it is necessary to set it and reproject the data manually.
In our case, we know our source data’s coordinate system: UTM83-10. Add a CsmapReprojector, then in the parameters, set the Source Coordinate System to UTM83-10, the Destination Coordinate System to LL84, and the Transformation to <Auto>. It is fine to leave the rest as default settings.


Note: Alternatively, we could have set the Coordinate Systems of each source dataset in the reader parameters. Then, we wouldn’t require the CsmapReprojector since the KML Writer would handle the reprojection.
5. Write KML
Add the OGC Google KML writer to your workspace. Specify the file path and name for the output, and make sure that the 'Feature Type Definition' is set to 'Copy from Reader' to copy from the initial Outlines ACAD reader. Connect the output of the CsmapReprojector to it, and run the workspace. Open the output folder containing the new KML dataset, then double-click on the KML output to view it in Google Earth.
Completed Workspace:



Output displayed in Google Earth


Additional Resources


Data Attribution

The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.


Was this article helpful?



Please sign in to leave a comment.