npm package: @klltech/boundaries
Description: JavaScript package to provide GeoJSON files based on new admin boundaries by Government of Nepal
Author: Arogya Koirala, Saurav Bhattarai, Hel Nershing Thapa
Latest version: 1.0.1

# @klltech/boundaries

<p>
  <a href="https://www.npmjs.com/package/@klltech/boundaries" target="_blank">
    <img alt="Version" src="https://img.shields.io/npm/v/@klltech/boundaries.svg">
  </a>
  <a href="#" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
  </a>
</p>

**@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**

```sh
$ npm install --save @klltech/boundaries
```

### **Source**

[नेपालको नक्सा (राजनीतिक तथा प्रशासनिक)को Shapefile (GIS Data)](http://www.dos.gov.np/download/news-events/shapefilegis-data-for-political-and-administrative-map-of-nepal?fbclid=IwAR2tmVEEkS9-EopEYQAtIu-Nedk83jrkohFAhbGmIoWKBbRnGD-BRseq1sA) - 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 :*

```js
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:*

```js
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:*

```js
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:*

```js
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:*

```js
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:*

```js
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:*

```js
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:*

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


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

```