British National Grid utilities

This page lists methods for working with British National Grid (bng) coordinates.

Alphabetical list:

Coordinates

class nevis.Coords(gridx=None, gridy=None, normx=None, normy=None)[source]

Coordinates, either normalised (so that 0, 0 is the bottom left of the grid and 1, 1 is the top right) or as OS36GB grid points in meters.

Examples:

p = nevis.Coords(gridx=123456, gridy=123456)
print(p.grid)
print(p.normalised)

p = nevis.Coords(normx=0.5, normy=0.2)
print(p.grid)
print(p.normalised)

b = nevis.ben()
print(b.square)
print(b.geograph)
static from_square(square)[source]

Creates coordinates corresponding to the lower-left corner of a grid square indicated by letters and numbers, e.g. NN166712 or NN 166 712.

static from_square_with_size(square)[source]

Like from_square() but returns a tuple (coords, size) where size is the length of the square’s sides.

nevis.dimensions()[source]

Returns the dimensions of the grid (width, height) in meters.

nevis.ben()[source]

Returns the coordinates of Ben Nevis.

nevis.fen()[source]

Returns the coordinates of Holme Fen

nevis.macdui()[source]

Returns a tuple (hill, boundaries) containing the Hill object for Ben Macdui and boundaries (x_lower, x_upper, y_lower, y_upper) defining its neighbourhood, Cairngorms Mountains.

This can be used as an easier test problem for local methods.

nevis.pub(name=None)[source]

Returns coordinates where a mathematician may be found.

nevis.schiehallion()[source]

Returns a tuple (hill, boundaries) containing the Hill object for Schiehallion and boundaries (x_lower, x_upper, y_lower, y_upper) defining its neighbourhood.

This can be used as an easier test problem for local methods.

nevis.squares()[source]

Returns a list of tuples (name, x, y) with two-letter 100km grid square names and lower-left corners, covering the area of the data.

Hills

class nevis.Hill(x, y, rank, height, hill_id, name)[source]

Known hill tops.

Examples:

print(Hill.by_name('Ben Nevis'))
print(Hill.by_rank(1))
print(Hill.by_rank(2))
print(Hill.by_rank(3))

h, d = Hill.nearest(Coords(gridx=216600, gridy=771300))
print(h)
static by_id(hill_id)[source]

Return a hill with the given hill_id (as used on e.g. hill bagging.)

static by_name(name)[source]

Return a hill with the given name.

static by_rank(rank)[source]

Return the hill with the given rank (rank 1 is heighest, then 2, etc.).

static nearest(coords)[source]

Returns a tuple (hill, distance) with the hill nearest to the given points.

photo()[source]

Attempts to return a URL with a photo. Returns an empty string if none is found.