1.6.1 • Published 7 years ago

new-nepal-topojson v1.6.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

new-nepal-topojson

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

Usage

Import the module through npm: npm install new-nepal-topojson

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

import L from 'leaflet';
import { municipalities } from 'new-nepal-topojson';
import { districts } from 'new-nepal-topojson';

// 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(municipalities);
topoLayer.addData(districts)
topoLayer.addTo(map);
1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago