Public API#

This page documents the public objects defined in osbng.__all__ that are imported via:

from osbng import *

Included are the core functions for creating BNGReference objects from coordinates or Shapely geometry objects, along with the main class used across the package. Also included are grid square data covering the BNG index system bounds as iterators at 100km, 50km, 10km, 5km and 1km resolutions.

Additional functionality that works with BNGReference instances is documented in the respective module pages and can be imported from osbng modules directly. For example:

from osbng.bng_reference import BNGReference
from osbng.hierarchy import bng_to_children
from osbng.indexing import bng_to_bbox
from osbng.indexing_gpd import gdf_to_bng_intersection_explode
from osbng.traversal import bng_kdisc

Public API reference. This links the canonical module documentation for each object:

osbng.grids.BNG_BOUNDS

BNG index system bounding box.

osbng.resolution.BNG_RESOLUTIONS

Supported BNG resolutions and mappings.

osbng.indexing.PREFIXES

100km BNG square letter prefixes.

osbng.indexing.SUFFIXES

BNG ordinal direction suffixes.

osbng.bng_reference.BNGReference

Initialises a BNGReference from a BNG reference string.

osbng.grids.bng_grid_100km

Iterator of GeoJSON-like Features for 100km BNG grid squares within BNG_BOUNDS.

osbng.grids.bng_grid_50km

Iterator of GeoJSON-like Features for 50km BNG grid squares within BNG_BOUNDS.

osbng.grids.bng_grid_10km

Iterator of GeoJSON-like Features for 10km BNG grid squares within BNG_BOUNDS.

osbng.grids.bng_grid_5km

Iterator of GeoJSON-like Features for all 5km BNG grid squares within BNG_BOUNDS.

osbng.grids.bng_grid_1km

Iterator of GeoJSON-like Features for all 1km BNG grid squares within BNG_BOUNDS.

osbng.indexing.xy_to_bng

Returns a BNGReference given easting and northing coordinates and resolution.

osbng.indexing.bbox_to_bng

Returns a BNGReference list given a bounding box and resolution.

osbng.grids.bbox_to_bng_iterfeatures

Returns an iterator of BNGReference Features given a bounding box and resolution.

osbng.indexing.geom_to_bng

Returns a BNGReference list given a Shapely Geometry and resolution.

osbng.indexing.geom_to_bng_intersection

Returns a BNGIndexedGeometry list given a Shapely Geometry and resolution.