N-Ways
Developer docsSierra Leone home codes

Sierra Leone home codes

Every compound in Sierra Leone has an N-Ways code. Look one up, find the code at a point, or decode it offline with the open engine, and credit N-Ways where you show it.

On this page

What a code is

Every compound in Sierra Leone has an N-Ways code: the short name of its community, town or village and a number of three to five digits, such as Moyamba 15727 or Connaught 2301. Each code is unique in the whole country on its own and leads to the compound’s gate. Codes start provisional and become confirmed when residents agree in the N-Ways app.

  • Remembered form, what people say and type: Moyamba 15727, also in groups (moyamba 157 27). Any case, Krio and English spellings (Kissy Tong = Kissy Town), the official name in place of the short one (Gbangbatoke Junction 1051 = Gbangbatoke 1051).
  • Written form, on plates and forms: Moyamba 157 27, with the gate’s Plus Code. People never see or type a check digit; the API returns it in check for systems.
  • Machine form, for systems, QR codes and links: SL-03663-15727 (the area, the number; SL-03663-15727.2/3 for building 2, unit 3).
  • Spot code, for any point: its Plus Code, 5H68+3V Moyamba or 6CW95H68+3V, readable by any Plus Code app.

In Freetown City Council’s area the property’s Plus Code is the official address: it comes first, in officialAddress, with the N-Ways code beside it. No district, chiefdom or ward is part of a code; municipality is looked up from the position. The model, the engine and the registry of every code are open: github.com/n-ways/open-addresses-sierra-leone. The white paper explains every rule.

Note:

Credit N-Ways wherever you show a code. Show “Home code by N-Ways Addressing” next to codes in your app, and credit “N-Ways Addressing for Sierra Leone, © N-WAYS LIMITED (nways.ng)” with a link to the repository in your about screen or documentation. The engine is Apache 2.0, the data ODbL 1.0 and the papers CC BY 4.0.

Look up a code

GET https://map.nways.ng/v1/homecodes/{code}, where code is the remembered, written or machine form, or a Plus Code on a compound, URL-encoded. No key is needed.

cURL
curl "https://map.nways.ng/v1/homecodes/SL-03663-15727"
200 OK
{
  "country": "SL",
  "home": "Moyamba 15727",
  "machine": "SL-03663-15727",
  "check": 0,
  "name": "Moyamba",
  "nameProvisional": false,
  "municipality": "Moyamba District",
  "fullLine": "Moyamba 157 27 · Moyamba District",
  "spoken": "Moyamba, 157 27",
  "status": "provisional",
  "issued": "bulk",
  "entrance": { "lat": 8.1602399, "lng": -12.4327947, "kind": "centre", "source": "map" },
  "location": { "lat": 8.1602399, "lng": -12.4327947 },
  "plusCode": "6CW95H68+3VW",
  "lote": { "use": "residential", "kind": "building", "class": "unknown", "structures": 1, "floorAreaM2": 888.7, "rule": "single" },
  "credit": "N-Ways Addressing for Sierra Leone, © N-WAYS LIMITED (nways.ng)",
  "creditUrl": "https://github.com/n-ways/open-addresses-sierra-leone"
}

In Freetown the card carries the council’s Plus Code first:

GET /v1/homecodes/FQQ6%2B9G%20Freetown
{
  "home": "Connaught 2301",
  "machine": "SL-00623-2301",
  "officialName": "Connaught Hospital Community",
  "coverage": "official",
  "officialAddress": "FQQ6+9G Freetown",
  "municipality": "Freetown",
  "fullLine": "Connaught 23 01 · Freetown",
  "lote": { "use": "health", "class": "health", "official": "FQQ6+9G Freetown" }
}
FieldDescription
home, machineThe remembered and machine forms. Show home to people; store machine.
check, fullLineThe check digit, for systems only, and the written form with its place.
officialNameThe area’s full name, for small print. Missing when it equals name.
coverage, officialAddressIn Freetown City Council’s area, official and the property’s Plus Code, FCC’s address: show it first, with the code beside it.
nameProvisionalThe council still has to choose the short name. The number never changes; the name may change once.
municipalityFreetown in FCC’s area, else the district. Context only, from the position: never needed to decode, and free to follow any redistricting.
statusprovisional, confirmed (residents agreed) or retired (no home there any more; the number is never reused).
entrance, location, plusCodeWhere to go: the gate when it is mapped, else the main building, with its Plus Code.
lote, structuresThe compound and each building’s profile: class, size, floors where known, status, each with its source. Homes never carry anything about the people who live there.

Errors: 400 homecode_format when the text isn’t a code; 404 homecode_unknown with a message saying why (a name no area has, a number in no block, a wrong check digit).

What’s the code here?

GET https://map.nways.ng/v1/homecodes/at?lat=…&lng=… answers for a point: "status": "found" with the code, or "none" where no compound has one yet.

cURL
curl "https://map.nways.ng/v1/homecodes/at?lat=8.16024&lng=-12.43279"

A code typed into N-Ways search, in any of its forms, finds the compound’s gate as the first result, with "category": "homecode" and the credit in attribution.

Decode offline

The repository’s reference engine (Python, standard library only) decodes every form, checks the check digit and reads and writes Plus Codes, with no network: python3 engine/reference/sl_address.py decode "Moyamba 157 27". Its conformance vectors (engine/reference/vectors.json) are the test for your own implementation, engine/data/register.json holds every area and its frozen blocks, and registry/ every issued code, one gzip file per 4-character Plus Code area.

Host it yourself

You can serve Sierra Leone’s codes from your own servers, with no calls to N-Ways. The repository on GitHub holds every issued code (registry/), the code areas and the model (model/), the reference engine, and a ready-made registry server with its JSON API:

Shell
git clone https://github.com/n-ways/open-addresses-sierra-leone
cd open-addresses-sierra-leone
docker compose up -d

The server imports the registry on first start, then answers lookups and searches on your machine; server/README.md covers configuration, backups and updates, and docs/api.md every endpoint. Your copy is read-only: new codes come from one issuer per country, N-Ways unless the State designates another, so no number is ever given twice. Pull the repository again for the codes issued since.

What you takeLicenceWhat it asks of you
The engine, the server and the toolsApache 2.0Keep the licence and NOTICE when you ship or change them.
The codes, the areas and the model (registry/, model/, engine/data/)ODbL 1.0Credit “N-Ways Addressing for Sierra Leone, © N-WAYS LIMITED (nways.ng)”, linked to the repository, where you show the codes. A database you make from the data and share is shared under ODbL 1.0 too.
The papers and other documents (docs/)CC BY 4.0Credit N-Ways and say what you changed.

The full terms, and the credit line for maps and datasets made from the data (it also names OpenStreetMap), are in LICENSING.md. You may say your product uses N-Ways Addressing, not that it is N-Ways or is endorsed by N-Ways.