QGIS with SOSI support on Windows

Denne posten er også tilgjengelig på norsk.

  • Download and run the OSGeo4W network installer, rather than standalone QGIS
  • Choose advanced installation
  • Select your preferred QGIS version to install from the Desktop category [2]
  • Select the package named gdal-sosi from the Libs category to install alongside QGIS
  • Run C:\OSGeo4W\bin\ogrinfo.exe ‐‐formats (if you chose to install in the default location) and verify that SOSI is on the list of supported formats
  • Run QGIS and under Settings -> System verify that GDAL_DRIVER_PATH is set to C:\OSGeo4W\bin\gdalplugins

That’s it! But in reality you might prefer to just convert the SOSI files to a different format:

Option 1: A new tool by Espen Andersen, sosicon, now makes it very easy to convert SOSI files to ESRI Shape format. If it is not necessary to access SOSI files directly in QGIS (or you’re not using QGIS at all) I recommend you try sosicon first. Windows, Linux and Mac OS X versions are available at Andersen’s github.

Option 2: QGIS, GRASS and other open source GIS-software rely on the GDAL and OGR libraries to access raster and vector data, and these come with their own command line tools that can be used to convert your files without involving QGIS. Previously you would have had to compile your own replacement library first to get SOSI support, like you do on Linux and OSX, but an easier option is now available for Windows users.

To convert files with the ogr2ogr tool: [3]

  • C:\OSGeo4W\bin\ogr2ogr.exe <output>.shp <input>.sosi <layer>
  • (Or just ogr2ogr <output>.shp <input>.sosi <layer> if you use the OSGeo4W Shell)

With <layer> typically being one of points, lines or polygons, like:

  • C:\OSGeo4W\bin\ogr2ogr.exe somefile_pol.shp somefile.sosi polygons

“ESRI Shapefile” is the default output format; to specify another (write-enabled) format, add the -f option and the name as written in the list of supported formats, like:

  • C:\OSGeo4W\bin\ogr2ogr.exe -f “GPX” paths.gpx tfr.sosi lines

You could also create a script to automate this final step, or try my script version for linux or windows.



1: Converting to the Shape format will cause long attribute names to be truncated at ten characters; this is usually not a problem.

2: If you’re using a multi-core/CPU computer and QGIS 2.4 or newer, make sure you enable multi-threaded/parallel rendering from the settings->options->rendering menu.

3: Norwegian SOSI files tend to contain Norwegian characters, that may get lost in conversion. In such cases explicitly defining input and output character sets via SHAPE_ENCODING and ENCODING has solved the issue for me.

QGIS med SOSI-støtte på Ubuntu 13.10

This post is also available in English.

Oppdatering: Ett nytt verktøy fra Espen Andersen, sosicon, gjør det veldig enkelt å konvertere SOSI-filer til ESRI Shape-formatet. Dersom det ikke er nødvendig å åpne SOSI-filer direkte i QGIS (eller du ikke bruker QGIS i det hele tatt) anbefaler jeg at du prøver sosicon først. Windows, Linux og Mac OS X-utgaver er tilgjengelige på Andersens github.

I det siste har jeg syslet litt med QGIS og GRASS, to GIS-programmer som er basert på åpen kildekode og tilgjengelige for Linux, OSX og Windows.

Det er stort sett datasett fra Kartverket som er interessante for meg, hvilket innebærer at det er veldig nyttig å kunne arbeide med det særnorske SOSI-formatet. Begge GIS-programmene baserer seg på bruk av GDAL og OGR for å håndtere raster og vektordata, men for å få SOSI-støtte må du fjerne det vanlige GDAL-biblioteket og kompilere et nytt bibliotek selv, med SOSI-støtte aktivert.

Dette er fremgangsmåten jeg benyttet for å få tilgang til SOSI:

  1. Avinstallér gdal-bin-pakken
  2. Følg instruksjonene på trac.osgeo.org/gdal/wiki/SOSI (kun engelsk):
    • Installér nødvendige pakker (dependencies) som du ikke allerede har
    • Last ned og bygg Kartverkets FYBA-bibliotek
    • Last ned og bygg GDAL med SOSI aktivert (byggeprosessen tok nærmere en time på min meget saktegående maskin)
    • Jeg måtte oppdatere mellomlageret for biblioteker (libcache)
  3. Ett eller annet sted på veien viste det seg at Python-støtten i QGIS hadde blitt avinstallert (og den vil du gjerne ha i behold) så reinstallér python-qgis-pakken ved behov
  4. Tada! Jeg kan nyte SOSIser!

En positiv bivirkning av denne prosessen er at det virker som om QGIS håndterer vektor-data raskere med den nyere bibliotek-versjonen, men det kan være noe jeg innbiller meg.

Merk: Hvis du ønsker å konvertere .sosi-filer til et annet format, er ogr2ogr riktig verktøy. Ta en titt på Windows-versjonen av denne posten for litt mer info om akkurat det.

QGIS with SOSI support on Ubuntu 13.10

Denne posten er også tilgjengelig på norsk.

Update: A new tool by Espen Andersen, sosicon, now makes it very easy to convert SOSI files to ESRI Shape format. If it is not necessary to access SOSI files directly in QGIS (or you’re not using QGIS at all) I recommend you try sosicon first. Windows, Linux and Mac OS X versions are available at Andersen’s github.

I have recently been familiarising myself with QGIS and GRASS, two open source GIS suites that are available in Linux, OSX and Windows versions.

The datasets I am interested in are mostly from the Norwegian Mapping Authority, which means that being able to work with the Norwegian SOSI format is quite useful. Both of the GIS packages rely on GDAL and OGR for accessing raster and vector data, but to get SOSI support, you will have to remove the standard GDAL library and compile the library yourself, with SOSI enabled.

These are the steps I took to get SOSI support:

  1. Uninstall the gdal-bin package
  2. Follow the instructions at trac.osgeo.org/gdal/wiki/SOSI:
    • Install the dependencies, unless they are already installed
    • Download and build the Mapping Authority’s FYBA library
    • Download and build GDAL with SOSI enabled (building took close to an hour on my really slow computer)
    • I had to update the library cache (on Ubuntu 13.10)
  3. Somewhere along the path QGIS’ Python support had been uninstalled (and you probably want to have it) so just reinstall the python-qgis package
  4. Tada! I’m enjoying SOSIges!

As an added bonus, it feels like handling vector data is faster with the newer library, but that might be my imagination.

Note: If you would like to convert .sosi files into a different format, you want the ogr2ogr tool. Have a look at my Windows version of this post for a little more info on that.

Haugfjell Panorama

This 360° panorama was shot at the summit of Haugfjell, above Rombaksbotn in Narvik, Norway. Rombaksbotn was a company town for a few years around the end of the 19th century, when the Ofotbanen/Malmbanan railway line was being constructed. The line was built to transport iron ore from the mines in Sweden to the harbour in Narvik, and is visible on the opposite side of the Rombaksfjord. Katterat is an important station for local tourism on the line, being used as a starting point for skiing in the winter and hiking in the summer season.

Narvik Panorama

This is a panorama I shot from the top floor of Narvik’s new Rica Hotel. The pictures were taken a while after sunset, and the panorama covers the view to the west and north from roughly mid town. Just left of center is LKAB’s iron ore harbour, and hither the remains of the old industrial area the town was built around; now under partial redevelopment.

Tempelfjord Panorama

This 360° view is composed of about a dozen pictures I took on 22 April 2013, on the sea ice of Svalbard’s Tempelfjord, in front of the Von Post glacier.

When taking pictures for a panorama, it is generally good practice to mount the camera on a tripod and keep settings unchanged between frames. The pictures used for this panorama were shot in full auto mode with a hand-held compact camera, and not post-processed in any way, which shows in the result.

The panorama was assembled with Hugin, an open-source panorama photo stitching program, and I think it did well considering the source material. Pictures with very high aspect ratio (width vs. height) are kind of awkward to display, but the Google Maps engine serves as a nice viewer. An application called GMap Image Cutter does the job of slicing the panorama into tiles suitable for the map engine, and also provides the necessary JavaScript framework for it.

On this particular panorama, I’ve added place marks to point out a few features around the fjord. The Norwegian Polar Institute has a nice topographical map of the area.

DHC-6 Twin Otter

The de Havilland Canada DHC-6 Twin Otter was one of the very first types of aircraft I travelled on, and is still the smallest one. Even the Do-228 has a considerably higher MTOW, though their capacity is equal at 19 passengers in the relevant configurations.

Widerøe Twin Otter at Leknes in 1992
Widerøe Twin Otter at Leknes in 1992 (Photo Felix Götting / Wikimedia Commons / GFDL-1.2)

Twin Otters, mainly operated by Widerøe (WF), were the backbone of operations on Norway’s extensive network of short-field airports for decades, providing a means of transportation between towns and villages and major airports where long distances and complicated topography makes rail or road transportation impractical.

Widerøe, which at one point was the world’s largest Twin Otter operator, introduced the aircraft in 1968, and retired their last one in 2000.

Air Berlin

Air Berlin, which is headquartered in Berlin, is Germany’s second largest airline in terms of passengers. At the time of its founding in 1978, it was headquartered in Miami, Florida, for legal reasons regarding post World War II regulation of air traffic in and out of Berlin.

Air Berlin fleet at Tegel
Air Berlin fleet at Tegel (Photo Christine Hepner / Creative Commons / CC-BY-SA-3.0)

The airline joined the Oneworld alliance in 2012, and I first travelled with them in June 2013, on a Boeing 737-700 out of their home base at Tegel.

Schönefeld (Berlin)

Schönefeld was the first airport I used in Berlin, September 2010 being the first time I visited.

Schönefeld in 2008
Schönefeld in 2008 (Photo Eio / Wikimedia Commons)

SXF used to be East Berlin’s only, and East Germany’s main civil airport. The airport will be closed when the “new” Brandenburg airport opens, and is the smaller of the two Berlin airports operational until then. Schönefeld is situated just inside the state of Brandenburg, which surrounds the city-state of Berlin, and is named for the nearby town. The new Brandenburg airport occupies the same locality as the old Schönefeld airport.

Tegel (Berlin)

Tegel was the second airport I used in Berlin. My first visit was in June 2013, at which time TXL was the busiest airport serving the German capital.

Tegel from the air in 2005
Tegel from the air in 2005. An additional terminal has since been built, top center in this picture.
(Photo Tim Pritlove / Wikimedia Commons / CC-BY-2.0)

Tegel, named for the locality in the north-west of the city where it is situated, is the main hub of Air Berlin, which I also flew for the first time from here. The airport will have been part of aviation history for more than a hundred years when it closes after Berlin’s “new” Brandenburg airport finally opens.