@arkoblog/nepal-admin-provinces

1.0.0 • Public • Published

@arkoblog/nepal-admin-provinces

This module simply provides a topojson file that contains new administrative boundaries for Nepal.

Usage

Import the module through npm: npm install @arkoblog/nepal-admin-provinces

After importing you can easily use the topojson through leaflet as follows:

import L from 'leaflet';
import provinces from '@arkoblog/nepal-admin-provinces';

// some javascript code to initialize Leaflet Map here

L.TopoJSON = L.GeoJSON.extend({
  addData(jsonData) {
    if (jsonData.type === 'Topology') {
      for (const key in jsonData.objects) {
        const geojson = topojson.feature(jsonData, jsonData.objects[key]);
        L.GeoJSON.prototype.addData.call(this, geojson);
      }
    } else {
      L.GeoJSON.prototype.addData.call(this, jsonData);
    }
  },
});

const topoLayer = new L.TopoJSON();
topoLayer.addData(provinces)
topoLayer.addTo(map);

Readme

Keywords

none

Package Sidebar

Install

npm i @arkoblog/nepal-admin-provinces

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • arkoblog