/kenya-administrative-divisions

kenya-administrative-divisions is an npm package that provides information about counties, constituencies, and wards in Kenya. This package can be used by developers who are building web or mobile applications that require access to geographic data about Kenya.

Primary LanguageJavaScript

npm version npm version npm version

kenya-administrative-divisions

** Effortlessly retrieve the names of Kenya's counties, constituencies, and wards **

Table of Contents

Features

  • Get names,codes and constituencies of all counties in kenya
  • Get names and wards of all constituences in kenya
  • Get names of all wards in kenya

Installing

npm install kenya-administrative-divisions

OR

yarn add kenya-administrative-divisions

Once the package is installed you use the require approach

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');

OR

import kenyaAdministrativeDivisions from 'kenya-administrative-divisions'

Or with TypeScript

import * as kenyaAdministrativeDivisions from 'kenya-administrative-divisions'

create a .d.ts file and add

declare module 'kenya-administrative-divisions'

#Get all

This will retrieve all counties,their names,their code and their constituences. The constituences will also include the ward names. Do not pass parameters to this function.

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');

kenyaAdministrativeDivisions.getAll();

#Get counties

This will retrieve information about counties.

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get all counties and their county code
kenyaAdministrativeDivisions.getCounties();

// To get the county the constituencies of a particular county pass the county name
kenyaAdministrativeDivisions.getCounties("nairobi");
kenyaAdministrativeDivisions.getCounties("kis");

// To get the county the constituencies of a particular county pass the county code

kenyaAdministrativeDivisions.getCounties(47);

#Get county

This will retrieve information about a particular county.

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');

// To get the county the constituencies of a particular county pass the county name
kenyaAdministrativeDivisions.getCounties("nairobi");
kenyaAdministrativeDivisions.getCounties("momb");

// To get the county the constituencies of a particular county pass the county code

kenyaAdministrativeDivisions.getCounties(47);

#Get constituencies

This will retrieve information about constituencies

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');

// To get all constituencies and their wards
kenyaAdministrativeDivisions.getConstituencies(); 

// To get information about a particular constituency pass a string to the function
kenyaAdministrativeDivisions.getConstituencies("mwea");  

// To get all constituencies of a particular county pass the county code as a parameter
kenyaAdministrativeDivisions.getConstituencies(1); 

#Get wards

This will retrieve all information about wards

const kenyaAdministrativeDivisions = require('kenya-administrative-divisions');
// To get all the wards
kenyaAdministrativeDivisions.getWards();

// To get a particular ward pass the name of the wards as a parameter
kenyaAdministrativeDivisions.getWards("bangale");

// To get wards in a county, by code
kenyaAdministrativeDivisions.getWards(43);