@arkoblog/nepal-admin-districts
v1.0.2
Published
A package that provides you a district level topoJSON for the Nepal
Downloads
2
Readme
@arkoblog/nepal-admin-districts
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-districts
After importing you can easily use the topojson through leaflet as follows:
import L from 'leaflet';
import districts from '@arkoblog/nepal-admin-districts';
// 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(districts)
topoLayer.addTo(map);