# nigeria-lga-data
> The only TypeScript-first npm package for all 774 Nigerian LGAs — with **geopolitical zones**, **coordinates**, and **proximity search**.
---
## Why this package?
If you're building health tech, civic tech, NGO tools, or any location-aware app for Nigeria, you need reliable LGA data — not just names.
Existing packages give you a flat list of LGA names. This package gives you:
| Feature | Other packages | `nigeria-lga-data` |
|---|---|---|
| LGA names | ✅ | ✅ |
| State capitals | ✅ | ✅ |
| **Geopolitical zones** | ❌ | ✅ |
| **Centroid coordinates** | ❌ | ✅ |
| **Proximity search** (nearest LGA by lat/lng) | ❌ | ✅ |
| **TypeScript-first** (full type safety) | ❌ | ✅ |
| ESM + CJS support | ❌ | ✅ |
| Unique slug IDs | ❌ | ✅ |
Built and maintained by someone who shipped a production disease surveillance dashboard for a Nigerian LGA — and needed this data to do it.
---
## Installation
```bash
npm install nigeria-lga-data
# or
yarn add nigeria-lga-data
```
---
## Quick Start
```typescript
import {
getAll,
getByState,
getByName,
getById,
getByZone,
getByCoordinates,
getNearby,
getStates,
} from "nigeria-lga-data";
// Get all 774 LGAs
const all = getAll();
// Filter by state
const plateauLGAs = getByState("Plateau");
// → [{ id: "plateau-barkin-ladi", name: "Barkin Ladi", state: "Plateau", ... }]
// Look up by name
const langtang = getByName("Langtang North");
// → [{ id: "plateau-langtang-north", geopoliticalZone: "North Central", ... }]
// Stable slug-based lookup
const lga = getById("plateau-langtang-north");
// Filter by geopolitical zone
const northCentral = getByZone("North Central");
// 🌍 Find nearest LGA to a GPS coordinate
const nearest = getByCoordinates(9.8, 9.4);
// → { lga: { name: "Langtang North", ... }, distanceKm: 12.3 }
// Get 5 closest LGAs to a point
const nearby = getNearby(6.45, 3.39, 5); // Near Lagos
```
---
## API Reference
### `getAll(): LGA[]`
Returns all LGAs in the dataset.
### `getByState(state: …