C# Класс OSCodePointDataImport.CodePointDataImporter

Functionality to load Ordnance Survey Code-Point data files to SQL Server. The data files are available for download from: https://www.ordnancesurvey.co.uk/opendatadownload/products.html
Наследование: OSDataImporter
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
LoadData ( CodePointOptions options ) : int
LoadData ( string serverName, string databaseName, string schemaName, string tableName, string dataFileDirectory, string columnHeadersCsvFile ) : int

Loads Code-Point CSV data files into a new table in SQL Server, converting the provided Eastings & Northings coordinates into WGS84 Lon/Lat coordinates.

Приватные методы

Метод Описание
CalculateDistrictsAndSectors ( SqlConnection connection, string schemaName, string tableName ) : void

Calculates a simple average Lon/Lat for each postcode district (e.g. AB12) and sector (e.g. AB12 3), and creates a row in the db table for each one.

PrepareTable ( SqlConnection connection, string schemaName, string tableName ) : void

Creates a new table in the database ready to receive the Code-Point data.

ReadColumnHeaders ( string columnHeadersCsvFile ) : int>.Dictionary

Looks in the CSV headers file supplied with the Code-Point data download, and extracts all the columns defined with their index position.

ReadDataFromFiles ( string directory, int>.Dictionary columns ) : DataTable

Reads in all .csv files in the supplied directory, converts the Eastings & Northings coordinates into the WGS84 Lon/Lat system and stores each Post Code with the Lon/Lat coordinates in memory in a DataTable.

Описание методов

LoadData() публичный Метод

public LoadData ( CodePointOptions options ) : int
options CodePointOptions
Результат int

LoadData() публичный Метод

Loads Code-Point CSV data files into a new table in SQL Server, converting the provided Eastings & Northings coordinates into WGS84 Lon/Lat coordinates.
public LoadData ( string serverName, string databaseName, string schemaName, string tableName, string dataFileDirectory, string columnHeadersCsvFile ) : int
serverName string SQL Server name
databaseName string database to load the data into
schemaName string schema to create table in
tableName string table name to create and load the data into. The table must not already exist. If it does already /// exist, an exception will be thrown.
dataFileDirectory string directory where the Code-Point CSV data files are
columnHeadersCsvFile string CSV file containing the column header definition for the Code-Point CSV data files. /// Should be in ..\Doc\Code-Point_Open_column_headers.csv
Результат int