Arbeidstilsynet.Common.GeoNorge
2.2.0
See the version list below for details.
dotnet add package Arbeidstilsynet.Common.GeoNorge --version 2.2.0
NuGet\Install-Package Arbeidstilsynet.Common.GeoNorge -Version 2.2.0
<PackageReference Include="Arbeidstilsynet.Common.GeoNorge" Version="2.2.0" />
<PackageVersion Include="Arbeidstilsynet.Common.GeoNorge" Version="2.2.0" />
<PackageReference Include="Arbeidstilsynet.Common.GeoNorge" />
paket add Arbeidstilsynet.Common.GeoNorge --version 2.2.0
#r "nuget: Arbeidstilsynet.Common.GeoNorge, 2.2.0"
#:package Arbeidstilsynet.Common.GeoNorge@2.2.0
#addin nuget:?package=Arbeidstilsynet.Common.GeoNorge&version=2.2.0
#tool nuget:?package=Arbeidstilsynet.Common.GeoNorge&version=2.2.0
Introduction
This package provides an abstraction for the GeoNorge APIs Adresser and Fylker og Kommuner, and some useful extension methods if you need to:
- find the closest address to a given coordinate
- find the location of a specific address
- get information about Norwegian counties (fylker) and municipalities (kommuner)
📖 Installation
To install GeoNorge, you can use the following command in your terminal:
dotnet add package Arbeidstilsynet.Common.GeoNorge
🧑💻 Usage
Add to your service collection:
public static IServiceCollection AddServices
(
this IServiceCollection services,
DatabaseConfiguration databaseConfiguration
) {
services.AddGeoNorge();
return services;
}
Address Search Examples
public class AddressService
{
private readonly IAddressSearch _addressSearch;
// Inject the IAddressSearch interface into your service
public AddressService(IAddressSearch addressSearch)
{
_addressSearch = addressSearch;
}
public async Task Examples()
{
// Find the closest address to a given coordinate:
var address = await _addressSearch.GetClosestAddress(new PointSearchQuery{
Latitude = 59.9139,
Longitude = 10.7522,
RadiusInMeters = 1000
});
// If you want to find all addresses within a certain radius of a point:
var paginatedResult = await _addressSearch.SearchAddressesByPoint(new PointSearchQuery
{
Latitude = 59.9139,
Longitude = 10.7522,
RadiusInMeters = 1000
});
// Search for addresses by a text query:
var paginatedResult = await _addressSearch.SearchAddresses(new TextSearchQuery
{
SearchTerm = "Karl Johans gate 1, Oslo"
});
// If you only want the first result, you can use the QuickSearchLocation extension method:
var location = await _addressSearch.QuickSearchLocation(new TextSearchQuery
{
SearchTerm = "Karl Johans gate 1, Oslo"
});
}
}
County and Municipality Examples
public class LocationService
{
private readonly IFylkeKommuneApi _fylkeKommuneApi;
// Inject the IFylkeKommuneApi interface into your service
public LocationService(IFylkeKommuneApi fylkeKommuneApi)
{
_fylkeKommuneApi = fylkeKommuneApi;
}
public async Task Examples()
{
// Get all Norwegian counties (fylker):
var fylker = await _fylkeKommuneApi.GetFylker();
// Get all Norwegian municipalities (kommuner):
var kommuner = await _fylkeKommuneApi.GetKommuner();
// Get detailed information about all counties:
var fylkerFullInfo = await _fylkeKommuneApi.GetFylkerFullInfo();
// Get a specific county by number:
var oslo = await _fylkeKommuneApi.GetFylkeByNumber("03");
// Get detailed information about a specific municipality:
var osloKommune = await _fylkeKommuneApi.GetKommuneByNumber("0301");
// Find which municipality contains a specific point:
var kommune = await _fylkeKommuneApi.GetKommuneByPoint(new PointQuery
{
Latitude = 59.9139,
Longitude = 10.7522
});
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Arbeidstilsynet.Common.AspNetCore.Extensions (>= 2.2.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Http.Resilience (>= 10.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.1-alpha2 | 44 | 4/16/2026 |
| 2.2.1-alpha | 44 | 4/16/2026 |
| 2.2.0 | 96 | 3/6/2026 |
| 2.1.1 | 98 | 2/18/2026 |
| 2.1.1-beta1 | 93 | 2/18/2026 |
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added <!-- for new features. -->
### Changed <!-- for changes in existing functionality. -->
### Deprecated <!-- for soon-to-be removed features. -->
### Removed <!-- for now removed features. -->
### Fixed <!-- for any bug fixes. -->
### Security <!-- in case of vulnerabilities. -->
## 2.2.0
### Changed
- changed(deps): Applied minor and patch updates to dependencies
## 2.1.1
### Changed
- chore: moved package to nuget.org
## 2.1.0
### Changed
- changed(deps): Applied minor and patch updates to dependencies
## 2.0.1
### Changed
- changed(deps): Updated internal package referances (remove prerelease version)
## 2.0.0
### Changed
- changed(deps): Major dotnet updated (v10)
## 1.1.0
### Changed
- fix(deps): use correct version range to only support Microsoft version 8.* packages
## 1.0.1
### Changed
- chore(renovate): all non major update
## 1.0.0
### Added
- Added support for parts of the [kommuneinfo API](https://ws.geonorge.no/kommuneinfo/v1/)
- `/fylker`
- `/fylker/{fylkesnummer}`
- `/kommuner`
- `/kommuner/{kommunenummer}`
- `/punkt` - for getting a kommune and fylke at a specific coordinate
- `/fylkerkommuner` - for details on all fylker (and kommuner) in Norway
## 0.0.2
### Fixed
- Replaced a query parameter handling with the implementation from AspNetCore.Extensions
## 0.0.1
### Added
- Added implementation of the [GeoNorge API](https://ws.geonorge.no/adresser/v1).
- `/sok` with pagination
- `/punktsok` with pagination
- Added extension methods for common access patterns
- `GetClosestAddress` for getting the closest address returned from `/punktsok`
- `QuickSearchLocation` for getting the first hit returned from `/sok`