Goal
Import missing buildings. One municipality at a time, most likely.
License
Data owner has given permission for import, even data itself is under CC4.0. See Fi:Avustajat - OpenStreetMap Wiki
Data
Maastotietokanta (MTK), mtkmaasto.gpkg, open data downloaded from Karttapaikka - Maanmittauslaitos . Has buildings as polygons. Field ‘käyttötarkoitus’ defines usage, most notable are
- 1: permanent living
- 2: commercial
- 4: industrial
- note: value can be off especially in tourism heavy areas, noted in Kolari / Ylläs.
Data will be replaced in autumn 2026 by ‘kansallinen maastotietokanta’ (KMTK). Changes are minimal for this usage:
- layer name changes to ‘building part area’
- field to ‘building function id’. values might change too.
- new field ‘end_time’ possibly usable for filtering out old buildings, if those will be in new dataset.
Tools
QGIS, latest
QGIS plugin QuickOSM: to download current OSM data
ogr2osm: to convert data to .osm
JOSM: verify data
JOSM or .py: to upload data
Steps
Preparation
Download (about) current version of
-
‘Maastotietokanta’ to get the buildings.
-
‘Hallinnolliset aluejaot’ to get municipalities as vector polygons.
Download current OSM data
Install and open QuickOSM plugin. Make Quick query.
Keys:
- building
- was:building
- demoslished:building
- and other lifecycle tags, see Lifecycle prefix - OpenStreetMap Wiki
In: Municipality, in this sample case ‘Rovaniemi’
Export data to geopackage.
Find missing buildings
Add MTK Buildings and Municipalities as a layers.
First select a municipality.
Then Toolbox > Select by location
- ‘rakennus’
- are within
- ‘kunta’
- selected features only
Now selection contains all buildings within selected municipality. Sample data: Rovaniemi, 58k buildings.
Again Toolbox > Select by location
- ‘rakennus’
- intersect
- ‘OSM buildings’
- remove from current selection
Wait. On modern mac it took 1h20, barely using any computing power :(
Sample data: 40k features selected = 40k buildings missing from OSM.
Export selected features > save as geopackage. optional: Discard unnecessary fields.
Verify visually by comparing current OSM buildings and exported file.
Convert to .osm
“it is possible to 1) export data from QGIS in suitable format (geopackage, shape file, GeoJSON or KML) convert to OSM XML with Ogr2osm 2) upload to OSM with bulk_upload.py or similar tools.” says QGIS - OpenStreetMap Wiki
Install ogr2osm.
Goal is to tag field ‘kayttotarkoitus’ to ‘building’:
- 1: apartment
- 2: commercial
- 4: industrial
- else: yes
so make a translation file:
import ogr2osm
class mtkbuildings(ogr2osm.TranslationBase):
def filter_tags(self, attrs):
if not attrs:
return
tags = {}
if 'kayttotarkoitus' in attrs:
if attrs['kayttotarkoitus'].strip() == '1':
tags['building'] = 'residential'
elif attrs['kayttotarkoitus'].strip() == '2':
tags['building'] = 'commercial'
elif attrs['kayttotarkoitus'].strip() == '4':
tags['building'] = 'industrial'
else:
tags['building'] = 'yes'
tags['source'] = 'National Land Survey of Finland'
return tags
Run.
Verify data in JOSM. Menu > imagery > OSM and Aerial/orto/satellite, then compare.
Optional: also check in text editor:
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="ogr2osm 1.2.1" upload="false">
<node visible="true" id="-1" lat="66.803101117" lon="25.274039664"/>
<node visible="true" id="-2" lat="66.803178473" lon="25.273984186"/>
...
<way visible="true" id="-180321"><nd ref="-180317"/><nd ref="-180318"/><nd ref="-180319"/><nd ref="-180320"/><nd ref="-180317"/><tag k="building" v="yes"/><tag k="source" v="National Land Survey of Finland"/></way>
<way visible="true" id="-180326"><nd ref="-180322"/><nd ref="-180323"/><nd ref="-180324"/><nd ref="-180325"/><nd ref="-180322"/><tag k="building" v="commercial"/><tag k="source" v="National Land Survey of Finland"/></way>
...
.osm file 23 MB
Upload to OSM
First set was uploaded with JOSM.







