Skip to content

pg_osgr

Ordnance Survey grid reference handling for biological recording

pg_osgr · Ordnance Survey grid reference handling for biological recording

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101078pg_osgrpg_osgr1.1.0GISUnknownSQL
Relationships
Requiresplpgsql

Usage

Sources:

pg_osgr is a pure-PL/pgSQL toolkit for converting Ordnance Survey grid references to easting, northing, datum, and accuracy, and for constructing references from those components.

CREATE EXTENSION pg_osgr;
SELECT osgr_find_datum('SU387148');
SELECT osgr_process_easting('SU387148'), osgr_process_northing('SU387148');
SELECT osgr_to_gridref(438700, 114800, 100, 27700);

The generic functions detect or accept EPSG 27700 for Great Britain, EPSG 29901 for Ireland and Northern Ireland, and EPSG 32630 for the Channel Islands. Resolution is limited to powers of ten and does not go below one metre.

The extension parses and formats grid references; it does not perform general coordinate-system transformations or datum shifts. Keep the EPSG code with stored coordinates, validate references at coverage boundaries, and use PostGIS/PROJ when converting between coordinate reference systems. Upstream states the rules were current on 2023-08-01, so verify later specification changes for regulated datasets.

Table reader