LankaLens.AdministrativeDivisions 1.0.0

dotnet add package LankaLens.AdministrativeDivisions --version 1.0.0
                    
NuGet\Install-Package LankaLens.AdministrativeDivisions -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LankaLens.AdministrativeDivisions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LankaLens.AdministrativeDivisions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LankaLens.AdministrativeDivisions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LankaLens.AdministrativeDivisions --version 1.0.0
                    
#r "nuget: LankaLens.AdministrativeDivisions, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LankaLens.AdministrativeDivisions@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LankaLens.AdministrativeDivisions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LankaLens.AdministrativeDivisions&version=1.0.0
                    
Install as a Cake Tool

LankaLens.AdministrativeDivisions

A .NET library providing Sri Lanka's administrative divisions with authoritative codes, hierarchy, and multilingual names.

LankaLens is an independent open-source project and is not an official government package. It is not affiliated with or endorsed by the Government of Sri Lanka.

Hierarchy

Country (Sri Lanka)
  → Province
    → District
      → Divisional Secretariat
        → Grama Niladhari Division

Installation

dotnet add package LankaLens.AdministrativeDivisions

Quick start

using LankaLens.AdministrativeDivisions;

var sriLanka = AdministrativeDivisions.Default;

foreach (var province in sriLanka.GetProvinces())
{
    Console.WriteLine(province.Name.English);
}

Hierarchy example

var districts = sriLanka.GetDistrictsByProvince("1"); // Western
var dsList = sriLanka.GetDivisionalSecretariatsByDistrict("11"); // Colombo
var gnList = sriLanka.GetGramaNiladhariDivisionsByDivisionalSecretariat("1103");
var parent = sriLanka.GetProvinceForDistrict("11");

Multilingual names

var province = sriLanka.GetProvinceByCode("1"); // Western
Console.WriteLine(province!.Name.English); // Western
Console.WriteLine(province.Name.Sinhala);  // බස්නාහිර
Console.WriteLine(province.Name.Tamil);    // மேற்கு

English is always present. Sinhala and Tamil may be null on some Grama Niladhari records.

  • null means no verified authoritative localized value is currently bundled.
  • null is not a translation failure and is never an empty placeholder string.
  • This snapshot: Province / District / DS Sinhala+Tamil are complete; GN is 13,723 / 14,008.
var results = sriLanka.Search("Colombo");

var sinhala = sriLanka.Search(
    "බස්නාහිර",
    new AdministrativeDivisionSearchOptions
    {
        Language = Language.Sinhala,
        Type = AdministrativeDivisionType.Province,
        MaxResults = 5
    });

Matching ranks exact, then prefix, then contains. English matching is ordinal and case-insensitive; Sinhala and Tamil matching is ordinal. Language-specific search matches only that language (no English fallback).

Common operations

Need API
All provinces GetProvinces()
Districts by province GetDistrictsByProvince(code)
DS by district GetDivisionalSecretariatsByDistrict(code)
GN by DS GetGramaNiladhariDivisionsByDivisionalSecretariat(code)
Lookup by code Get*ByCode / TryGet*
Parent navigation GetProvinceForDistrict, GetDistrictForDivisionalSecretariat, GetDivisionalSecretariatForGramaNiladhariDivision

Data coverage (bundled snapshot)

Level Count English Sinhala Tamil
Province 9 9/9 9/9 9/9
District 25 25/25 25/25 25/25
Divisional Secretariat 340 340/340 340/340 340/340
Grama Niladhari 14,008 14,008/14,008 13,723/14,008 13,723/14,008

Data sources

  • Department of Census and Statistics, Sri Lanka — canonical hierarchy, codes, and English names
  • Ministry of Home Affairs, Sri Lanka — Sinhala/Tamil via LIFe Location Codes and verified official evidence

Detailed provenance: docs/data-sources.md

License

Source code is licensed under the MIT License.

Data-source information: DATA-NOTICE.md.

LankaLens is an independent open-source project and is not affiliated with or endorsed by the Government of Sri Lanka. Administrative data is derived from cited official government sources.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 34 8/30/2026
0.1.0-preview.2 58 8/21/2026
0.1.0-preview.1 55 8/21/2026

LankaLens.AdministrativeDivisions 1.0.0

 First stable release of LankaLens.AdministrativeDivisions.

 Included data:
 - 9 Provinces
 - 25 Districts
 - 340 Divisional Secretariat Divisions
 - 14,008 Grama Niladhari Divisions
 - Complete English coverage
 - Sinhala and Tamil names where authoritative values are available

 Features:
 - Offline embedded administrative dataset
 - Code-based lookups
 - Province → District → DS → GN hierarchy navigation
 - Multilingual search
 - Thread-safe read-only API
 - No database or external API required

 This release establishes the initial stable public API.