Generates import files for OpenStreetMap with buliding footprints from Kartverket.
Generates geojson import file with building footprints.
Note: The WFS service used is currently not delivering building polygons.
Usage: python3 building2osm.py <municipality> [-split] [-original] [-verify] [-debug]
Parameters:
- municipality - Name of the municipality to generate. Output for several municipalities is generated if county name or "Norway" is given.
-split
- Also split output file into smaller subdivisions ("bydel" or post districts).-original
- Produce file without any modifications.-verify
- Include extra tags for verification of topology modifications.-debug
- Include extra tags for debugging.
Conflates the geojson import file with existing buildings in OSM and produces an OSM file for manual verification and uploading.
Usage: python3 building_merge.py <municipality> [<max distance>] [<filename.geojson>] [-debug]
Parameters:
- municipality - Name of the municipality to conflate.
- max distance - Optional maximum Hausdorff distance between matched buildings. The default value is 10 metres (5 metres is the building is tagged).
- filename.geojson - Optional input file in geojson format. If not specified, the import file for the municipality will be loaded (it must be present in the default folder or in a predefined folder).
-debug
- Include extra tags for debugging.
Splits the geojson import file into smaller subdivisions such as post districts or "bydel".
Usage: python3 municipality_split.py <municipality> [ --subdivision [ bydel | postnummer ]
Parameter:
- municipality - Name of the municipality to split.
--subdivision bydel
- Split municipality according to boroughs.--subdivision bydel
- Split municipality according to post districts (please check for leftover buildings if post districts do not correspond exactly to municipality boundaries).
- Source data is from the Cadastral registry of Kartverket
- "INSPIRE Buildings Core2d" - Contains polygons of the building footprints.
- "Matrikkelen Building point" - Contains information about the building type/usage.
- "Matrikkelen Address apartment level" - Contains information about levels of the building.
- The building=* tag is given a value corresponding to the building_type translation table in this repository. Please provide feedback if you observe that the tagging should be modified.
- Certain modifications of the footprint polygons are made to avoid clutter in OSM:
- Polygons that are almost square are rectified (orthogonalized) to get exact 90 degrees corners. Groups of connected buildings are rectified as a group. Multipolygons are supported. A polygon is not rectified if it would relocate one of its nodes by more than 20 centimeters.
- Redundant nodes are removed if they are located on an (almost) straight line.
- Curved walls are only simplified lightly.
- Output is stored in a geosjon file which may be loaded into JOSM when the OpenData plugin has been installed. Please read the import plan for guiding on how to do the import.
- The building_merge program conflates the import buildings with existing buildings in OSM.
- New buildings are loaded from the geojson import file.
- Existing buildings are loaded from OSM.
- New and existing buildings which are each other's best match within the given maximum Hausdorff distance (default 10 metres) are automatically conflated. They also need to have a similar size (default 50% difference).
- The OSM_BUILDING tag will show which building tag was used by the existing building unless they are in similar residential/commercial/farm categories.
- Use the To-do plugin in JOSM to:
- Resolve Overlapping buildings.
- Resolve Building within buildings.
- Check OSM_BUILDING for manual retagging of building types.
- Check untouched existing OSM buildings.
- Check if entrances or other tagged nodes needs to be reconnected to the new buildings (search for
type:node ways:0 -untagged
).