Commit fa551fc9 authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

* Move enums BuildingType and BuildingClass to building_lib.py

* Improve levels and heights analysis for different buidling classes and settlement types
parent 648df6fa
This diff is collapsed.
......@@ -161,7 +161,7 @@ Most often none of these features are tagged and then the number of levels are d
An exception to this is made for building parts in a relationship (`Simple 3D buildings`_), as the heights in this case might be necessary to be correct (e.g. a dome on a church).
There is some randomness about the number of levels within the same settlement type, which is determinded by using a dictionary of level=ratio pairs, like:
There is some randomness about the number of levels within the same settlement type, which is determined by using a dictionary of level=ratio pairs, like:
::
......@@ -172,13 +172,20 @@ meaning that there is a ratio 0f 0.2 for 4 levels, a ratio of 0.7 for 5 levels a
============================================= ======== ======= ==============================================================================
Parameter Type Default Description / Example
============================================= ======== ======= ==============================================================================
BUILDING_NUMBER_LEVELS_* Dict . A dictonary of level/ratio pairs per settlement type, which is used when a
BUILDING_NUMBER_LEVELS_* Dict . A dictionary of level/ratio pairs per settlement type, which is used when a
building does not contain information about the number of levels.
If the building class is not ``residential`` or ``residential_small`` and the
settlement type is not ``centre`` or ``block``, then specific parameters
are used for apartments, industrial/warehouse and others.
BUILDING_LEVEL_HEIGHT_URBAN Number 3.5 The height per level. This value should not be changed unless special textures
are used. For settlement types ``centre``, ``block`` and ``dense``.
If a building is of class ``commercial``, ``retail``, ``public`` or
``parking_house``, then this height is always used.
BUILDING_LEVEL_HEIGHT_RURAL Number 2.5 Ditto for settlement types ``periphery`` and ``rural``.
BUILDING_LEVEL_HEIGHT_INDUSTRIAL Number 6.0 Ditto for buildings of class ``industrial`` or ``warehouse``.
============================================= ======== ======= ==============================================================================
......
This diff is collapsed.
......@@ -12,7 +12,7 @@ from shapely import speedups
from shapely.geometry import box
from shapely.geometry import LineString, MultiLineString, Polygon
import building_lib
import building_lib as bl
import owbb.models as m
import owbb.plotting as plotting
import utils.coordinates as co
......@@ -76,7 +76,7 @@ def _process_open_spaces_as_blocked_areas(building_zone, open_spaces_dict):
def _process_buildings_as_blocked_areas(building_zone):
for building in building_zone.osm_buildings:
blocked = m.BlockedArea(m.BlockedAreaType.osm_building, building.geometry,
m.parse_building_tags_for_type(building.tags))
bl.parse_building_tags_for_type(building.tags))
building_zone.linked_blocked_areas.append(blocked)
......@@ -242,37 +242,44 @@ def _generate_buildings_along_highway(building_zone: m.BuildingZone, highway: m.
def _read_building_models_library() -> List[m.BuildingModel]:
# FIXME: hard-coded to be replaced
# The correct BUILDING_KEY has to be given
# always define the building:levels - and do NOT specify height
models = list()
# residential
detached_1_tags = {'building': 'owbb_floor',
detached_1_tags = {bl.BUILDING_KEY: 'detached',
'building:colour': 'white', 'building:levels': '2',
'roof:colour': 'red', 'roof:shape': 'hipped', 'roof:height': '2'}
detached_1 = m.BuildingModel(15., 8., m.BuildingType.detached, list(), None, 0, 0, detached_1_tags)
'roof:colour': 'red', 'roof:shape': 'hipped', 'roof:height': '2',
bl.OWBB_GENERATED_KEY: 'yes'}
detached_1 = m.BuildingModel(15., 8., bl.BuildingType.detached, list(), None, 0, 0, detached_1_tags)
models.append(detached_1)
detached_2_tags = {'building': 'owbb_floor',
detached_2_tags = {bl.BUILDING_KEY: 'detached',
'building:colour': 'yellow', 'building:levels': '1',
'roof:colour': 'firebrick', 'roof:shape': 'gabled', 'roof:height': '3'}
detached_2 = m.BuildingModel(10., 10., m.BuildingType.detached, list(), None, 0, 0, detached_2_tags)
'roof:colour': 'firebrick', 'roof:shape': 'gabled', 'roof:height': '3',
bl.OWBB_GENERATED_KEY: 'yes'}
detached_2 = m.BuildingModel(10., 10., bl.BuildingType.detached, list(), None, 0, 0, detached_2_tags)
models.append(detached_2)
# terrace
terrace_1_tags = {'building': 'owbb_floor',
terrace_1_tags = {bl.BUILDING_KEY: 'terrace',
'building:colour': 'aqua', 'building:levels': '2',
'roof:colour': 'darksalmon', 'roof:shape': 'skillion', 'roof:height': '1.5'}
terrace_1 = m.BuildingModel(5., 3., m.BuildingType.terrace, list(), None, 0, 0, terrace_1_tags)
'roof:colour': 'darksalmon', 'roof:shape': 'skillion', 'roof:height': '1.5',
bl.OWBB_GENERATED_KEY: 'yes'}
terrace_1 = m.BuildingModel(5., 3., bl.BuildingType.terrace, list(), None, 0, 0, terrace_1_tags)
models.append(terrace_1)
# industrial
industry_1_tags = {'building': 'owbb_floor',
industry_1_tags = {bl.BUILDING_KEY: 'industrial',
'building:colour': 'silver', 'building:levels': '4',
'roof:colour': 'darkgray', 'roof:shape': 'flat', 'roof:height': '0'}
industry_1 = m.BuildingModel(20., 30., m.BuildingType.industrial, list(), None, 0, 0, industry_1_tags)
'roof:colour': 'darkgray', 'roof:shape': 'flat', 'roof:height': '0',
bl.OWBB_GENERATED_KEY: 'yes'}
industry_1 = m.BuildingModel(20., 30., bl.BuildingType.industrial, list(), None, 0, 0, industry_1_tags)
models.append(industry_1)
industry_1_tags = {'building': 'owbb_floor',
industry_1_tags = {bl.BUILDING_KEY: 'industrial',
'building:colour': 'navy', 'building:levels': '3',
'roof:colour': 'darkgray', 'roof:shape': 'gabled', 'roof:height': '3'}
industry_1 = m.BuildingModel(20., 15., m.BuildingType.industrial, list(), None, 0, 0, industry_1_tags)
'roof:colour': 'darkgray', 'roof:shape': 'gabled', 'roof:height': '3',
bl.OWBB_GENERATED_KEY: 'yes'}
industry_1 = m.BuildingModel(20., 15., bl.BuildingType.industrial, list(), None, 0, 0, industry_1_tags)
models.append(industry_1)
return models
......@@ -280,7 +287,7 @@ def _read_building_models_library() -> List[m.BuildingModel]:
def process(transformer: co.Transformation, building_zones: List[m.BuildingZone],
highways_dict: Dict[int, m.Highway], railways_dict: Dict[int, m.RailwayLine],
waterways_dict: Dict[int, m.Waterway]) -> List[building_lib.Building]:
waterways_dict: Dict[int, m.Waterway]) -> List[bl.Building]:
last_time = time.time()
# =========== TRY TO READ CACHED DATA FIRST =======
......
......@@ -152,14 +152,20 @@ BUILDING_FAKE_AMBIENT_OCCLUSION = True # -- fake AO by darkening facade tex
BUILDING_FAKE_AMBIENT_OCCLUSION_HEIGHT = 6. # 1 - VALUE * exp(- AGL / HEIGHT )
BUILDING_FAKE_AMBIENT_OCCLUSION_VALUE = 0.6
# -- Parameters which influence the height of buildings if no info from OSM is available.
# Parameters which influence the height of buildings if no info from OSM is available.
BUILDING_NUMBER_LEVELS_CENTRE = {4: 0.2, 5: 0.7, 6: 0.1}
BUILDING_NUMBER_LEVELS_BLOCK = {4: 0.4, 5: 0.6}
BUILDING_NUMBER_LEVELS_DENSE = {3: 0.2, 4: 0.6, 5: 0.15, 6: 0.05}
BUILDING_NUMBER_LEVELS_DENSE = {3: 0.25, 4: 0.75}
BUILDING_NUMBER_LEVELS_PERIPHERY = {1: 0.3, 2: 0.65, 3: 0.05}
BUILDING_NUMBER_LEVELS_RURAL = {1: 0.3, 2: 0.7}
# the following are used if settlement type is not centre or block and building class is not residential
BUILDING_NUMBER_LEVELS_APARTMENTS = {2: 0.05, 3: 0.45, 4: 0.4, 5: 0.08, 6: 0.02}
BUILDING_NUMBER_LEVELS_INDUSTRIAL = {1: 0.3, 2: 0.6, 3: 0.1} # for both industrial and warehouse
BUILDING_NUMBER_LEVELS_OTHER = {1: 0.2, 2: 0.4, 3: 0.3, 4: 0.1} # e.g. commercial, public, retail
BUILDING_LEVEL_HEIGHT_URBAN = 3.5 # this value should not be changed unless special textures are used
BUILDING_LEVEL_HEIGHT_RURAL = 2.5 # ditto including periphery
BUILDING_LEVEL_HEIGHT_INDUSTRIAL = 6. # for industrial and warehouse
BUILDING_USE_SHARED_WORSHIP = False # try to use shared models for worship buildings
......@@ -486,11 +492,18 @@ def read_from_file(filename):
global BUILDING_NUMBER_LEVELS_DENSE
global BUILDING_NUMBER_LEVELS_PERIPHERY
global BUILDING_NUMBER_LEVELS_RURAL
global BUILDING_NUMBER_LEVELS_APARTMENTS
global BUILDING_NUMBER_LEVELS_INDUSTRIAL
global BUILDING_NUMBER_LEVELS_OTHER
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_CENTRE, 'BUILDING_NUMBER_LEVELS_CENTRE')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_BLOCK, 'BUILDING_NUMBER_LEVELS_BLOCK')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_DENSE, 'BUILDING_NUMBER_LEVELS_DENSE')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_PERIPHERY, 'BUILDING_NUMBER_LEVELS_PERIPHERY')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_RURAL, 'BUILDING_NUMBER_LEVELS_RURAL')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_APARTMENTS, 'BUILDING_NUMBER_LEVELS_APARTMENTS')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_INDUSTRIAL, 'BUILDING_NUMBER_LEVELS_INDUSTRIAL')
_check_ratio_dict_parameter(BUILDING_NUMBER_LEVELS_OTHER, 'BUILDING_NUMBER_LEVELS_OTHER')
def show_default():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment