nepal-administrative-map 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1
4
+
5
+ Initial npm release (React sister of Flutter `nepal_administrative_map`):
6
+
7
+ - Interactive Canvas map: 7 provinces, 77 districts, 753 local levels
8
+ - Bilingual English / Nepali names, labels, tooltips and numbers
9
+ - Drill-down with animated zoom, pan/pinch/wheel, selection
10
+ - Choropleth colour scales, legend, search, markers, protected areas
11
+ - Typed gazetteer (`Province.gandaki`, `District.kaski`, …) and `nepal-administrative-map/core` entry
12
+ - Bundled TopoJSON (~423 KB); MIT code + CC BY 4.0 map data
@@ -0,0 +1,44 @@
1
+ # Data license
2
+
3
+ The boundary data in `assets/maps/nepal.topo.json` and the region names and
4
+ codes in `src/core/gazetteer/regions.generated.ts` are licensed under
5
+ [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
6
+
7
+ The package's source code is licensed separately under the MIT License; see
8
+ [LICENSE](LICENSE).
9
+
10
+ ## Source
11
+
12
+ **LocalBoundaries** by Open Knowledge Foundation Nepal (OKNP),
13
+ <https://localboundries.oknp.org/download/>, licensed under CC BY 4.0.
14
+ Downloaded 2026-10-09 ("All Nepal (777 units)" local-level TopoJSON).
15
+
16
+ This package is not affiliated with or endorsed by OKNP.
17
+
18
+ ## Changes made
19
+
20
+ The original data was modified as follows:
21
+
22
+ - **Simplified** with mapshaper (Visvalingam, weighted, 40% of points kept)
23
+ and re-quantized (1e5 grid).
24
+ - **Districts and provinces rebuilt** by dissolving local-level boundaries,
25
+ so all three levels share identical borders. (The source's own province
26
+ file was not used.)
27
+ - **Merged** the two municipalities that the source splits into separate
28
+ polygons (Bansagadhi, Bardiya; Binayee Tribeni, Nawalparasi East).
29
+ - **Separated** the 22 protected-area polygons (10 protected areas lying
30
+ outside any local level) from the local levels.
31
+ - **Renamed** some regions to current or common spellings, keeping the
32
+ source spelling as an alias: Pokhara Lekhnath → Pokhara; districts
33
+ Chitawan → Chitwan, Kabhrepalanchok → Kavrepalanchok, Makawanpur →
34
+ Makwanpur, Tanahu → Tanahun, Kapilbastu → Kapilvastu, Nawalparasi_E/W →
35
+ Nawalparasi East/West, Rukum_E/W → Rukum East/West.
36
+ - **Added** stable region codes and Nepali (Devanagari) names, which are not
37
+ part of the source data. See the Flutter package's `tool/source/names.csv`.
38
+ - **Removed** all source attributes; each feature carries only its code.
39
+
40
+ ## Attribution in apps
41
+
42
+ When you ship this package's map, credit the data, for example:
43
+
44
+ > Boundary data: © OKNP LocalBoundaries, CC BY 4.0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abhishek Sharma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,147 @@
1
- # Temporary Holding Version
1
+ # nepal-administrative-map
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/nepal-administrative-map.svg)](https://www.npmjs.com/package/nepal-administrative-map)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ An interactive administrative map of Nepal for **React**: **7 provinces,
7
+ 77 districts and 753 local levels**, in **English and Nepali (नेपाली)**.
8
+
9
+ Sister package to the Flutter
10
+ [`nepal_administrative_map`](https://pub.dev/packages/nepal_administrative_map)
11
+ pub package — same data, codes, and feature set.
12
+
13
+ - **One component to start:** `<NepalMap />` — no API keys, offline, ~422 KB bundled TopoJSON
14
+ - **Bilingual:** names, labels, tooltips, legends and numbers in English or Nepali
15
+ - **Interactive:** zoom, pan, tap to select, hover tooltips, and animated drill-down province → district → local level
16
+ - **Data maps:** choropleth colouring with legend, markers, and place search
17
+ - **Typed regions:** `District.kaski`, `LocalLevel.pokhara`, stable codes for clean joins
18
+ - **Zero runtime dependencies** besides React (peer)
19
+
20
+ | Provinces in Nepali | Dark mode |
21
+ |---|---|
22
+ | ![Provinces coloured by area, in Nepali](assets/screenshots/provinces_nepali.jpg) | ![Province map in dark mode](assets/screenshots/provinces_dark.jpg) |
23
+ | **Overlays and bilingual labels** | **All 77 districts** |
24
+ | ![Protected areas, city markers and bilingual labels](assets/screenshots/overlays_bilingual.jpg) | ![Districts with English and Nepali labels](assets/screenshots/districts_bilingual.jpg) |
25
+ | **Local levels by type** | |
26
+ | ![Local levels coloured by type, with a tooltip](assets/screenshots/local_level_types.jpg) | |
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ npm install nepal-administrative-map
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```tsx
37
+ import { NepalMap, AdminLevel } from 'nepal-administrative-map';
38
+ import topoUrl from 'nepal-administrative-map/assets/maps/nepal.topo.json?url';
39
+
40
+ export function App() {
41
+ return (
42
+ <div style={{ height: 480 }}>
43
+ <NepalMap
44
+ mapDataUrl={topoUrl}
45
+ level={AdminLevel.district.id}
46
+ onRegionTap={(region) => console.log(region.fullName('en'))}
47
+ />
48
+ </div>
49
+ );
50
+ }
51
+ ```
52
+
53
+ > Pass `mapDataUrl` to the bundled TopoJSON (Vite `?url`, webpack asset modules, or copy the file into your `public/` folder). Framework-agnostic data APIs are also available from `nepal-administrative-map/core`.
54
+
55
+ ## Common setups
56
+
57
+ ```tsx
58
+ // Provinces (default), tap to select
59
+ <NepalMap mapDataUrl={topoUrl} />
60
+
61
+ // Drill down with animated zoom: province → districts → local levels
62
+ <NepalMap mapDataUrl={topoUrl} drillDown animationDuration={400} />
63
+
64
+ // Gandaki's districts, in Nepali
65
+ import { Province } from 'nepal-administrative-map';
66
+ <NepalMap
67
+ mapDataUrl={topoUrl}
68
+ level="district"
69
+ scope={Province.gandaki}
70
+ language="ne"
71
+ />
72
+
73
+ // Choropleth
74
+ import { Choropleth, ColorScale, District, LocalizedName } from 'nepal-administrative-map';
75
+ <NepalMap
76
+ mapDataUrl={topoUrl}
77
+ level="district"
78
+ choropleth={new Choropleth({
79
+ values: new Map([
80
+ [District.kathmandu, 1744240],
81
+ [District.lalitpur, 548401],
82
+ ]),
83
+ scale: ColorScale.sequential('#fff8e1', '#e65100'),
84
+ title: new LocalizedName('Population', 'जनसंख्या'),
85
+ })}
86
+ />
87
+
88
+ // Controller
89
+ import { useNepalMapController, NepalMapBreadcrumb, NepalMapSearchField } from 'nepal-administrative-map';
90
+
91
+ const controller = useNepalMapController();
92
+ <>
93
+ <NepalMapBreadcrumb controller={controller} />
94
+ <NepalMapSearchField controller={controller} />
95
+ <NepalMap mapDataUrl={topoUrl} controller={controller} drillDown />
96
+ </>
97
+ ```
98
+
99
+ ## API overview
100
+
101
+ | Export | Role |
102
+ |---|---|
103
+ | `NepalMap` | Main React map component |
104
+ | `NepalMapController` / `useNepalMapController` | Select, zoom, drill, language, `toPngBlob` |
105
+ | `NepalMapBreadcrumb` | Nepal › Province › District |
106
+ | `NepalMapSearchField` | Autocomplete search |
107
+ | `NepalMapLegend` | Choropleth legend (also embedded when `showLegend`) |
108
+ | `Choropleth` / `ColorScale` | Data colouring (sequential, diverging, threshold, categorical) |
109
+ | `Province` / `District` / `LocalLevel` / `ProtectedArea` | Typed gazetteer |
110
+ | `Nepal.byCode` / `Nepal.search` / `NepalMapData` | Core data & geometry (also via `/core`) |
111
+
112
+ ## Attribution
113
+
114
+ Map boundary data is **CC BY 4.0** (OKNP LocalBoundaries). See [DATA_LICENSE.md](DATA_LICENSE.md).
115
+ The map shows attribution by default; keep it visible or credit equivalently in your UI.
116
+
117
+ ## Example
118
+
119
+ ```sh
120
+ cd example
121
+ npm install
122
+ npm run dev
123
+ ```
124
+
125
+ ## Development
126
+
127
+ ```sh
128
+ npm install
129
+ npm run generate # gazetteer from Flutter names.csv (optional if already generated)
130
+ npm run build # dist/ for npm publish
131
+ npm run pack:check # preview tarball contents
132
+ ```
133
+
134
+ ## Publishing
135
+
136
+ ```sh
137
+ cd nepal-administrative-map
138
+ npm login
139
+ npm run build
140
+ npm publish
141
+ ```
142
+
143
+ Package name: [`nepal-administrative-map`](https://www.npmjs.com/package/nepal-administrative-map) (currently unpublished). Requires Node 18+.
144
+
145
+ ## License
146
+
147
+ MIT (code) · CC BY 4.0 (map data / names / codes)