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

Visualising OS MasterMap® Topography Layer Building Height Attribute in QGIS

Our recent blog post about visualising OS MasterMap® Topography Layer Building Height Attribute (BHA) data in ArcGIS and ArcGlobe prompted a number of questions about whether it’s possible to do something similar in open source software. In this post we’ll show you how to achieve something similar using QGIS and the freely available Qgis2ThreeJS plugin.

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

  1. Download the following datasets for your area of interest from Digimap using the OS Data Download application:
    1. OS MasterMap® Topography Layer: select the ‘File Geodatabase’ format for your data as this format does not require any conversion to use it in QGIS;
    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, such as OS VectorMap® Local Raster or OS 1:25,000 Scale Colour Raster;
  2. Open QGIS and load in the OS MasterMap® Topography Layer, OS Terrain™ 50 DTM and your backdrop map data.

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, such as ArcGIS, 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. Additionally this same formatting is applied to the File Geodatabase format of MasterMap supplied through Digimap. 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 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 downloaded in File Geodatabase format from Digimap.

Before BHA data can be loaded in to QGIS it is necessary to create a small text file (called filename.csvt, where ‘filename’ is the name of your BHA csv file) that specifies the data type of each field so that QGIS handles it correctly. Specifically the .csvt file is used to ensure that QGIS treats the two TOID  values as text rather than numbers, and all height values as numbers. The steps required are detailed below:

  1. Create a new file called filename.csvt (replacing ‘filename‘ with the name of your BHA csv file) in the same folder as the BHA csv file you wish to import.
  2. Open the file in a text editor such as Notepad or TextPad.
  3. Copy and paste the following text in to the file:
    "String","String","Integer","Date","String","Real","Real","Real","Real","Real","Integer"
  4. Save your changes to the file. Ensure it is saved in the same folder as the CSV file you wish to import.
  5. Add your BHA CSV file to QGIS through the Add Vector Layer function; this will add the data as a table in the QGIS project.

Creating a heighted buildings dataset

In order to create a new heighted buildings dataset from the building features in OS MasterMap Topography Layer and the BHA data we use the GIS ‘join’ function. A join links these two datasets together through a common unique identifier (the TOID) resulting in a set of buildings with height values stored as additional attributes.

  1. Bring up the Layer Properties dialog for the Topographic Area layer in the MasterMap data either by double clicking on the layer in the Layer panel or by right clicking on the layer and selecting Properties from the pop-up menu.
  2. Select the ‘Joins’ tab on the left hand side to display the join panel:
    QGIS Join Window
  3. Press the green plus button to add a new join:
    1. QGIS add vector joinSelect your BHA dataset as the ‘Join Layer’.
    2. Select the correct TOID field that matches the TOIDs in your MasterMap data; as mentioned above we’re using os_topo_toid_digimap as the formatting of this matches the TOIDs supplied in the MasterMap data downloaded from Digimap in File Geodatabase format.
    3. In the ‘Target Field’ select the attribute column that contains the TOIDs in your MasterMap® data; by default this is called ‘TOID’ in MasterMap downloaded from Digimap.
    4. Leave the checkbox selected to ‘cache join layer in virtual memory’ as this will speed up query and display of the data.
    5. Press OK to create the join.
  4. Press OK on the Layer Properties dialog to close the window.
  5. Open the attribute table for the TopographicArea MasterMap layer to verify the join has worked. You will see the additional BHA columns at the end of the attribute table. Note you will see a lot of ‘null’ values in these additional columns as BHA values are only available for ‘building’ features (the TopograhicArea feature class contains features for everything, not just buildings).
  6. Having joined the datasets together, before we can create a heighted buildings dataset we need to select only those buildings which now have height information. This is done using the QGIS ‘Select features using an expression’ button: QGIS select by expression button
  7. QGIS select by expression windowWe are looking to select only features which have a value for the height attribute we wish to use in the 3D visualisation. As mentioned in the previous post, we have found that the ‘RelH2′ attribute provides a good representation of the height of buildings relative to one another. The expression used is shown below. Note the field name, in quotes below, is automatically created by QGIS by adding the BHA table name (NT27) to the attribute column name (RelH2) with an underscore between them:
    "NT27_relh2" IS NOT Null

    QGIS save vector layer

  8. Having selected just the buildings that include height information we can now export these features as a new dataset by right clicking on the TopographicArea dataset in the Layer panel and selecting ‘Save As…’ from the pop-up menu.
  9. Save the dataset as a new Shapefile in a suitable location, selecting the checkboxes ‘save only selected features’ and ‘add saved file to map’.
  10. The newly created heighted buildings dataset will be added to your QGIS project; now it’s time to visualise it in 3D.

Visualising the data in 3D

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 OS Terrain™ 50 DTM to use as the surface heights, 1:25,000 Colour Raster and OS VectorMap® Local Raster to drape over the surface.

Visualising the data in 3D in QGIS is achieved using the Qgis2ThreeJS plugin, which can be installed using the QGIS plugin manager if you don’t have it already. The steps below describe how to use the plugin to create a 3D model:

  1. Ensure you have all the data loaded in to your QGIS project that you wish to include in the 3D model, as a minimum you should have your DTM, the heighted buildings dataset and a suitable map layer to drape over the DTM.
  2. Turn off all layers in the Layers panel apart from the surface you wish to drape over the DTM; the buildings will be styled using the Qgis2ThreeJS plugin.
  3. Launch the plugin, which can be found on the Web toolbar.
  4. Using the ‘DEM’ panel of the plugin select your DTM data as the ‘DEM Layer’, leave all other settings at their default values. Tip: by default the surface has a vertical exaggeration of 1.5, if you wish to reduce or increase this, the setting is configured on the ‘World’ panel of the plugin.
  5. Qgis2ThreeJS plugin windowIn the ‘Polygon’ panel of the plugin select your heighted buildings dataset and complete the following settings:
    1. Z coordinate: set to ‘Height from surface’ – this will ensure the buildings sit on the DTM surface.
    2. Under ‘Style’: ensure the ‘Object type’ is set to ‘Extruded’ and select the height attribute you wish to use for the extrusion using the ‘Height’ drop down; as mentioned above, we’re using the RelH2 attribute from OS which is in the column ‘NT27_relh2′ in our data.
    3. Select suitable colours and transparency, we used a medium grey colour with 10% transparency to give a glasshouse effect.
  6. Optionally specify an ‘Output HTML file path’ to save the resultant files. Whilst you’re experimenting we recommend you leave this blank and the plugin will save the data in a temporary location, when you’re happy with the result you can use this setting to save your final visualisation.
  7. Press ‘Run’ to create the 3D model. Once it’s finished processing the model will open in your default web browser.

The plugin outputs an HTML file, along with a small number of accompanying files. The HTML file requires a WebGL compatible browser (WebGL is a method of generating dynamic 3D graphics using JavaScript), most modern browsers are WebGL compatible including IE 11, FireFox, Chrome, Safari and Opera, the Can I Use site offers further information on browser compatibility.

As the files are output as a web page, you can share the results of your work with colleagues without them needing to have any specialist GIS software, however you are not permitted to make the website publicly available as the html and javaScript files contain map data rather than just images of maps.  The Licence does not permit the sharing of licensed data from Digimap with anyone other than registered users of the service: Digimap Licence

Tips

  • The plugin uses the extents of the current QGIS map canvas, so the bigger the area being displayed, the bigger the generated 3D scene and the slower it will display. We have found that areas of up to 10km² display okay, anything bigger tends to be a little slow to respond.
  • If you wish to define specific extents for your 3D scene instead of using the map canvas extents this can be done on the ‘World’ panel of the plugin.
  • Applying a vertical exaggeration to your buildings is achieved through the ‘Multiplier’ setting on the ‘Polygon’ panel of the plugin.
  • You can create 3D models of multiple layers. For example in the screen shot below the trees were created by selecting the ‘Positioned Non Coniferous Trees’ from the OS MasterMap Topographic Point layer. These were then added to the QGIS project twice. Using the plugin one of these layers was extruded as a brown cylinder with a radius of 0.75m and a height of 3m to form the trunk; the other was extruded as a green sphere with a radius of 4.5m and a z coordinate of 4.5m (i.e. the height above the ground surface of the centre of the sphere) to form the tree canopy:
QGIS 3D visualisation with trees

OS VectorMap® Local Raster draped on top of OS Terrain™ 50, with buildings from OS MasterMap® Topography Layer Building Height Attribute and Positioned Non Coniferous Trees extruded on top

The finished visualisation

The screen grab below shows the final visualisation centred on the south side of Edinburgh using OS 1:25,000 Colour Raster as the surface layer.

3D visualisation

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

Share

Visualising OS MasterMap® Topography Layer Building Height Attribute in ArcGIS and ArcGlobe

In March 2014 Ordnance Survey (OS) published an alpha release of the much anticipated Building Height Attribute (BHA) dataset, which is an enhancement to OS MasterMap Topography Layer. You can read all about it in their blog post. In this blog we’re going to show you how to integrate the BHA dataset with buildings in the OS MasterMap Topography Layer to create a heighted buildings dataset and visualise it in 3D. We used ArcGIS 10.2 and ArcGlobe to do this but other software could be used.

The first alpha release of BHA included buildings covering approximately 8,000km2 of the country. A second alpha release of BHA was published in July 2014 which covers around 10,000km2 of the major towns and cities in Great Britain. OS publish an interactive map which shows the extents of the areas covered by the alpha release, so you can check if your area of interest is included.

A note of caution, 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 subject to update and maintenance. However in time OS intend to include BHA in OS MasterMap Topography Layer so in future it will be supplied and maintained as a part of the Topography Layer.

Attributes supplied by OS

BHA attributesA number of attributes are provided for each building as shown in the image :

  • ground level [AbsHMin]
  • the base of the roof [AbsH2]
  • highest part of the roof [AbsHMax]

Using these three values two additional relative heights are calculated:

  • relative height from ground level to the highest part of the roof [RelHMax]
  • relative height from ground level to base of the roof [RelH2]

Data availability

OS publish the data as a single CSV file containing over 20 million records. This is a very large dataset and can cause data management problems in a desktop environment so EDINA have split the dataset up using the OS 5km grid allowing you to download the data in tiles for your study area. The data is available in CSV and KML formats. To use the data in GIS or CAD packages you should download the data in CSV format; KML is used to visualise the data in Google Earth.

OS 5km gridThe ‘Show Grid/Overlay’ menu on the right hand side in the Data Download application displays the OS 5km grid. This will draw a grid with each square containing the OS 5km tile reference, as shown in the image.

Please note: BHA data is not currently available for the whole country, you should consult the interactive map published by the OS to see if data exists for your area of interest.

Using the data

OS provide an excellent Getting Started Guide which explains in detail the process of getting BHA data in to GIS for subsequent analysis. The main steps are described below but please refer to the Getting Started Guide for full details.

The data is supplied as CSV files. Each record in the file has a unique TOID which can be used to join the data to building features in OS MasterMap Topography Layer.

Getting started
  1. Download OS MasterMap Topography Layer data for your area of interest from Digimap using the OS Data Download application. Select the ‘File Geodatabase’ format for your data as this is a native ArcGIS format and doesn’t require any conversion.
  2. Download BHA data for your area of interest from Digimap using the OS Data Download application (BHA data is found in the ‘OS MasterMap’ group), selecting CSV format.
  3. Open the OS MasterMap Topography Layer data in ArcGIS.
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 have a unique identifier called a Topographic Identifier, or TOID for short. TOIDs supplied by Ordnance Survey take the format of a 13 or 16 digit number prefixed with ‘osgb’ e.g. ‘osgb1000039581300′ or ‘osgb1000002489201973′. ArcGIS automatically strips off the ‘osgb’ prefix and adds 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 ArcGIS
  • os_topo_toid is the original TOID as supplied by Ordnance Survey (this should be used in other GIS packages such as QGIS which do not modify the TOIDs in MasterMap Topography Layer)

Before BHA data can be loaded in to ArcGIS it is necessary to create a small text file (called schema.ini) that specifies the data type of each field so that ArcGIS handles it correctly. Specifically the schema.ini file is used to ensure that ArcGIS treats the two TOID  values as text rather than numbers. The steps required are detailed below:

  1. Create a new file called schema.ini in the same folder as the BHA csv file you wish to import.
  2. Open the file in a text editor such as Notepad or Text pad.
  3. Copy and paste the following text in to the file:
    [bha_filename.csv]
    Format=CSVDelimited
    ColNameHeader=True
    Col1=OS_TOPO_TOID_DIGIMAP Text
    Col2=OS_TOPO_TOID Text
    Col3=OS_TOPO_VERSION Long
    Col4=BHA_ProcessDate DateTime
    Col5=TileRef Text
    Col6=AbsHMin Double
    Col7=AbsH2 Double
    Col8=AbsHMax Double
    Col9=RelH2 Double
    Col10=RelHmax Double
    Col11=BHA_Conf Long
  4. The first section of code, in square brackets shown in red above, refers to the name of the csv file you wish to import. You should modify this filename so that it references your BHA csv file.
  5. Save your changes to the file. Ensure it is called schema.ini and is saved in the same folder as the csv file you with to import.
  6. Add your BHA csv file to ArcGIS through the Add Data function; this will add the data as a table in the map document.
Creating a heighted buildings dataset

ArcGIS JOIN windowIn order to create a new heighted buildings dataset from the building features in OS MasterMap Topography Layer and the BHA data we use the GIS ‘join’ function. A join links these two datasets together through a common unique identifier (the TOID) resulting in a set of buildings with height values stored as additional attributes.

  1. Right click on the Topographic Area layer in the table of contents > Joins and Relates > Join. This will bring up the Join Data window which can be completed as shown. Remember to join to the TOID in the csv file that is formatted to match the TOIDs displayed in ArcGIS (os_topo_toid_digimap).
    Tip: to create a dataset which just includes the heighted buildings select ‘Keep only matching records’.
  2. Having joined the datasets together we can then export the result as a new Feature Class in our File Geodatabase for subsequent use and analysis. This is done by right clicking on the Topographic Area layer in the table of contents > Data > Export Data…  give your new dataset a suitable name and select your existing File Geodatabase as the destination.
Visualising the result in ArcGlobe

So far we have downloaded data from 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. Now the fun begins!

We can easily visualise the heighted buildings dataset in 3D using ArcGlobe or ArcScene. The following steps describe how to import the data in to ArcGlobe.

  1. Download the OS Terrain 50 DTM for your area of interest from Digimap using the OS Data Download application. This will be used as the base (ground) heights for the area to provide a more accurate terrain model than is available by default in ArcGlobe.
  2. Open ArcGlobe and add in the DTM. You will be asked if you wish to use the DTM as and ‘image source’ or an ‘elevation source’. You should select the ‘elevation source’ option:

ArcGlobe add DEM window

  1. The Geographic Coordinate Systems Warning dialog will appear as OS MasterMap Topography Layer data is in a different coordinate system (British National Grid) from that used by ArcGlobe (WGS 84):

ArcGlobe Geographic Coordinate Systems Warning

  1. You should specify the transformation used to ensure that the data is accurately positioned on the globe. Using the Transformations… button you should specify the ‘OSGB_1936_To_WGS_1984_Petroleum’ transformation:

ArcGlobe Geographic Coordinate System Transformation

  1. Adding your heighted building dataset from your File Geodatabase is achieved through the Add Data button. Once added you may need to zoom to the layer to view it: right click on the layer in the table of contents > Zoom To Layer.
  2. By default the data is not extruded vertically so appears flat on the earth’s surface. To visualise the buildings in 3D right click on the layer in the table of contents and select Properties and then click on the Globe Extrusion tab.
  3. Select the ‘Extrude features in layer’ checkbox and then in the ‘extrusion value or expression’ box enter the following:
[relh2] * 1.5

ArcGlobe layer properties

This will extrude the buildings using the RelH2 attribute with a vertical exaggeration of 1.5 times (i.e. buildings will be shown 1.5 times their actual height). We found using RelH2 (the relative height from ground level to base of the roof) provides a more useful visualisation over RelHMax (the relative height from ground level to the highest part of the roof) which can lead to some overly tall looking buildings where they include towers that extend significantly beyond the height of the rest of the roof.

The end result

The image below shows an area of Edinburgh including Edinburgh Castle with Arthurs’ Seat in the background. Aerial imagery from ArcGlobe is draped over OS Terrain 50 data for the region with heighted buildings drawn on top. Using the tools in ArcGlobe it is easy to explore the landscape, navigating across the surface and examining the relationships between buildings in the built environment.

BHA data in ArcGlobe

Further information

OS published Release Notes for the alpha releases of BHA. Additional information can be found in Annexe D of the OS MasterMap Topography Layer User Guide and Annexe E of the OS MasterMap Topography Layer Technical Specification.

 

Share