Logo Lanfrica

nicanor-korir/kenya-regions

Domaine:

geospatial

Type de record:

datasetsoftware
Créateur:
nic
Hôte:
Offline, typed dataset for every way Kenya is divided: 47 counties, 290 constituencies, 1450 wards, sub-counties, the 2009 census hierarchy, plus ISO 3166 and OCHA codes # kenya-regions Every way Kenya is divided up, as offline data with a typed API. Kenya itself, then 47 counties, 290 constituencies, 1450 wards, the 301 administrative sub-counties, the 2009 census hierarchy of districts, divisions, locations and sub-locations, the 8 former provinces, ISO 3166-1 and 3166-2 codes, OCHA place codes, the regional economic blocs and the ASAL classification, all bundled into the package. It makes no network calls, has no runtime dependencies, and works the same in Node, the browser, a build step or a serverless cold start. ```bash npm install kenya-regions ``` Or start with the atlas: the county map, with every level inside each county, and the pre-2013 administration on a second tab. ```ts import { kenya, counties, getCounty, getWardsByCounty, search } from 'kenya-regions' kenya.codes.iso3166Alpha2 // 'KE' kenya.currency.code // 'KES' counties.length // 47 getCounty('KE-30') // Nairobi getCounty(47) // also Nairobi getWardsByCounty('Kiambu').length // 60 search('mbita')[0].region.name // 'Suba North', found by its former name ``` --- ## Kenya is divided up in more than one way The reason this package exists is that "Kenya's regions" is not one list. There are several schemes in active use, they were created for different purposes, and the part that bites is that **they do not nest into each other**. ### 0. Kenya in the world Above every subdivision sits the country itself. The `kenya` record holds the identifiers other systems use to refer to Kenya, and the national figures the subdivisions roll up to. ```ts import { kenya } from 'kenya-regions' kenya.codes.iso3166Alpha2 // 'KE' ISO 3166-1 kenya.codes.iso3166Alpha3 // 'KEN' kenya.codes.unM49 // '404' UN statistical code kenya.codes.callingCode // '+254' ITU kenya.currency.code // 'KES' ISO 4217 kenya.timeZone.iana / …