@aprestmo/norway-geodata 0.1.0 → 0.1.2
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/README.md +21 -21
- package/data/counties-2025.json +77 -0
- package/data/municipalities-2025.json +24798 -0
- package/data/postal-codes-2025.json +15408 -15413
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +45 -45
- package/dist/esm/types.d.ts +18 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -47
- package/dist/types.d.ts +18 -18
- package/package.json +3 -3
- package/data/fylker-2025.json +0 -77
- package/data/kommuner-2025.json +0 -24802
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ console.log(`Found ${municipalities.length} municipalities`);
|
|
|
56
56
|
|
|
57
57
|
// Find Oslo
|
|
58
58
|
const oslo = getMunicipalityById('0301');
|
|
59
|
-
console.log('Oslo population:', oslo?.
|
|
59
|
+
console.log('Oslo population:', oslo?.population);
|
|
60
60
|
|
|
61
61
|
// Search municipalities
|
|
62
62
|
const bergMunicipalities = getMunicipalitiesByName('berg');
|
|
@@ -69,7 +69,7 @@ console.log(`Found ${postalCodes.length} postal codes`);
|
|
|
69
69
|
// Get postal codes with details
|
|
70
70
|
const detailedCodes = getAllPostalCodes(true);
|
|
71
71
|
console.log('First postal code:', detailedCodes[0]);
|
|
72
|
-
// Output: {
|
|
72
|
+
// Output: { code: "0001", place: "Oslo", municipalityId: "0301", municipalityName: "Oslo" }
|
|
73
73
|
|
|
74
74
|
// Get all counties
|
|
75
75
|
const counties = getCounties();
|
|
@@ -96,7 +96,7 @@ console.log(`Total postal codes: ${allPostalCodes.length}`);
|
|
|
96
96
|
// Find a specific postal code
|
|
97
97
|
const osloCenter = getPostalCodeByCode('0001');
|
|
98
98
|
console.log(osloCenter);
|
|
99
|
-
// Output: {
|
|
99
|
+
// Output: { code: "0001", place: "Oslo", id: "0301" }
|
|
100
100
|
|
|
101
101
|
// Search by place name (case-insensitive partial match)
|
|
102
102
|
const bergensPostalCodes = getPostalCodesByPlace('bergen');
|
|
@@ -197,9 +197,9 @@ import type {
|
|
|
197
197
|
const oslo: Municipality | undefined = getMunicipalityById('0301');
|
|
198
198
|
if (oslo) {
|
|
199
199
|
// Full IntelliSense support
|
|
200
|
-
console.log(oslo.
|
|
201
|
-
console.log(oslo.
|
|
202
|
-
console.log(oslo.
|
|
200
|
+
console.log(oslo.name); // string
|
|
201
|
+
console.log(oslo.population); // number
|
|
202
|
+
console.log(oslo.postal_codes); // readonly number[]
|
|
203
203
|
}
|
|
204
204
|
```
|
|
205
205
|
|
|
@@ -208,33 +208,33 @@ if (oslo) {
|
|
|
208
208
|
### Municipality
|
|
209
209
|
```typescript
|
|
210
210
|
interface Municipality {
|
|
211
|
-
readonly
|
|
212
|
-
readonly
|
|
213
|
-
readonly
|
|
214
|
-
readonly
|
|
215
|
-
readonly
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
219
|
-
readonly
|
|
211
|
+
readonly id: string; // "0301" (Oslo)
|
|
212
|
+
readonly name: string; // "Oslo"
|
|
213
|
+
readonly name_no: string; // "Oslo"
|
|
214
|
+
readonly adm_center: string; // "Oslo"
|
|
215
|
+
readonly population: number; // 709037
|
|
216
|
+
readonly area: number; // 454.07
|
|
217
|
+
readonly language: LanguageStatus; // "Nøytral"
|
|
218
|
+
readonly url: string; // "https://oslo.kommune.no"
|
|
219
|
+
readonly postal_codes: readonly number[]; // [179, 180, 181, ...]
|
|
220
220
|
}
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
### County
|
|
224
224
|
```typescript
|
|
225
225
|
interface County {
|
|
226
|
-
readonly
|
|
227
|
-
readonly
|
|
228
|
-
readonly
|
|
226
|
+
readonly id: string; // "03" (Oslo)
|
|
227
|
+
readonly name: string; // "Oslo"
|
|
228
|
+
readonly url: string; // "https://oslo.fylkeskommune.no"
|
|
229
229
|
}
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
### PostalCode
|
|
233
233
|
```typescript
|
|
234
234
|
interface PostalCode {
|
|
235
|
-
readonly
|
|
236
|
-
readonly
|
|
237
|
-
readonly
|
|
235
|
+
readonly code: string; // "0001"
|
|
236
|
+
readonly place: string; // "Oslo"
|
|
237
|
+
readonly id: string; // "0301" (municipality ID)
|
|
238
238
|
}
|
|
239
239
|
```
|
|
240
240
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "03",
|
|
4
|
+
"name": "Oslo",
|
|
5
|
+
"url": "www.oslo.kommune.no"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": "11",
|
|
9
|
+
"name": "Rogaland",
|
|
10
|
+
"url": "www.rogfk.no"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "15",
|
|
14
|
+
"name": "Møre og Romsdal",
|
|
15
|
+
"url": "www.mrfylke.no"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "18",
|
|
19
|
+
"name": "Nordland",
|
|
20
|
+
"url": "www.nfk.no"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "31",
|
|
24
|
+
"name": "Østfold",
|
|
25
|
+
"url": "www.ofk.no"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "32",
|
|
29
|
+
"name": "Akershus",
|
|
30
|
+
"url": "www.afk.no"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "33",
|
|
34
|
+
"name": "Buskerud",
|
|
35
|
+
"url": "www.bfk.no"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "34",
|
|
39
|
+
"name": "Innlandet",
|
|
40
|
+
"url": "www.innlandetfylke.no"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "39",
|
|
44
|
+
"name": "Vestfold",
|
|
45
|
+
"url": "www.vestfoldfylke.no"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "40",
|
|
49
|
+
"name": "Telemark",
|
|
50
|
+
"url": "www.telemarkfylke.no"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "42",
|
|
54
|
+
"name": "Agder",
|
|
55
|
+
"url": "www.agderfk.no"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "46",
|
|
59
|
+
"name": "Vestland",
|
|
60
|
+
"url": "www.vestlandfylke.no"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "50",
|
|
64
|
+
"name": "Trøndelag",
|
|
65
|
+
"url": "www.trondelagfylke.no"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "55",
|
|
69
|
+
"name": "Troms",
|
|
70
|
+
"url": "www.tromsfylke.no"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "56",
|
|
74
|
+
"name": "Finnmark",
|
|
75
|
+
"url": "www.ffk.no"
|
|
76
|
+
}
|
|
77
|
+
]
|