Coordinate lab · HK80

HKGCode round-trip tester

Convert a latitude and longitude into a grid code, then decode it back to the cell centre.

01

Coordinates → code

WGS84 decimal degrees

02

Code → coordinates

Edit the code to test another cell

Enter 2, 4 or 6 characters. Lowercase, spaces and hyphens are accepted. I, L, O and U are rejected; pairs are east then north.

Test exact HK80 coordinates (no datum shift)

For boundary checks, enter easting then northing in metres. This bypasses approximate geographic conversion.

Explore the HKGCode grid

Hover for a live code; click or tap to send a location to the tester.

READY
—
Move the pointer over the map, or tap to select.
Grid: —

Connecting to LandsD…

Grid: 2 km at zoom 8–16, 100 m at 17–19, 5 m at 20. Zoom with the map controls; drag to move. Cell lines use the supplied approximate conversion and are not an official grid overlay. Map tiles and optional labels load directly from LandsD. Map API · Terms and copyright

Whole HKGCode coverage · outer limits & four boundary corners

800000 ≤ E < 864000; 800000 ≤ N < 848000. The grid has 32 eastward × 24 northward regions, each 2 km. The north and east outer edges are excluded from encoding. Geometric corners are still valid decoded boundary coordinates.

Boundary cornerHK80 E (m)HK80 N (m)Adjacent region inside
SW · included80000080000000
NW · excluded point8000008480000Q
NE · excluded point864000848000ZQ
SE · excluded point864000800000Z0

The inside corner 5 m cells are SW 000000, NW 0Q0K0K, NE ZQKKKK, SE Z0K0K0. A cell contains its west/south edge, not its east/north edge. ZQ starts at E 862000, N 846000; it is not a code for E 864000, N 848000.

Do not substitute the older transformation API's HK80 input limits. They describe a different service, not HKGCode coverage. Map corner positions use the approximate datum shift, whereas the HK80 figures above are exact grid definitions.

References: LandsD HKGCode definition · Official pseudocode · API manual and worked examples.

Documentation caution: the pseudocode's closing comment says “ZZKKKK”, but that contradicts its own N < 848000 guard and the 24-row published definition. This tester correctly rejects rows R–Z; the northeast limit cell is ZQKKKK.

Code audit & verification results

Sources and reproducibility: the LandsD definition, pseudocode and API manual are linked above. Automated code checks are not an official certification, and do not validate every possible 5 m cell or guarantee availability of map tiles.