Build GDAL with support for the Norwegian SOSI format

Unix (Tested on Ubuntu 12.04)

Download and build the FYBA library from the National Mapping Authority of Norway (Statens kartverk)

The SOSI driver requires the FYBA library to read and write files in the Norwegian geodata standard format SOSI. OpenFYBA is, a source code release of the FYBA library, is distributed by the National Mapping Authority of Norway (Statens kartverk) and can be downloaded from their git repository: (

The driver has the following dependencies: libtool g++ autoconfig

git clone
cd fyba
autoreconf --force --install
sudo make install
cd ..

This procedure installs the FYBA library (libfyba) and it`s dependencies (libfygm and libfyut) in /usr/local/.

Download and build GDAL

svn checkout gdal
cd gdal
#Recreate the configure script with SOSI support
./configure --with-sosi
sudo make install

In addition, some Linux distributions require the shared library cache to be updated after install:

sudo ldconfig

Windows (Tested on Winows 7 with MS Visual Studio 2012)

Download precompiled .lib- and include-files of the OpenFYBA library from (from folders "include" and "Lib"). Or rebuild them using the project files for MS Visual Studio and build instructions provided here The OpenFYBA library - where the SOSI-driver is build on - consists of three parts: GM.lib, UT.lib, and FYBA.lib.

Download GDAL source code from for GDAL version 1.9.2 or later (plugin-option available since revision 26547).

Uncomment lines regarding SOSI-support in GDALs nmake.opt and set path to where you have your lib-files and include folder for OpenFYBA e.g.: If "SOSI_PLUGIN = YES" is uncommented SOSI-support is built as a plugin and the plugin-.dll deployed in the gdalplugin directory. If SOSI_ENABLED is uncommented it is build "normally" based on the external libs. The options SOSI_ENABLED and SOSI_PLUGIN are mutually exclusive. Uncommenting both will lead to build errors.

# Uncomment for SOSI support
SOSI_INC_DIR = C:/fyba/include
SOSI_LIBS = C:/fyba/Lib/GM.lib C:/fyba/Lib/UT.lib C:/fyba/Lib/FYBA.lib

Build GDAL with MS Visual Studio Use the same compiler for both OpenFYBA and GDAL.

There are older downloads including binary versions for Windows on:

Since the plugin build option has been implemented, a binary version of the plugin is available in OSGeo4W.

Testing the SOSI driver

To test if the driver has been loaded, execute the following (look for "SOSI" in the results):

ogrinfo --formats

Then test with a sample file (such as

ogrinfo 20BygnAnlegg.SOS

Note: When accessing a SOSI file, the SOSI driver writes out indices into a subfolder within the same directory where your SOSI files (.sos) are stored. Therefore you have to have write access to the directory containing your SOSI files.

Usage examples

Convert layers of all SOSI-files in the current directory to shape-format:

for s in $(ls ${dir}/*.sos)
	name=$(echo $s | cut -f1 -d'.')
	layers=$(ogrinfo $s)
	if [ $(echo $layers | grep points | wc -l) -eq 1 ] ; then
		ogr2ogr ${name}_pnt.shp $s points

	if [ $(echo $layers | grep lines | wc -l) -eq 1 ] ; then
		ogr2ogr ${name}_lin.shp $s lines

	if [ $(echo $layers | grep polygons | wc -l) -eq 1 ] ; then
		ogr2ogr ${name}_pol.shp $s polygons

Or - even simpler - convert SOSI to SQLite format. SQLite is more similar to SOSI as it allows for several layers and it is less limiting regarding column names:

for s in $(ls ${dir}/*.sos)
	name=$(echo $s | cut -f1 -d'.')
	ogr2ogr -f SQLite ${name}.sqlite $s

Open Tickets

No results

Last modified 7 years ago Last modified on Jun 24, 2016, 1:53:46 PM
Note: See TracWiki for help on using the wiki.