Loading data into a GIS

The Building Height Attribute product can be loaded into several geographic information systems (GIS). This section describes how to load it into commonly used GIS. For more information on other GIS that the Building Height Attribute product is compatible with, please speak to your OS Technical Relationship Consultant.

The format of the TOIDs in your .csv may have an impact on how you import the .csv into a GIS. If you have not had to alter the TOID format, GIS software should read the OS_TOPO_TOID column in the .csv file as a text string automatically, which should match your OS MasterMap Topography Layer TOIDs.

Therefore, you do not have to carry out any extra steps when importing your .csv file into a GIS, so you may wish to move on to the next section.

However, if you have had to alter the OS_TOPO_TOID in the Building Height Attribute .csv by removing the ‘osgb’, this attribute may be read as a number by a GIS; this will mean that any leading zeroes added will be deleted and the TOID field in the .csv will be incompatible with the TOID field in the OS MasterMap Topography Layer data which is formatted as a text string. We have outlined some steps which will allow the user to specify the field types for .csv files being imported to some GIS environments. The processes described in the following blocks will work with individual or merged versions of the .csv data.

ArcMap

These notes outline how to load Building Height Attribute data into ArcMap using the .csv file you have received and/or altered. The notes have been prepared using version 10.5 of ArcMap. The instructions will also work for ArcPro and version 10.6.1 of ArcMap.

If you are importing an unmodified version of the .csv file, then you can import this directly into ArcMap via the Add Data button.

If you are importing a .csv with an altered OS_TOPO_TOID attribute, you will need to carry out the steps detailed below before importing.

You can create a schema information file which describes the format of the fields contained within a text file. A schema information file is always named ‘schema.ini’ and is stored within the same directory as the .csv you wish to import into ArcMap.

  1. Open a new text editor document and copy the following script into it: [_BHA_Data.csv]

Format=CSVDelimited ColNameHeader=True Col1=OS_TOPO_TOID Text Col2=OS_TOPO_VERSION Long
Col3=BHA_ProcessDate DateTime Col4=TileRef Text
Col5=AbsHMin Double Col6=AbsH2 Double Col7=AbsHMax Double Col8=RelH2 Double Col9=RelHmax Double Col10=BHA_Conf Long

Note: The section of code within the square brackets refers to the file name of the .csv you wish to import. Please alter this line to reflect the file name of your .csv.

  1. Save this in the same directory as the .csv you wish to import into ArcMap, naming it schema.ini.

This file will now be read by ArcMap when you import the .csv file into it and will specify the field type for each field within the .csv file. This ensures that the TOID is treated as a text string.

QGIS

These notes outline how to load Building Height Attribute data into QGIS using the .csv file you have received and/or altered. The notes have been prepared using version 2.14.15 of QGIS Desktop. The instructions will also work for version 3.16 of QGIS.

If you are importing an unaltered .csv file which contains TOIDs in the format they are found in the raw GML, then you can import this file via the Add Delimited Text Layer icon. If you wish to import this .csv file via the Add Vector Layer option, you will have to create a .csvt file as outlined below or all the fields will be imported as ‘String’.

If you are importing a modified version of the .csv file, you must create a .csvt file or the TOID field may be imported as a number.

A .csvt file is the equivalent of a schema.ini file for use in QGIS. It specifies the field types of a text file you are importing into QGIS.

It must be named the same as the .csv file it is referring to and be stored in the same directory as the .csv file you wish to import into QGIS.

  1. Please open a new text editor document and copy the following script into it: "String","Integer","Date","String","Real","Real","Real","Real","Real","Integer"

  2. Save this in the same directory as the .csv file you wish to import into QGIS with the same file name as the .csv file and with the file extension .csvt.

  3. You can now import the .csv file into QGIS by selecting the Add Vector Layer or Add Delimited Text Layer options in QGIS; this file will now be read by QGIS during the import process and will specify the field type for each field within the .csv file.

MapInfo

These notes outline how to load Building Height Attribute data into MapInfo using the .csv file you have received and/or altered. The notes have been prepared using version 16.0.0 of MapInfo (64-bit version).

How you have altered the TOID field in the .csv file will affect the methodology employed when importing the .csv file into MapInfo. If you have retained the raw GML TOID format or added leading zeroes into your TOID field, then MapInfo will automatically pick this up as a character field, so it can be added to MapInfo in the following process:

  1. Launch MapInfo.

  2. Navigate to the Open dialog box either by using the icon or by clicking File > Open.

  3. Select Comma Delimited CSV (*.csv) from the Files of type drop-down, then navigate to where the .csv file is stored.

  4. Select the .csv file you wish to open and click Open.

  5. The Open dialog box will close, and a Comma Delimited CSV Information dialog box will appear. Ensure the Use first line for column titles check box is ticked, then click OK to close the dialog box and open the .csv file.

The TOID field should be formatted as a text string and should include leading zeroes.

If you have removed ‘osgb’ but not added any leading zeroes, please follow the steps outlined above. You should see that the TOIDs are formatted as numbers and contain decimal places. If you then navigate to the directory where you have stored the .csv file, you should see that MapInfo has created a .TAB file with the same name as the .csv file. When this .TAB file is opened within a text editor, something similar to the text below should be displayed:

Note: The field types may vary depending on previous processing. The section of code within the chevrons refers to the file name of the Building Height Attribute .csv.

!table
!version 300
!charset WindowsLatin1
Definition Table
File "<_Name of Tile.csv>"
Type ASCII Delimiter "," Titles Charset "WindowsLatin1" Fields 10
OS_TOPO_TOID Integer ; OS_TOPO_VERSION Smallint ; BHA_ProcessDate Char (10) ; TileRef Char (6) ;
AbsHMin Float ; AbsH2 Float ; AbsHMax Float ; RelH2 Float ; RelHMax Float ; BHA_Conf Smallint ;

As you can see here, the field OS_TOPO_TOID has a data type of ‘Integer’.

  1. Manually change this in the text editor to Char (20) ; to specify this field type as text, then save the .TAB file before closing.

  1. Close the original .csv file displayed in MapInfo by selecting File > Close Table.

  1. Open the .TAB file that you just edited. The TOID field should now be formatted correctly, and you can use this .TAB file to join to the OS MasterMap Topography Layer data holdings.

Note: If you re-open the .csv file in MapInfo and choose to overwrite the table, the TOID field will be formatted as a number again. Instead, you should use the .TAB file rather than the .csv file.

Now you have loaded the .csv file, you will need to export it as a .dbf (dBASE DBF) file and create an index on the TOID column in the table. To do this, follow these steps:

  1. In the ribbon toolbar, select the Table tab and then select Export. Navigate to where you wish to save the .dbf. Ensure the Save as type is set to dBASE DBF (*.dbf).

  2. Select the Table tab in the ribbon menu, then select Table and from that drop-down, select modify structure, which opens the Modify table structure dialog box.

  3. Ensure you have opened the table structure for the Building Height Attribute data because this is the data we want to create an index on. For the column of data containing the TOID value, tick Indexed box. Apply this index by clicking OK.

Last updated