Skip to content
C# API for communicating with through the CSW Service
Branch: master
Clone or download
Latest commit a35fb75 Feb 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
GeoNorgeAPI.Tests Set target framework to 4.6.1 Feb 19, 2019
Sample Set target framework to 4.6.1 Feb 19, 2019
.gitignore Ignore jetbrains rider files Feb 19, 2019
GeoNorgeAPI.sln Migrated MSBuild-Integrated solution to use Automatic Package Restore. Oct 3, 2016 Update Readme with security info and examples. Apr 7, 2014


C# API for communicating with through the CSW Service

Getting Started

To install GeoNorgeAPI, run the following command in the Package Manager Console:

PM> Install-Package GeoNorgeAPI

Example code

using GeoNorgeAPI;

public class MyClass {
    public void MyMethod() {
        GeoNorge api = new GeoNorge();
        SearchResultsType result = api.Search("flomsone");
        Console.WriteLine(result.numberOfRecordsMatched + " metadata found");


From version: 2.1.1 (07.04.2014)

The API is using SSL to communicate with Use your credentials like this to perform Insert/update/delete operations:

GeoNorgeAPI.GeoNorge api = new GeoNorgeAPI.GeoNorge("myusername", "mypassword");

MD_Metadata_Type metadata = new MD_Metadata_Type();
// ... add information to the metadata object
var transaction = _geonorge.MetadataInsert(metadata);
Console.WriteLine(transaction.TotalInserted + " metadata inserted.");

Credentials can be acquired from your Geodatakoordinator at Kartverket.


The MD_Metadata_Type is quite large and complex since it is based on the ISO 19139 standard. This project contains a wrapper SimpleMetadata that does all the heavy lifting and manipulating of the MD_Metadata_Type object for you!

Example of use of SimpleMetadata

using GeoNorgeAPI;

GeoNorge api = new GeoNorge("myusername", "mypassword");

SimpleMetadata simpleMetadata = SimpleMetadata.CreateDataset();
simpleMetadata.Title = "This is my dataset!";
simpleMetadata.Abstract = "This is the abstract telling you everything you need to know about this dataset.";
simpleMetadata.ContactPublisher = new SimpleContact
    Name = "John Smith", Email = "", Organization = "My organization", Role = "publisher" 

SimpleMetadata now contains a MD_Metadata_Type that looks like this when serialized to XML:

<?xml version="1.0" encoding="utf-8"?>
<gmd:MD_Metadata xmlns:gml="" xmlns:xsi="" xmlns:csw="" xmlns:gco="" xmlns:srv="" xmlns:gts="" xmlns:gmd="">
    <gmd:MD_ScopeCode codeList="" codeListValue="dataset" />
            <gco:CharacterString>This is my dataset!</gco:CharacterString>
        <gco:CharacterString>This is the abstract telling you everything you need to know about this dataset.</gco:CharacterString>
            <gco:CharacterString>John Smith</gco:CharacterString>
            <gco:CharacterString>My organization</gco:CharacterString>
            <gmd:CI_RoleCode codeList="" codeListValue="publisher" />

The MD_Metadata_Type can be inserted into GeoNorge by using the API like this:

var transaction = _geonorge.MetadataInsert(simpleMetadata.GetMetadata());

The SimpleMetadata wrapper has methods for all fields that is required to be compliant with INSPIRE.

You can’t perform that action at this time.