@arkoblog/nepal-admin-provinces
v1.0.0
Published
This module simply provides a topojson file that contains new administrative boundaries for Nepal.
Downloads
4
Readme
@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);