1.0.1 • Published 4 years ago

@klltech/boundaries v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@klltech/boundaries

@klltech/boundaries is a node package to extract boundaries for administrative units of Nepal. The data, which is also available as an API is based on the shapefiles released by the Survey Department, Government of Nepal on March 24, 2020.

Installation

$ npm install --save @klltech/boundaries

Source

नेपालको नक्सा (राजनीतिक तथा प्रशासनिक)को Shapefile (GIS Data) - Survey Department, Government of Nepal.

Supported use cases

  • Easily plug-an-play municipal, district-level, and province-level boundaries into your apps.
  • Download metadata for districts, provinces and municipalities for easy population of drop downs.
  • Convert imported geojson data into different formats (TopoJSON, PolyFile).

Usage examples

Case 1: Get list of all provinces, districts, or municipalities :

import { MetadataRequest } from '@klltech/boundaries'

const requestConfig = {
    level: 'municipality', // should be one of municipality, district, province
}

const geojson = new MetadataRequest(requestConfig).doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 2: Get GeoJSONs for all provinces:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getProvinces()
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 3: Get GeoJSONs for specific provinces, say with ids 3, 5, and 7:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getProvinces([3,5,7])
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 4: Get GeoJSONs for all districts:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getDistricts()
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 5: Get GeoJSONs for specific districts, say with ids 13, 35, and 71:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getDistricts([13,35,71])
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 6: Get GeoJSONs for all municipalities:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getMunicipalities()
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 7: Get GeoJSONs for specific municipalities, say with ids 123, 145, and 571:

import { BoundaryRequest } from '@klltech/boundaries'

const geojson = new BoundaryRequest()
    .getMunicipalities([123,145,571])
    .doRequest()
    .then((response) => {
        console.log(response) // your response here
    })

Case 8: Convert GeoJSON to TopoJSON:

import { 
    BoundaryRequest, 
    convertToTopo,
} from '@klltech/boundaries'


new BoundaryRequest()
    .getMunicipalities("123,145,571")
    .doRequest()
    .then((response) => {
        convertToTopo(response)   // your response here
    })