Gathering detailed insights and metrics for @aprestmo/norway-geodata
Gathering detailed insights and metrics for @aprestmo/norway-geodata
Gathering detailed insights and metrics for @aprestmo/norway-geodata
Gathering detailed insights and metrics for @aprestmo/norway-geodata
Complete 2025 Norwegian administrative geodata library with TypeScript support. Includes municipalities, counties, postal codes, and 25+ utility functions.
npm install @aprestmo/norway-geodata
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (84.53%)
JavaScript (15.47%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
15 Commits
1 Branches
1 Contributors
Updated on Jul 06, 2025
Latest Version
0.1.4
Package Id
@aprestmo/norway-geodata@0.1.4
Unpacked Size
849.34 kB
Size
79.29 kB
File Count
14
NPM Version
11.4.1
Node Version
22.14.0
Published on
Jun 08, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
📍 Complete administrative geographic data for Norway (2025) with TypeScript support - municipalities, counties, postal codes, and 35+ utility functions.
1npm install @aprestmo/norway-geodata
1# Configure npm for GitHub Packages 2npm config set @aprestmo:registry https://npm.pkg.github.com 3npm config set //npm.pkg.github.com/:_authToken YOUR_GITHUB_TOKEN 4 5# Install 6npm install @aprestmo/norway-geodata
Requires a GitHub personal access token with
read:packages
permission.
1import { 2 getMunicipalities, 3 getCounties, 4 getMunicipalityById, 5 getMunicipalitiesByName, 6 getAllPostalCodes, 7 type Municipality, 8 type County 9} from '@aprestmo/norway-geodata'; 10 11// Get all municipalities 12const municipalities = getMunicipalities(); 13console.log(`Found ${municipalities.length} municipalities`); 14 15// Find Oslo 16const oslo = getMunicipalityById('0301'); 17console.log('Oslo population:', oslo?.population); 18 19// Search municipalities 20const bergMunicipalities = getMunicipalitiesByName('berg'); 21console.log('Found:', bergMunicipalities.length); 22 23// Get all postal codes 24const postalCodes = getAllPostalCodes(); 25console.log(`Found ${postalCodes.length} postal codes`); 26 27// Get postal codes with details 28const detailedCodes = getAllPostalCodes(true); 29console.log('First postal code:', detailedCodes[0]); 30// Output: { code: "0001", place: "Oslo", municipalityId: "0301", municipalityName: "Oslo" } 31 32// Get all counties 33const counties = getCounties(); 34console.log(`Found ${counties.length} counties`);
1import { 2 getPostalCodes, 3 getPostalCodeByCode, 4 getPostalCodesByPlace, 5 getPostalCodesByMunicipalityId, 6 getUniquePostalPlaces, 7 isValidPostalCode, 8 type PostalCode 9} from '@aprestmo/norway-geodata'; 10 11// Get all postal codes 12const allPostalCodes = getPostalCodes(); 13console.log(`Total postal codes: ${allPostalCodes.length}`); 14 15// Find a specific postal code 16const osloCenter = getPostalCodeByCode('0001'); 17console.log(osloCenter); 18// Output: { code: "0001", place: "Oslo", id: "0301" } 19 20// Search by place name (case-insensitive partial match) 21const bergensPostalCodes = getPostalCodesByPlace('bergen'); 22console.log(`Bergen postal codes: ${bergensPostalCodes.length}`); 23 24// Get postal codes for a municipality 25const osloPostalCodes = getPostalCodesByMunicipalityId('0301'); 26console.log(`Oslo has ${osloPostalCodes.length} postal codes`); 27 28// Check if postal code exists 29const isValid = isValidPostalCode('0001'); 30console.log(`0001 is valid: ${isValid}`); 31 32// Get unique postal places 33const uniquePlaces = getUniquePostalPlaces(); 34console.log(`Unique places: ${uniquePlaces.length}`);
getVersion()
- Get library versiongetMunicipalities()
- Get all municipalitiesgetCounties()
- Get all countiesgetMunicipalityById(id: string)
- Get municipality by IDgetMunicipalitiesByName(name: string, options?: MunicipalitySearchOptions)
- Search by name with optionsgetMunicipalitiesByCounty(countyId: string)
- Get municipalities in countygetMunicipalityByPostalCode(postalCode: string | number)
- Get municipality by postal codegetPostalCodesByMunicipality(municipalityId: string)
- Get postal codes for municipalitygetAllPostalCodes(includeDetails?: boolean)
- Get all postal codes, optionally with place names and municipality infogetMunicipalitiesByPopulation(ascending?: boolean)
- Sort by populationgetMunicipalitiesByArea(ascending?: boolean)
- Sort by areagetMunicipalitiesByLanguage(language: LanguageStatus)
- Filter by language statusgetMunicipalitiesFiltered(options: MunicipalityFilterOptions)
- Advanced filteringgetMunicipalitiesByPopulationDensity(min?: number, max?: number)
- Filter by densitygetLargestMunicipalities(count?: number)
- Get largest by populationgetSmallestMunicipalities(count?: number)
- Get smallest by populationgetCountyById(id: string)
- Get county by IDgetCountyByName(name: string, exactMatch?: boolean)
- Search county by namegetPostalCodes()
- Get all postal codes with metadatagetPostalCodeByCode(code: string)
- Get postal code information by codegetPostalCodesByPlace(place: string, options?: PostalCodeSearchOptions)
- Search by postal place namegetPostalCodesByMunicipalityId(municipalityId: string)
- Get postal codes for municipalitygetPostalCodesByMunicipalityName(municipalityName: string, exactMatch?: boolean)
- Get postal codes by municipality namegetUniquePostalPlaces()
- Get all unique postal place namesgetPostalCodesInRange(startCode: string, endCode: string)
- Get postal codes within rangegetPostalCodesSorted(ascending?: boolean)
- Get sorted postal codesgetPostalCodesStats()
- Get postal codes statisticsisValidPostalCode(code: string)
- Check if postal code existsgetTotalPopulation(): number
- Total population of NorwaygetTotalArea(): number
- Total area of NorwaygetPopulationDensityStats(): PopulationDensityStats
- Population density statisticsAll TypeScript interfaces and types are exported:
1import type { 2 Municipality, 3 County, 4 PostalCode, 5 LanguageStatus, 6 PopulationDensityStats, 7 MunicipalitySearchOptions, 8 MunicipalityFilterOptions, 9 PostalCodeSearchOptions 10} from '@aprestmo/norway-geodata';
Full TypeScript support with strict type safety:
1import type { 2 Municipality, 3 County, 4 LanguageStatus, 5 MunicipalitySearchOptions, 6 MunicipalityFilterOptions 7} from '@aprestmo/norway-geodata'; 8 9// Type-safe operations 10const oslo: Municipality | undefined = getMunicipalityById('0301'); 11if (oslo) { 12 // Full IntelliSense support 13 console.log(oslo.name); // string 14 console.log(oslo.population); // number 15 console.log(oslo.postal_codes); // readonly number[] 16}
1interface Municipality { 2 readonly id: string; // "0301" (Oslo) 3 readonly name: string; // "Oslo" 4 readonly name_no: string; // "Oslo" 5 readonly adm_center: string; // "Oslo" 6 readonly population: number; // 709037 7 readonly area: number; // 454.07 8 readonly language: LanguageStatus; // "Nøytral" 9 readonly url: string; // "https://oslo.kommune.no" 10 readonly postal_codes: readonly number[]; // [179, 180, 181, ...] 11}
1interface County { 2 readonly id: string; // "03" (Oslo) 3 readonly name: string; // "Oslo" 4 readonly url: string; // "https://oslo.fylkeskommune.no" 5}
1interface PostalCode { 2 readonly code: string; // "0001" 3 readonly place: string; // "Oslo" 4 readonly id: string; // "0301" (municipality ID) 5}
1interface MunicipalitySearchOptions { 2 readonly includeAllNames?: boolean; // Search both EN/NO names 3 readonly caseSensitive?: boolean; // Case sensitive 4 readonly exactMatch?: boolean; // Exact match only 5} 6 7interface MunicipalityFilterOptions { 8 readonly minPopulation?: number; 9 readonly maxPopulation?: number; 10 readonly minArea?: number; // km² 11 readonly maxArea?: number; // km² 12 readonly language?: LanguageStatus; 13 readonly countyId?: string; 14} 15 16interface PostalCodeSearchOptions { 17 readonly caseSensitive?: boolean; // Case sensitive search 18 readonly exactMatch?: boolean; // Exact match only 19} 20 21type LanguageStatus = 'Nøytral' | 'Bokmål' | 'Nynorsk';
Contributions are welcome! Please see CONTRIBUTING.md for detailed guidelines.
All contributions go through automated validation and testing.
MIT License - see LICENSE file for details.
No vulnerabilities found.
No security vulnerabilities found.