Skip to content

charlie-barnes/gridref2vc-data-praeger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gridref2vc-data-praeger

Data to convert grid references to Praeger vice-counties

This repository contains CSV files that can be used to convert grid references to Praeger vice-counties, covering Ireland. For Watsonian vice-counties covering England, Scotland, Wales and the Isle of Man see https://github.com/charlie-barnes/gridref2vc-data-watson. The data can not be used "as is", via a simple lookup. In order to reduce the size of the data files, a hierarchical system has been implemented whereby if a grid square is entirely within one vice-county, all "child" grid squares are omitted. Thus, in order to retrieve the correct conversion, if the grid square doesn't exist in the data, you need to test the "parent" grid reference.

As an example, grid square TF135384 does not exist in the data files because it's "grandparent" (its "parent", TF13 is also absent) is entirely within vice-county 53. When traversing the hierachy, you must test in the following order 100m > 1km > 2km > 10km > 100km, ignoring the 5km grid square as this does not entirely contain any "child" grid squares.

Psuedocode:

input = TF135384

if exists input then return vc(input) else if exists convert_to_100m(input) then return vc(convert_to_100m(input)) else if exists convert_to_1km(input) then return vc(convert_to_1km(input)) else if exists convert_to_2km(input) then return vc(convert_to_2km(input)) else if exists convert_to_10km(input) then return vc(convert_to_10km(input)) else if exists convert_to_100km(input) then return vc(convert_to_100km(input)) else return "invalid input"

It should be possible to traverse the hierachy and return a value for all valid grid references; otherwise an error indicates an invalid grid reference. The sea (where no vice-county exists but it is within the grid) is assigned a value of 0 in the data.

For working example code on how to use the data, see https://github.com/charlie-barnes/gridref2vc-examples/

For more information on vice-counties see https://en.wikipedia.org/wiki/Vice-county

The data has been generated from the Irish vice-county boundaries by SK53 @ https://github.com/SK53/Irish-Vice-Counties, originally sourced from OpenStreetMap.

About

Data to convert grid references to Praeger vice-counties

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published