Import/Catalogue/Sweden Building Import
![]() | Do not upload any buildings from Lantmäteriet to OSM yet. Because of license issues we are awaiting explicit permission to include content to OSM. |
UNDER DEVELOPMENT
Building polygons became available as open data in Sweden in February 2025 when Lantmäteriet, the Swedish Mapping Authority, made it available under the EU Open Data Directive as High-Value Datasets. The dataset contains high quality 2D polygons of the building footprints, as well as building type, from the Lantmäteriet. There are [8] million buildings in the dataset. This page describes the plan to import them into OSM.
As of February 2025, there are 3.3 million building polygons in OSM for Sweden. A large number of the buildings have a big offset due to bad orthogonalisation quality of the Bing imagery and other satellite based imagery for the region.
Goals
The goals of this import are to:
- Import missing buildings in Sweden into OSM.
- Improve the quality of existing buildings in OSM (offset etc).
- ... while keeping existing buildings which are correct, including preserving tagging information for existing buildings.
Schedule
- 2025-02-15 - Import plan discussed in the Swedish OSM community.
- 2025-0x-xx - Import plan submitted to the OSM community for review.
- 2025-0x-xx - Start of import for Sweden into OSM - link to progress page.
Import data
Source information
- Data source site: Polygons of building footprints from Lantmäteriet (link to product page)
- Data license: CC-BY 4.0.
- Type of license (if applicable): CC-BY 4.0.
- Link to permission (if required): Explicit permission obtained by each individual user by application to Lantmäteriet.
- OSM attribution (if required): Lantmäteriet link.
- ODbL Compliance verified: General permission from Lantmäteriet to OSM pending.
OSM data files
Data files will be available per municipality. Examples of generated GeoJSON files with OSM tagging are available in the "byggnader Sverige" folder. The number of buildings in the source data and in OSM for Sweden is provided on the import progress page.
Data quality
The data quality is high in general, and more accurate and detailed than what would be possible to trace from high quality orthophotos.
As usual, there are a few issues to look out for:
- Delays in updating data could result in some outdated polygons in cases were a building has been replaced or extended.
- Some buildings may not be included in the data set (which is not a problem).
- Buildings which have been demolished, burnt down or become ruins are not supposed to be included in the dataset, but exceptions may occur.
- Some buildings are not included due to national security.
- The provided building type may be outdated, for example an industrial building may have been converted into something else.
- The building type may not be fully representative for a mixed-use building, such as a building with retail stores on the ground floor and apartments on the other floors, or the building type may be too general.
- Some of the circular or curved buildings have irregular polygons, and a few buildings are slightly overlapping.
Import type
Local contributors will carry out the import.
Data preparation
Data reduction and simplification
The source data is transformed into GeoJSON files by a python program, see building2osm-sweden.The following modifications are done to the building polygons:
- Duplicate nodes at the exact same position are merged.
- Nodes on an (almost) straight line are simplified/removed.
- The source polygons have almost 90° corners (where applicable), but not exactly 90°. These polygons are rectified / orthogonalised by the program. Connected buildings are rectified as one group. Multipolygons are also supported. Very short walls of less than 20 cm are removed if they are located on an (almost) straight line. Short walls of less than 1 metre are rectified with a higher corner angle tolerance due to lower tracing quality in the source data for short walls. Rectification of a building is aborted if the resulting polygon have any node which is relocated more than 20 cm.
- Curved walls are identified and only gets a light simplification (tighter tolerance for removing nodes).
Tagging plans
The buildings are tagged according to this table:
Feature | OSM tagging | Comment | |
---|---|---|---|
Building identifier | ref:lm_byggnad=* | The offical and unique building number used in Lantmäteriet source database. Will be used for later updates. | |
Building type | building=* | Please see the conversion table, building_tags.json for tagging. If no tagging is specified, building=yes will be used. | |
Building name | name=* and alt_name=* | The name of the building (if applicable). | |
The following keys are for information only during import and should not be uploaded to OSM: | |||
Building type | TYPE=* | Building type in the source data. Code which describes the usage of the building according to the conversion table. More than one building type may be present, for example if mix of stores and appartments in a building. | |
Building number | HOUSE_REF=* | House number within plot. This is not the number used in the address. | |
Date and version | DATE=* | Date and version of last modification in source. Could be used to identify recent updates in source. |
When the import files are generated with the -verify
option, extra tags in upper case are included for debugging.
Changeset Tags
When uploading to OSM, the changesets will be tagged with:
- description=Lantmäteriet building import for <municipality>
- source=Lantmäteriet
Data transformation
A python program, building2osm, has been made to generate files for the import. The program handles the following tasks:
- Loads building file for given municipality (file downloaded from Lantmäteriet by user).
- Matches the three data sources (building types, polygons and addresses/building levels). Address coordinates must be located within the building polygon for building levels to be included.
- Tags building=* according to conversion tables.
- Rectifies buildings where applicable, simplifies polygons (redundant nodes).
- Saves a GeoJSON file which may be opened in JOSM with the OpenData plugin installed.
Data merge workflow
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. The number of buildings and progress percentage are being updated via a tool in building2osm-sweden. This import is expected to go on for several years. The approach is to just make the import files available for anyone who is interested rather than pushing to get to completion.
Workflow
An python script, building_merge, has been developed for a conservative automation of the clear and non-conflicting cases of conflation, leaving the rest for manual conflation. Here is the workflow for the script:
- You need to have Python installed on you computer, but no other dependencies are required.
- Download the building file for the municipality you are working on from the "byggnader Sverige" folder.
- Run
python3 building_merge.py <municipality name>
from the folder were you have the geojson import file stored.- The script will download all existing buildings from OSM and conflate them with the import buildings.
- Buildings will be conflated if all the closest points between them are not more than 10 meters apart (Hausdorff method). Tagged buildings must be within half that range. Also, the buildings cannot differ more than 50% in area size. Furthermore, the two buildings to be conflated must be each others best match.
- If the building=* values are not within similar categories, an OSM_BUILDING=* tag will be included to indicate that the building tag of the import was different from OSM.
- Load the merged OSM file into JOSM and complete the rest of the conflation manually, first with these 4 steps (please note that you need to click the Validation button to get the two first validation selections below - it is not sufficient to click the Upload button to get full validation):
- Overlapping buildings after validation: Click on this warning in the Validation window and search for
selected -"ref:lm_byggnad"
. Walk through all overlaps with the To-do plugin and resolve. Then validate again and resolve the remaining overlaps. - Building inside buildings after validation: Click on this warning in the Validation window and search for
selected type:node
. Walk through all cases with the To-do plugin and resolve. Then validate again and resolve the remaining cases. - Conflicting tags: Search for
LM_BUILDING=*
, walk through all cases with To-do plugin and resolve. - Remaining existing buildings: Click on this warning in the Validation window and search for
selected building=* -modified -parent modified
to check if any of the remaining existing buildings from OSM needs to be adjusted. Some of these buildings may have had a large offset and should be merged with a new import building.
- Overlapping buildings after validation: Click on this warning in the Validation window and search for
Please also check the other verification steps in the Workflow section above.
The import process described above usually takes 1-2 hours for an average size municipality. If thousands of buildings already exists in OSM for the municipality, it is recommended to first split the import file into smaller parts using the municipality_split.py script, and then process each part separately.
Updates
Possible future extensions:
- Lantmäteriet provides updated files at regular intervals, which could be used in the future for providing suggestions for new additions or edits.
- A future extension could be to include more data about heritage buildings, which is available from a different source.
- Building heights, roof shapes etc could be included if they become available in the future.
All of these updates are possible via the ref:lm_byggnad=* tag.