Skip to content

Generates import files for OpenStreetMap with buliding footprints from Kartverket

License

Notifications You must be signed in to change notification settings

NKAmapper/building2osm

Repository files navigation

building2osm

Generates import files for OpenStreetMap with buliding footprints from Kartverket.

building2osm

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", electoral or post districts).
  • -original - Produce file without any modifications.
  • -verify - Include extra tags for verification of topology modifications.
  • -debug - Include extra tags for debugging.

building_merge

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. Default value is 10 metres (5 metres if 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.

municipality_split

Splits the geojson import file into smaller subdivisions such as electoral districts or "bydel".

Usage: python3 municipality_split.py <municipality> [ --subdivision [ bydel | valgkrets | postnummer ]

Parameter:

  • municipality - Name of the municipality to split.
  • --subdivision bydel - Split municipality according to boroughs.
  • --subdivision postnummer - Split municipality according to post districts.
  • --subdivision valgkrets - Split municipality according to electoral districts (fewer than post districts in large towns; default).
  • --area - Save district boundaries only (no split). Default is to save boundary file when splitting.

filter_buildings

Filters the geojson import file, removing buildings that have already been imported.

Usage: python3 filter_buildings.py --municipality <id> --input <geojson> --output <geojson>

Parameters:

  • --municipality id - Municipality code to use for downloading
  • --input geojson - Path to the input geojson file
  • --output geojson - Path to the output geojson file

Notes

  • 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 respository. 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 which 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.py program conflates the import buildings with existing buildings in OSM.
    • New buildings are loaded from the geojson import file. You may split the import file into smaller parts using municipality_split.py or manually.
    • 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 similar size (default up to 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:
      1. Resolve Overlapping buildings.
      2. Resolve Building within buildings.
      3. Check OSM_BUILDING for manual retagging of building types.
      4. Check untouched existing OSM buildings.
      5. Check if entrances or other tagged nodes needs to be reconnected to the new buildings (search for type:node ways:0 -untagged).
    • Use the boundary polygons from municipality_split.py and the JOSM functions Selection->All inside and Edit->Purge to work on a subset of a large municipality.
    • The building_merge.py program may be run several times for the same municipality. Only buildings with new ref:bygningsnr will be added each time.

References

About

Generates import files for OpenStreetMap with buliding footprints from Kartverket

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages