Terra System
Saudi National Spatial Index · v1.0
SANSRS Compliant KSA-GRF17 Native Apache 2.0 Open Source
Developed by Tec Solution KSA

The National
Hexagonal
Spatial Index
for Saudi Arabia

Terra assigns every location in the Kingdom — from a doorstep in Riyadh to an oil field in the Empty Quarter — a precise, permanent hexagonal address. A single open system connecting land, government, industry, logistics, and every citizen service on one universal spatial grid.

KSA-GRF17 · EPSG:9333 SANSRS aligned GEOSA · MOMRA ready Res 8 = exactly 1 hectare 6 language bindings
Terra hexagonal grid — 19-cell cluster
Land
Agriculture
Emergency
Logistics
Energy
Telecom
15
Resolution levels
1 ha
Base cell — Res 8
215M+
Cells covering KSA
18 cm
Finest cell — Res 14
What is Terra System?

A spatial grid built for the Kingdom

Terra is an open-source hierarchical geospatial indexing system. It divides Saudi Arabia into a nested grid of regular hexagonal cells, each uniquely identified by a compact numeric code. Think of it as a universal address system for space itself — one that works in deserts, cities, at sea, underground, and in the air.

Unlike a street address, which is tied to infrastructure that may not exist, a Terra cell exists everywhere — even in uninhabited desert, remote coastline, or mid-construction megaprojects. Unlike GPS coordinates, which are raw numbers with no context, a Terra cell carries hierarchy: every cell knows its parent region, its neighbouring cells, and its children.

Terra cells are hexagonal because hexagons tile a plane with equal-distance neighbours — each of the six adjacent cells is the same distance from the centre. This makes spatial analysis simpler, more consistent, and more accurate than square grids, where corner neighbours are farther away than edge neighbours.

Every location in Saudi Arabia has a Terra address. From the top of Jabal Sawda to the deepest point of the Red Sea — every point falls inside exactly one 1-hectare cell.
Terra resolution hierarchy — Res 5, Res 7, Res 8 Res 5 · 343 ha · District Res 7 · 7 ha · Block Res 8 1 ha Base cell (national standard)
Hexagonal cells
Regular hexagons tile the plane with equal-distance neighbours. All 6 adjacent cells are the same spatial distance from the centre — no bias toward cardinal directions.
Hierarchical by design
Each cell belongs to a parent at a coarser resolution. Every Res 8 (1 ha) cell has a Res 7 parent (7 ha), a Res 6 grandparent (49 ha), and so on — up to national scale.
Compact, unique ID
Every cell is a 64-bit integer — a single number encodes its position and resolution. Compact enough to store in any database column or transmit in an API response.
Resolution levels

From 0.09 m² to 57,000 km² — 15 levels

Every Terra cell sits at one of 15 resolution levels. Moving one level coarser multiplies the cell area by 7 (aperture-7 hierarchy). Resolution 8 — the 1-hectare base cell — is the national standard anchor.

Res Name Cell edge Cell area Cells in KSA Primary use
Why Saudi Arabia needs Terra

The problem Terra solves

Saudi Arabia has undergone rapid spatial development — yet the foundational data infrastructure connecting government ministries, private enterprises, and citizens remains fragmented. Terra addresses four core problems.

01
Fragmented spatial data
Different government agencies have used different coordinate reference frames for decades — GDMS, MTRF-2000, ARAMCO WGS84, and Ain Al Abd. Data from separate sources may be off by up to 93 metres, making cross-agency integration unreliable or impossible.
Terra uses KSA-GRF17 (SANSRS) as its native datum. All legacy frames are automatically transformed. One grid, one reference, one truth.
02
Addressing gaps
Large portions of Saudi Arabia — deserts, industrial zones, NEOM construction areas, rural farmland — have no street address. Emergency services, logistics operators, and government agencies cannot uniquely identify these locations without GPS coordinates, which carry no context or hierarchy.
Every point in the Kingdom, regardless of infrastructure, falls inside exactly one Terra cell with a stable, short, human-readable code — permanently.
03
Spatial data integration is expensive
Joining data from land registry, logistics operations, environmental sensors, and healthcare facilities requires complex, error-prone spatial joins. These joins are slow at scale, require specialist GIS software, and break whenever reference frames differ between sources.
A Terra cell index is a plain integer. Joining datasets becomes a standard database JOIN — no geometry engine required, no projection alignment needed.
04
No national scale-invariant grid
Analysis that spans multiple spatial scales — from individual parcels to national statistics — requires separate data at each scale. There is no consistent hierarchy connecting a 1-ha farm plot to its governorate, its region, and the national picture.
Terra's aperture-7 hierarchy directly connects Res 8 (1 ha) cells to every coarser level via a single integer operation. No resampling, no re-projection.
Legal foundation: Council of Ministers Decision No.90 mandates that all surveys and geospatial activities in the Kingdom are linked to SANSRS (KSA-GRF17). Terra is the first and only spatial indexing system designed from the ground up to be SANSRS-native.
Who should use Terra?

Built for everyone who works with location in Saudi Arabia

Terra is designed to serve a wide range of audiences — from government ministries needing a compliant national standard, to mobile developers building location-aware applications.

Government Ministries & Agencies
  • GEOSA — national land registry & SDI
  • MOMRA — urban planning & municipalities
  • Civil Defence — emergency dispatch
  • MEWA — agriculture & environment
  • Saudi Post — national addressing
  • Ministry of Health — coverage planning
  • Ministry of Transport — road & rail
Private Sector Organisations
  • Logistics & delivery companies (Naqel, Aramex)
  • Telecommunications (STC, Mobily, Zain)
  • Energy & oil (Saudi Aramco, SABIC)
  • Real estate developers
  • Agriculture & precision farming
  • Retail & supply chain operations
Developers & Data Teams
  • GIS analysts — QGIS, ArcGIS workflows
  • Backend developers — location services
  • Data scientists — spatial ML & analytics
  • Platform engineers — PostGIS, DuckDB
  • Mobile developers — React Native, iOS, Android
  • Data engineers — ETL / spatial pipelines
Field & Survey Professionals
  • GNSS surveyors (KSA-CORS users)
  • Cadastral inspectors
  • Environmental field teams
  • Emergency responders
  • Construction & site managers
  • Drone survey operators
Impact across the Kingdom

One grid — every sector

Terra provides the common spatial language that connects each of these sectors to one another. A logistics zone, an agriculture permit, an emergency dispatch area, and an environmental monitoring point all reference the same underlying grid.

For developers
Built like H3. Designed for Saudi Arabia.
Terra follows the same developer ergonomics as Uber's H3 — the same API naming conventions, the same C-core-plus-bindings architecture, the same PostGIS extension pattern. Any developer who has used H3 can use Terra in minutes.
Python
pip install terra-sa
# Geocode KSA-GRF17 coordinates cell = terra.latlon_to_cell(24.6877, 46.7219, res=8) # → "t1858a2f400000000" parent = terra.cell_to_parent(cell, res=6) ring = terra.grid_ring(cell, k=1)
JavaScript / Node
npm install terra-sa
// terra-js — WebAssembly, works in browser import * as terra from 'terra-sa' const cell = terra.latLngToCell(24.6877, 46.7219, 8) const bnd = terra.cellToBoundary(cell) const disk = terra.gridDisk(cell, 2)
PostgreSQL / PostGIS
CREATE EXTENSION terra;
-- Geocode in SQL SELECT terra_latlon_to_cell(24.6877, 46.7219, 8); -- Aggregate deliveries by Res 6 zone SELECT terra_cell_to_parent(cell, 6) AS zone, COUNT(*) AS orders FROM deliveries GROUP BY 1;
Command line (terra-cli)
brew install terra-sa
# Geocode from shell terra latlon-to-cell 24.6877 46.7219 -r 8 # → "t1858a2f400000000" # Polyfill a GeoJSON polygon terra polyfill riyadh.geojson -r 8 | terra to-geojson
Also available: terra-r  (R / sf) terra-go  (Go) terra-duckdb  (DuckDB extension) terra-qgis  (QGIS plugin)
Two string representations

Terra Index String and Terra Grid Code

Every Terra cell has two human-readable string representations. The Terra Index String (TIS) is the low-level form used by code and databases. The Terra Grid Code (TGC) is the human-readable form — compact, resolution-explicit, with no administrative boundary reference. Both strings represent the same cell and convert between each other with pure arithmetic. No lookup table, no network call needed.

Terra Index String — TIS
Developer · API · database · PostGIS · Python · JS
t1858a2f400000000
t
Terra prefix
16 hex
64-bit integer
17 chars
Always fixed length
Always 17 characters at every resolution. Resolution encoded in bit field 55–52. Identical concept to H3’s string format — any developer who has used H3 will recognise this immediately. The native form for PostGIS, DuckDB, language libraries, and all API responses.
Terra Grid Code — TGC
Citizen · field worker · map · sign · dispatch
T08-K4QN7P
T
Terra
08
Resolution (1 ha)
K4QN7P
Position — Base32
Resolution-explicit prefix. Position in Base32 — 32 unambiguous characters (no 0, 1, I, O, L). No region or admin boundary reference. A cell at the border of two regions gets one unique code based purely on its geometric position. Length scales with resolution.
TGC code length by resolution
ResolutionPosition charsFull TGC lengthExampleUnique codes
Res 0–126T00-K4> 1,000 (covers ~37 national tiles)
Res 2–337T03-K4Q> 32,000 (covers ~12,800 cells)
Res 4–548T05-K4QN> 1M (covers ~627,000 cells)
Res 6–759T07-K4QN7> 33M (covers ~30.7M cells)
Res 8 ★610T08-K4QN7P>1B (covers ~215M base cells)
Res 9711T09-K4QN7PM>34B (covers ~1.5B cells)
Res 10–11812T10-K4QN7PM3>1T (covers ~73.5B cells)
Res 12913T12-K4QN7PM3F>35T (covers ~514B cells)
Res 13–141014T13-K4QN7PM3FX>1P (covers ~25T cells)
Uniqueness guarantee: At every resolution, 32n (where n = position code length) exceeds the total cell count for Saudi Arabia plus the full GCC buffer zone. No two cells at the same resolution share a TGC. No administrative boundary is referenced at any level.
Voice-ready
The TGC at Res 8 is 10 characters. Easy to read over a radio or phone. Emergency dispatch can communicate a precise location without GPS coordinates. "T-zero-eight, K-four, Q-N, seven-P."
Works offline
TGC encodes geometric position only. No lookup server needed to decode it. The terra-core library converts TGC ↔ TIS ↔ lat/lng entirely offline on any device.
QR & print ready
Both TIS and TGC fit in a standard QR code. The TGC can be printed on a property deed, delivery label, or field marker. The resolution prefix tells the reader the exact precision level.
SANSRS & KSA-GRF17

Full compliance with the national spatial reference system

SANSRS — the Saudi Arabia National Spatial Reference System — defines the legal coordinate framework for all surveys and geospatial activities in the Kingdom. Terra is natively built on SANSRS components. No conversion layer, no approximation.

EPSG code Name Description Terra usage
9333 KSA-GRF17 geographic 2D Primary horizontal datum — lat/lng on GRS 1980 ellipsoid anchored to ITRF2014 epoch 2017.0 Primary input
9332 KSA-GRF17 geographic 3D Horizontal + ellipsoidal height; used when accepting GNSS observations from KSA-CORS 3D input
9356 – 9360 KSA-GRF17 / UTM zone 36N–40N KSA-GRF17 in projected UTM coordinates — five zones covering Saudi territory Accepted input
9335 KSA-VRF14 height Orthometric height above mean sea level at the Jeddah Tide Gauge (Helmert-Orthometric) Vertical datum
9520 KSA-GRF17 + KSA-VRF14 height Compound CRS combining horizontal GRF17 and vertical VRF14 — the complete 3D SANSRS 3D cell CRS
10776 KSA-GRF17 → KSA-VRF14 (KSA-GEOID21) Geoid model transformation (KSA-GEOID21.gra) — 1.5 cm accuracy. Converts GNSS ellipsoidal height to orthometric height for 3D Terra cells Geoid transform

Legacy datum migration

Terra includes built-in Helmert transformation parameters for all four historical KSA reference frames: GDMS (0.6 m shift), MTRF-2000 (0.6 m), ARAMCO WGS84 (0.8 m), and Ain Al Abd (93 m grid transformation). Organisations migrating to SANSRS can simultaneously re-index their spatial data into Terra.

KSA-CORS integration

The 200+ active KSA-CORS stations operated by GEOSA provide real-time KSA-GRF17 positioning. A field surveyor's GNSS receiver outputs KSA-GRF17 coordinates directly, which feed into Terra without any conversion step. RTK precision to 1–2 cm maps to sub-cell accuracy at Res 9 (23 m cells).