GridRef

Usage

There is a single route /convert/ which can be passed either a grid reference or a coordinate pair.

/convert/<gridref> /convert/<coordinate>?figures=<n>

<gridref>

Grid references are of the form ST23NE, the grid letters (ST) are mandatory, the figures (23) and bearing (NE) are optional. Lower-case characters and spaces are tolerated.

<coordinate>

A coordinate pair is of the form [123456.0 123456.0] where the first number is the easting and the second the northing. The square brackets are optional, integers or floats are fine and coordinates can be comma separated so the following are all accepted:

Output formats

The service returns data in either JSON, EDN or YAML if an appropriate mime-type is specified via the Accept http header (application/json, application/edn, application/x-yaml respectively). If you try the examples in browser you will get a HTML response with embedded YAML.

Cross domain requests

Cross domain requests are supported from any domain via Cross-origin resource sharing (CORS).

Examples

Grid reference to coordinate

https://gridref.longwayaround.org.uk/convert/ST12 { "coord": [310000.0, 120000.0], "gridref": "ST12" } https://gridref.longwayaround.org.uk/convert/SU31NE { "coord": [435000.0, 115000.0], "gridref": "SU31NE" } https://gridref.longwayaround.org.uk/convert/NN 16650 71250 { "coord": [216650.0, 771250.0], "gridref": "NN1665071250" }

Coordinate to grid reference

https://gridref.longwayaround.org.uk/convert/[300000.0 100000.0] { "gridref": "ST0000000000", "coord": [300000.0, 100000.0], "figures": 10 } https://gridref.longwayaround.org.uk/convert/216650.0 771250.0 { "gridref": "NN1665071250", "coord": [216650.0, 771250.0], "figures": 10, } https://gridref.longwayaround.org.uk/convert/533600,180500?figures=4 { "gridref": "TQ3380", "coord": [533600.0, 180500.0], "figures": 4 }

Demo

Enter a grid reference or coordinate pair and click convert.

Issues

If you find an issue or have a question about usage then feel free to create an issue on GitHub.

Source

The source code for this Clojure web app is available on GitHub in the walkermatt/gridref-web repository. The actual conversion is done by the gridref Clojure library also on GitHub in the walkermatt/gridref repository and released on Clojars.