Visualising OS MasterMap® Topography Layer Building Height Attribute in AutoCAD Map 3D and InfraWorks

We’ve recently written blogs on visualising OS MasterMap® Topography Layer Building Height Attribute (BHA) data in ESRI’s ArcGIS and ArcGlobe and also QGIS. These blogs have proved very popular so we have written a 3rd instalment on how to achieve similar results using Autodesk products using AutoCAD Map3D and InfraWorks.

Please see the previous post for information on BHA data coverage, an explanation of the different height attributes supplied by Ordnance Survey (OS) and for details of further information sources; including the excellent Getting Started Guide produced by OS. Please remember this is an alpha release of the data and OS do not guarantee that BHA is error free or accurate. Additionally the dataset is not yet subject to update and maintenance.

Getting Started

Download the following datasets for your area of interest from Digimap using the OS Data Download application:

  1. OS MasterMap® Topography Layer: select ‘GML’ as the format for your data rather than ‘DWG’ as we need to get to some of the raw data values stored in the GML file, and limit your download to just the Buildings using the Layers drop-down in the basket.
  2. OS Terrainâ„¢ 50 DTM: this will be used as the base (surface) heights for the area;
  3. BHA data (BHA data is found in the ‘OS MasterMap’ group): select CSV as the format;
  4. Optionally download any additional data you may wish to use as a backdrop draped over the DTM surface, in this example we’re going to use OS MasterMap® 1:2,000 Raster but other datasets could be used.

Preparing BHA data for use

If your downloaded BHA data is made up of more than one CSV file we recommend merging them all together in to a single CSV file first to make subsequent processing easier and quicker. Use a text editor such as Notepad or TextPad rather than Excel, as Excel can change the formatting of numbers which contain leading zeros.

Each object in MasterMap Topography Layer has a unique identifier called a Topographic Identifier, or TOID for short. TOIDs supplied by OS take the format of a 13 or 16 digit number prefixed with ‘osgb’ e.g. ‘osgb1000039581300′ or ‘osgb1000002489201973′. Some applications, including AutoCAD Map 3D , automatically strip off the ‘osgb’ prefix and add three leading zeros to any TOID that has only 13 digits to make them all 16 characters long. In order to make it easier to join BHA data to building features in MasterMap® Topography Layer the BHA files supplied by EDINA have two TOID values:

  • os_topo_toid_digimap is the TOID formatted to match TOIDs in AutoCAD Map 3D, ArcGIS and in the File Geodatabase format supplied through Digimap.
  • os_topo_toid is the original TOID as supplied by Ordnance Survey

You should check the TOID values in your MasterMap data and those in the BHA data to ensure that there is a common field that you can use to match on; we will use os_topo_toid_digimap as this field in the BHA data matches the TOID values in the MasterMap data when used in AutoCAD Map 3D.

Open the merged CSV file in Excel. To ensure that the data is displayed correctly in Excel you should import the data as follows:

  1. Open a blank Excel document then use the ‘From Text’ option which can be found on the Data ribbon.  This allows you to specify the correct field delimiter and data types for the TOID columns, ensuring they are imported as text fields, show image.
  2. Import the data as a ‘delimited’ file, show image.
  3. Specify ‘Comma’ as your delimiter, show image.
  4. On the Text Import Wizard – Step 3 of 3 window select the first column in the ‘Data Preview’ section and set the ‘Column data format’ to ‘Text’. Repeat this step for the second column. This ensures that Excel treats the two TOID columns as text rather than numbers so doesn’t strip off the leading zero’s from any of the values (which are needed when joining the data to the building features in MasterMap later on), show image.
  5. Press Finish to complete the process, after which your data in Excel should look like the image below with the TOID values in the first column all 16 characters long and including three leading zero characters where necessary:Excel showing TOID values imported as text
  6. AutoCAD Map 3D requires a ‘named range’ of cells to connect to. To create this highlight/select all cells that contain data in the workbook and using the ‘Name Box’ give this selection of cells a name. In the screen grab below we have called the selection ‘BuildingHeightValues’ (note your name cannot include spaces):
    Excel named range
  7. Save your file as an .xslx file.
  8. The next step is to use the Windows ODBC Data Source Administrator to create a connection that points to this .xlsx file. Open the ODBC Data Source Administrator, the easiest way of doing this is to use the Windows search tool to search for ‘ODBC Data Source’.
    ODBC Data Connection Administrator
  9. On the ‘User DSN’ tab press the ‘Add…’ button to create a new ODBC connection:
    Add ODBC Connection
  10. Select ‘Microsoft Excel Driver’ and press the Finish button.
  11. Give your connection a name in the ‘Data Source Name’ field, and using the ‘Select Workbook…’ button browse and select the .xlsx file created above.
    ODBC Select File
  12. Press OK and the newly created User DSN will be listed:
    ODBC Data Source Administrator
  13. Press OK to close the ODBC Data Source Administrator.

Preparing MasterMap Topography Layer GML data for use

  1. Open AutoCAD Map 3D.
  2. At the command prompt type: MAPIMPORT, or select ‘Map Import’ from the Insert menu.
    AutoCAD Map 3D Map Import
  3. Browse to the .gz file downloaded from Digimap, ensure the ‘Files of type’ drop-down is set to ‘OS (GB) Mastermap (*.gml, *.xml, *.gz)’.
    AutoCAD Map 3D Browse
  4. Import just the TopographicArea layer by deselecting all other layers in the import dialog.
    AutoCAD Map 3D Import
  5. Click on the word <None> in the Data Column for the TopographicArea layer.
  6. In the Attribute Data window select ‘Create object data’ and press OK.
    AutoCAD Map 3D Attribute Data
  7. Select ‘Import polygons as closed polylines’ and press OK.
    AutoCAD Map 3D Closed Polylines
  8. The data will be imported in to your current map window. Note you may need to select View > Extents to see the data.
  9. The data needs to be converted to an .sdf file to allow the Building Height Attribute data to be joined to it.
    1. At the command prompt type: MAPEXPORT
    2. Select ‘Autodesk SDF (*.sdf)’ as the file type.
    3. On the Feature Class tab, click on the ‘Select Attributes…’ button.
    4. In the Select Attributes window select ‘Object Data’ and press OK.
      AutoCAD Map 3D Select Attributes
    5. On the Map Export window press OK to export the data.
  10. Connect to the .sdf file just created:
    1. In the Task Pane select Data > Connect to Data…
      AutoCAD Map 3D Connect To Data
    2. Select ‘Add SDF Connection’.
      AutoCAD Map 3D Add SDF Connection
    3. Give your connection a name and browse to the .sdf file exported in the previous step.
    4. Click the Connect button to establish the connection.
    5. Press the ‘Add to Map’ button to add this data to your current map window.
      AutoCAD Map 3D Add to map

You have now added MasterMap buildings to your current map window, the next step is to connect to the Building Height Attribute (Excel spreadsheet) and join it to the building features in MasterMap.

Joining Building Height Attribute to buildings in MasterMap

  1. Connect to the BHA spreadsheet using the ODBC connection:
    1. In the Task Pane select Data > Connect to Data…
    2. Select ‘Add ODBC Connection’
    3. Give your connection a name and select the Data Source Name created above using the ‘…’ button next to the ‘Source’ field.
      AutoCAD Map 3D select DNS
    4. Press the ‘Test Connection’ button.
      AutoCAD Map 3D create ODBC connection
    5. The table in the bottom half of the window will display all named ranges in your spreadsheet, we called our named range ‘BuildingHeightValues’. Before you can select this range for use in AutoCAD Map 3D you need to select a column to use as the ‘Identify Property’. To do this click on the text that says ‘<Click to select>’.
      AutoCAD Map 3D create ODBC connection
    6. In the drop-down that appears put a tick in the box next to the value ‘os_topo_toid_digimap’.
      AutoCAD Map 3D create ODBC connection
    7. Now you can tick the box next to the named range in the spreadsheet and press the ‘Connect’ button.
      AutoCAD Map 3D create ODBC connection
    8. The connection details will be displayed.
      AutoCAD Map 3D create ODBC connection
    9. The Data Connection window can now be closed.
  2. In the Task Pane right click on the MasterMap data and select ‘Create a Join…’
    AutoCAD Map 3D create a join
  3. Join detailsIn the ‘Create a Join’ window:
    1. select the building height data (in the Excel spreadsheet) as the ‘Table (or feature class) to join to’;
    2. select ‘TOID’ in the left hand drop-down menu;
    3. select ‘os_topo_toid_digimap’ in the right hand drop-down menu;
    4. select ‘Keep only left-side records with a match’ in the ‘Type of Join’ section;
    5. press ‘OK’ to create the join.
  4. To verify that the Join has worked, open the data table for the MasterMap data, this is done in the Task Pane by selecting the MasterMap data then pressing the ‘Table’ button. The table will be displayed, scroll to the right to see the joined building height values:
    AutoCAD Map 3D attribute table
  5. The final step is to export the joined data as a new .sdf file which we can then visualise in 3D in InfraWorks. This is done by either right clicking on the MasterMap layer in the Task Pane and selecting ‘Export Layer Data to SDF…’ or by using the ‘Export to SDF’ function on the ‘Vector Layer’ ribbon in the ‘Save’ group.

Visualising the data in 3D using Autodesk InfraWorks

So far we have downloaded OS MasterMap® Topography Layer and BHA data for the same area and joined the two together to create a new dataset containing just the building features which now include the various height attributes published by OS. We also downloaded additional data to use as a backdrop draped over the DTM surface, in this example we will use OS MasterMap® 1:2,000 Raster, but OS VectorMap® Local Raster or OS 1:25,000 Scale Colour Raster would also be suitable depending on the scale of your study area.

Visualising the data in 3D is achieved using Autodesk’s InfraWorks product . The steps below describe how to use the application to create a 3D model:

  1. Open InfraWorks and create a new model.
  2. Specify a location to save the model and give it a name:
    InfraWorks New Model
  3. Click and drag the OS Terrain 50 DTM in to InfraWorks; the file to drag is the one with the .asc extension.
  4. In the Data Source Configuration window, ensure the Type is set to ‘Terrain’ and Coordinate System is set to ‘BritishNatGrid’:
    InfraWorks Data Source DTM
  5. Press the ‘Close & Refresh’ button; the DTM should be displayed:
    InfraWorks showing DTM only
  6. Click and drag the final .sdf file created in the final step of the previous section which contains the heighted building data (i.e. the .sdf file created after joining the MasterMap buildings to the Building Height Attribute data spreadsheet).
  7. In the Data Source Configuration window, set the ‘Type’ drop-down to ‘Buildings’ and select a suitable ‘Roof Height’ attribute using the drop-down on the Common tab. As with previous blogs we have used the RelH2 attribute as we found this gave the best overall representation of building heights relative to each other:
    Data source configuration
  8. On the ‘Geo Location’ tab select ‘BritishNatGrid’ as the coordinate system:
    Data source configuration
  9. On the Source tab select ‘Drape’ from the drop-down under the ‘Draping Options’:
    Data source configuration
  10. Press the ‘Close & Refresh’ button, the buildings should now be displayed on top of the DTM, you may need to pan or zoom to view the data:

    InfraWorks with 3d buildings draped over OS Terrain50

    OS Terrain™ 50 with buildings from OS MasterMap® Topography Layer extruded on top using Building Height Attribute data.

  11. To give some more context to the visualisation you can drape additional raster layers on top of the DTM such as OS MasterMap® 1:2,000 Raster. This is done by selecting all the raster files and dragging them in to the InfraWorks window.
  12. In the Data Source Configuration window ensure ‘Type’ is set to ‘Ground Imagery’, and one the ‘Geo Location’ tab select the ‘BritishNatGrid’ Coordinate System:
  13. Select the ‘Close & Refresh’ button and the map data will be draped over the DTM surface:

    Infraworks with Terrain50 DTM, MasterMap 1:2,500 Raster and Heighted Buidlings

    OS MasterMap® 1:2,000 Raster draped on top of OS Terrain™ 50, with buildings from OS MasterMap® Topography Layer extruded on top using Building Height Attribute data.

The finished visualisation

The screen grab below shows the final visualisation centred on Biggar using OS MasterMap® 1:2,000 Raster as the surface layer.

InfraWorks visualisation

OS MasterMap® 1:2,000 Raster draped on top of OS Terrain™ 50, with buildings from OS MasterMap® Topography Layer extruded on top using Building Height Attribute data.

Share

Comments are closed.