Skip to main content

Module postcodes

Module postcodes 

Source
Expand description

gridpin postcodes <sheet> --res 9: an outline of each postcode, drawn from the points of its houses.

A postcode’s area is the set of H3 cells (resolution res, default 9: about 0.1 km²) that hold its houses, with a cell whose six neighbours all belong to the code added (holes of one cell filled). The outline is stitched from the cells’ edges: an edge two cells of the code share is inside, the rest form rings; a ring turning clockwise is a hole and goes to the outer ring that holds it. Written as GeoJSON, one MultiPolygon feature per code with postcode, addresses and cells. An outline of where the houses are, not the postal service’s own boundary.

Functions§

holds
Does the outline of a feature hold (lat, lon)? Read back through the engine’s own GeoJSON reader.
multipolygon
The MultiPolygon coordinates of a set of cells.
outline
The area of a code (its cells with one-cell holes filled) and its MultiPolygon.
postcodes
rings
The rings of a set of cells: (outer rings counter-clockwise, holes clockwise), each closed.