CSV file processing
Last updated
Last updated
As OS Open Names data is supplied in separate CSV files labelled by two-digit grid references, the files require processing before you can load them into a GIS.
The first step is to combine the individual CSV files with the header CSV file. To move and rename the header CSV file:
Extract opname_csv_gb.zip to a folder on your computer.
Open the Doc folder and either move or copy OS_Open_Names_Header.csv into the Data folder.
Rename OS_Open_Names_Header.csv to a_OS_Open_Names_Header.csv.
Adding the “a_” prefix ensures that the files will be merged in the correct order. The header file will be added first in the output file as it is now at the top of the file list.
This section contains an example of one way to combine the individual CSV files into a single file using a batch (.bat) file.
The combined CSV file will be approximately 1.7Gb with about 2.9 million records. If opened in Microsoft Excel, only the first million records can be seen as the software cannot display more than this.
To combine the CSV files using a batch function:
Copy the following text and paste it into a new Notepad file: copy *.csv outputfile.csv.
Save the Notepad file with the .bat file extension (for example, combine_csv.bat) in the Data folder that contains the 819 CSV files.
Close the .bat file, navigate to the Data folder and double click on the batch (.bat) file that you saved in the previous step.
A MS-DOS window will open automatically and then close when the process is complete.
A new CSV file named outputfile.csv will display in the Data folder. You can now delete the other CSV files if you like.
outputfile.csv contains the content previously in the 819 individual CSV files that was copied over during the batch file process.
You will now have an output file that is ready to be used in a GIS application or database.
outputfile.csv might be too large to be opened in a text editor such as Excel.