Import/Catalogue/Sweden highway import

From OpenStreetMap Wiki
Jump to navigation Jump to search


The Swedish public directorate Trafikverket maintains a database of Swedish highways in a system called NVDB. Trafikverket makes their NVDB data available under the CC0 license at the web page Lastkajen. All Swedish highways used by cars, as well as public cycleways and footways, are supposed to be included in NVDB. No import into OSM has been organized until now. The quality of Swedish highways in OSM varies a lot due to national orthophotos not being completely open yet, with the implication that there is considerable offset in many places. Also, many highways not yet mapped, in particular in remote rural areas.

The NVDB data has been available to the Swedish public for several years, and it's already informally in active use by many Swedish mappers, using various custom scripts. One example of such pioneering work is partially documented here: Öppnadata erfarenheter. This effort is to formalize this and use a more detailed import script to include as much (relevant) information from NVDB as possible, and at the same time make the process broadly available to any interested mapper. Previously working with NVDB data has been reserved only to the most tech savvy users.

Please note: Not to be confused with the Norwegian NVDB and the import script with the same name nvdb2osm used for importing highways in Norway.


The goals of this import are to:

  • Import missing highways in Sweden.
  • Improve the quality of existing highways in OSM in Sweden.
  • ... while keeping existing highways which are correct, including preserving correct tagging information.


Note: unfortunately the traditional OSM mailing lists and forums are not much used in the Swedish community at the time of writing, instead most discussions have taken place in the OSM Sweden Facebook group, and in the issue tracker of the import script nvdb2osm.

  • 2020-12 to 2021-03 - Import process and script design and refinements discussed in facebook group and github issue tracker. Pilot tests made during this period to gain experience and figure out suitable merging workflow.
  • 2021-03-24 - Import plan announced on the Swedish OSM forum [1] and on the Swedish mailing list [link].
  • 2021-03-24 - Import plan submitted to the Import maling list [2] for review.
  • 2021-04-01 - Start of import for Sweden into OSM progress.

Import data


License/permission information:

  • Data source site: Lastkajen
  • Data license: CC0.
  • Type of license (if applicable): CC0.
  • Link to permission (if required): Not required.
  • OSM attribution (if required): Not required, but Trafikverket attribution is here.
  • ODbL Compliance verified: Yes.

OSM data files

The highways are available from NVDB in a number of formats. The format used in this import is shape files. NVDB uses the metering system, which means that the basic topology of the highway network is provided with coordinates of highway segments in a shape file, and then all tagging content (max speeds, street names, surface, traffic restrictions etc etc) are provided in separate files with metering relative to those highway segments (these separate shape files also contains the coordinates one more time, but that is not used).

Ready-made OSM import files per municipality that are updated monthly can be found here.

Data quality

Data quality is in general high, however there are as usual a number of things to be aware of:

  • There could be lags in reporting new highways or modifications from the local municipalities to Trafikverket.
  • The Swedish community guidelines for tagging highways may differ from the official Swedish highway categories, and will sometimes need editing.
  • The dataset does not have a very granular distinction between tertiary/secondary/residential/service highways, so manual editing will sometimes be needed.
  • Some of the forestry highways may have fallen into decay and should be tagged highway=track.

How to relate to these and other issues is described in more detail in the import guidelines.

Import type

The local OSM community in Sweden has discussed the import plan and local contributors will carry out the import. The import is carried through by a normal manual JOSM merging workflow and is combined with general maintenance such as fixing positional errors of nature and buildings to fit the new accurate road geometry. Thus the import process is much similar to a low intensity organized mapping effort and is expected to span several years.

Data preparation

Data reduction and simplification

The following modifications and simplifications are done:

  • All the separate and detailed data categories (maxspeed, street names, traffic restrictions etc) are combined into one highway network. Highway segments are split if necessary.
  • Point objects (highway crossings, speed bumps, traffic lights etc) are snapped to the closest logical node on the highway network.
  • Highway segments are combined into longer ways as long as they have the same tags, and without introducing sharp turns.
  • Finally, the highways are simplified so that redundant nodes with only 0.2 meters of deviation are removed.

Data transformation and tagging

The script used for converting from NVDB multi-layer shape files to single layer OSM-XML format nvdb2osm uses a mix of static tag conversion, where there is a 1-to-1 mapping for NVDB tag to a corresponding OSM tag, and then a resolving process where OSM tags are resolved by looking at several NVDB layers at once and how roads are connected etc.

This script have been tuned over a period of three months of testing and discussion with the Swedish community and an import expert from Norway which has already an import of the Norwegian NVDB in progress. Still not all tags can be 100% correctly resolved, especially the highway tag. The import guideline describes how to deal with this manually. For details on the script and exactly how it works, see the nvdb2osm

Changeset Tags

When uploading to OSM, the changesets will be tagged with:

description=NVDB highway import for <municipality>
source=Trafikverket NVDB

Note that additional sources and possibly more detailed description may be used. The important keyword in both description and source is "NVDB". Due to the manual import process NVDB is almost never the sole source for an update. Other typical sources used to complete a changeset are ESRI/Bing ortophotos and Lantmäteriet's raster map, and these are then added on to the source list, separated with semicolon.

Team approach

Import will be carried out municipality by municipality by members of the local community in Sweden. We will try to recruit users with local knowledge to import their own municipality. A progress page has been created to avoid conflicting imports. This work is expected to go on for several years.

The approach is non-intrusive and there is no specific push for making an import in all municipalities or get to completion in some specific timeframe. Instead we just make the import files available for anyone who is interested to help improving the data quality in Sweden, by the means of data provided by NVDB.


The Trafikverket road network overlay imagery in JOSM may be used to check the source data. Aerials may be used but they may have offsets.


A more detailed guideline exists in a separate document (in Swedish) import guidelines. However, here's an overview of the import workflow:

  1. Check the import progress page for an available municipality and update that page to indicate you are starting an import.
  2. Get the ready OSM import file from this page
  3. Decide if you want to make a full update of the municipality, or partial. We recommend making a full update (ie go through also roads that are already mapped) so when you are complete one know that the map has all the data NVDB has and with the same quality of geometry.
  4. If you decide to make a partial update: download the highways of the municipality and examine differences with the import file carefully:
    • Is an import at all needed, or is for example just an update of maxspeed, street names etc. needed? Note that even if an area at first glance seems completely covered, there may be gaps here and there due to the nature of how traditional OSM mapping works.
    • Which areas of the municipality would benefit from an import, or the whole municipality (not likely for large cities)?
    • Consider running the highway_merge script with the -new option to see a diff of OSM versus the import file. Perhaps just adding missing highways produced by the script is all that is needed if the quality already in OSM is good.
  5. Merge a part of the import file with the OSM files:
    • Select a branch of 100-200 connected highways at a time from the import file.
    • Copy to the layer in JOSM which contains the existing OSM highways.
    • Merge the new and existing highways with the Replace Geometry function in JOSM. Make sure relations are kept. You may need to split highways. You are automatically notified about conflicting tags.
    • Use the JOSM validator to check your. Also click the Validation button without selecting any objects to be able to discover any crossing highways.
  6. Upload to OSM with the changeset tags as described above.
  7. Continue with the next branch of highways in item 4.

If you only import missing highways, it is efficient to use the To-do plugin in JOSM.

A few pilot imports have been done to test the workflow.

See also