Skip to content

coderosh/nepal-geographical-codes

Repository files navigation

nepal-geographical-codes

Get geographical codes of districts and local bodies. Data provided by https://opendatanepal.com/

NPM MIT CI PRs welcome!

Installation

# with npm
npm i nepal-geographical-codes

# with yarn
yarn add nepal-geographical-codes

Usage

This package exports 4 functions and 4 objects.

  • getDistrictCode

    import { getDistrictCode } from 'nepal-geographical-codes'
    
    const code = getDistrictCode('Kathmandu')
    
    console.log(code) // 306
  • getLocalBodyCode

    import { getLocalBodyCode } from 'nepal-geographical-codes'
    
    const code = getLocalBodyCode('Kathmandu Metropolitian City')
    
    console.log(code) // 30608
  • getLocalBodiesInDistrict

    import { getLocalBodiesInDistrict } from 'nepal-geographical-codes'
    
    const localBodies = getLocalBodiesInDistrict('Kathmandu')
    
    console.log(localBodies) // ["Shankharapur Municipality", "Kageshwori Manahara Municipality", ...]
  • getDistrictsInProvince

    import { getDistrictsInProvince } from 'nepal-geographical-codes'
    
    const districts = getDistrictsInProvince('3')
    
    console.log(districts) // ['Bhaktapur','Chitwan', ...]
    import { getDistrictsInProvince } from 'nepal-geographical-codes'
    
    const districts = getDistrictsInProvince('Bagmati')
    
    console.log(districts) // ['Bhaktapur','Chitwan', ...]
    import { getDistrictsInProvince } from 'nepal-geographical-codes'
    
    const districts = getDistrictsInProvince('Bagmati Province')
    
    console.log(districts) // ['Bhaktapur','Chitwan', ...]
  • districts

    import { districts } from 'nepal-geographical-codes'
    
    console.log(districts) //  { "Taplejung": 101, "Sankhuwasabha": 102, ... }
  • localBodies

    import { localBodies } from 'nepal-geographical-codes'
    
    console.log(localBodies) // { "Phaktanlung Rural Municipality": 10101, "Mikwakhola Rural Municipality": 10102, ...}
  • districtsInProvinces

    import { districtsInProvinces } from 'nepal-geographical-codes'
    
    console.log(districtsInProvinces) // { 1: ["Bhojpur", "Dhankuta", ...], ... }
  • localBodiesInDistrict

    import { localBodiesInDistrict } from 'nepal-geographical-codes'
    
    console.log(localBodiesInDistrict) // { "Taplejung": [ "Phaktanlung Rural Municipality", ... ], ... }