Grid reference | Vice-county |
---|
This tool returns the Watsonian vice-county (or vice-counties) that the grid reference contains (see Wikipedia for more information on vice-counties). It is accurate to 100m (although by the nature of the data down to 1m accuracy is available where the 100m grid square contains a single vice-county) and works with tetrad (e.g. SE45Y) and 5km grid references (e.g. SE45NW) as well as 1km, 10km and 100km grid references.
http://grid2vc.cucaera.co.uk/?r=<gridref>&f=<format>
where <gridref> is a grid reference or list of grid references seperated by a comma and <format> is one of JSON, XML, TEXT or left blank for "pretty" HTML output with the actual vice-county names (as used above). If more than one grid reference is provided in the query string the result will be collapsed down: e.g. if two grid references are supplied that fall within the same vice-county, then the result will be a single vice-county. The use case is for quickly batch checking a list to see if all are within a particular vice-county. If you want to query multiple grid references and have multiple results returned (even if they are all in the same grid reference, then just call the service multiple times.
The web service makes no attempt to notify or correct invalid grid references – it simply returns nothing if no match is found.
Examples:
JSON
URL:
http://grid2vc.cucaera.co.uk/?r=SU1561&f=json
Returns:
[7,8]
XML
URL:
http://grid2vc.cucaera.co.uk/?r=SU1561&f=xml
Returns:
<data><vice-county>7</vice-county><vice-county>8</vice-county></data>
TEXT
URL:
http://grid2vc.cucaera.co.uk/?r=SU1561&f=text
Returns:
7,8
“pretty”
URL:
http://grid2vc.cucaera.co.uk/?r=SU1561
Returns:
VC7 North Wiltshire<br />VC8 South Wiltshire
The information is based on data provided by the NBN. Contains Ordnance Survey data © Crown copyright and database right 2018.
If you interested in the mechanics behind the web service, it’s basically just a large (very – over 3.5 million data points) lookup table containing grid references and their vice-counties hosted by the Google App Engine with the script behind the scenes written in Python. A little optimization is done in that those grid references whose "parent" grid reference contains 100% of one vice-county can be assumed to be the same vice-county, and memcache is used to store recent queries, but that’s about as complicated as it gets.