Commit 0226a5bd authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Corrections to density sanity check

parent a6ebba25
......@@ -59,7 +59,7 @@ Finally depending on the place type and the distance to the centroid a given cit
* ``dense``: an area with dense population mostly living in apartments, but the apartment houses are not necessarily connected. Max distance = population^(2/3).
* ``periphery``: an area with mostly (detached) houses. Outside of max distance for ``dense``.
There is also settlement type ``rural``, which is the default for all those building zones, which re not within a lit area that is linked to a city or town place. In theory the main difference between ``periphery`` and ``rural`` is the ratio between ap property's lot size and the floor plan, where in rural regions the same family house size typically has more surrounding ground.
There is also settlement type ``rural``, which is the default for all those building zones, which re not within a lit area that is linked to a city or town place. In theory the main difference between ``periphery`` and ``rural`` is the ratio between a property's lot size and the floor plan, where in rural regions the same family house size typically has more surrounding ground.
Please be aware that there is no "science" behind the chosen concentric ring radii and the settlement types. It is just a heuristic / an observation that the farther away from the city centre you get, the less dense the area. Also the settlement area is "some" function of the population (and the commuting workers into a city/town from outside are neglected). Also in some areas of the world densities are higher. This can be corrected with a linear parameter. The population is taken as is from OSM - if missing a parametrised default population is used.
......
......@@ -131,8 +131,6 @@ Parameters which influence the number of buildings from OSM taken to output.
============================================= ======== ======= ==============================================================================
Parameter Type Default Description / Example
============================================= ======== ======= ==============================================================================
LOD_ALWAYS_DETAIL_BELOW_AREA Integer 150 Below this area, buildings will always be LOD detailed
BUILDING_MIN_HEIGHT Number 0.0 Minimum height from bottom to top without roof height of a building to be
included in output (does not include roof). Different from OSM tag
"min_height", which states that the bottom of the building hovers min_height
......@@ -509,12 +507,15 @@ OWBB_LANDUSE_CACHE Boolean False Instead of
Complement OSM Land-Use Information
-----------------------------------
This operations complements land-use information from OSM based on some simple heuristics, where there currently are no land-use zones for built-up areas in OSM: If there are clusters of buildings outside of registered OSM land-use zones, then zones are added based on clusters of buildings and buffers around them. The land-use type is based on information of building types, amenities etc. — if available.
These operations complement land-use information from OSM based on some simple heuristics, where there currently are no land-use zones for built-up areas in OSM: If there are clusters of buildings outside of registered OSM land-use zones, then zones are added based on clusters of buildings and buffers around them. The land-use type is based on information of building types, amenities etc. — if available.
============================================= ======== ======= ==============================================================================
Parameter Type Default Description / Example
============================================= ======== ======= ==============================================================================
OWBB_USE_BTG_LANDUSE Boolean False Read FlightGear scenery (BTG-files from existing TerraSync scenery) for
land-use data to complement (not replace) data from OSM.
OWBB_GENERATE..._BUILDING_BUFFER_DISTANCE Number 30 The minimum buffering distance around a building.
OWBB_GENERATE..._BUILDING_BUFFER_DISTANCE_MAX Number 50 The maximum buffering distance around a building. The actual value is a
function of the previous parameter and the building's size (the larger the
......@@ -588,6 +589,9 @@ OWBB_PLACE_RADIUS_FACTOR_CITY Number 1. Linear corr
OWBB_PLACE_RADIUS_FACTOR_TOWN Number 1. Ditto for ``place=town``.
OWBB_PLACE_TILE_BORDER_EXTENSION Integer 10000 Extension of the perimeter (tile borders) to read place information from, as
e.g. a city might extend across til border areas.
OWBB_PLACE_CHECK_DENSITY Boolean False Should only be used if majority of all buildings are mapped in OSM.
Otherwise settlement type will be downgraded e.g. in areas based on BTG etc.
Mostly for testing purposes and prrof of concept.
OWBB_PLACE_SANITY_DENSITY Number 0.15 Make sure that settlement type dense is assigned, if the density of a building
zone is larger than a given ratio and the settlement type is rural or
periphery. The density is calculated as the total of
......
......@@ -36,7 +36,7 @@ If you followed the :ref:`directory structure <chapter-creating-directory-struct
Adjusting Visibility of Scenery Objects
=======================================
The ``osm2city`` related programs and especially ``buildings.py`` are using heuristics and parameters to determine at what level of detail (LOD) scenery objects should be visible. This is done by adding the objects to one of the three FlightGear LOD schemes: "rough" and "detailed".
The ``osm2city`` related programs and especially ``buildings.py`` are using heuristics and parameters to determine at what level of detail (LOD) scenery objects should be visible. This is done by adding the objects to one of the three FlightGear LOD schemes: "rough" or "detailed" ("bare" is not used).
For ``buildings.py`` before creating a scenery you can influence into which of the two LOD ranges the objects are placed by using the following :ref:`Parameters <chapter-parameters-lod-label>`:
......
......@@ -405,7 +405,9 @@ def _split_generated_building_zones_by_major_lines(before_list: List[m.BuildingZ
# create buffers around major transport
line_buffers = list()
for highway in highways.values():
if highway.type_ in [m.HighwayType.motorway, m.HighwayType.trunk] and not highway.is_tunnel:
if highway.type_ in [m.HighwayType.motorway, m.HighwayType.trunk,
m.HighwayType.primary, m.HighwayType.secondary, m.HighwayType.tertiary,
m.HighwayType.unclassified] and not highway.is_tunnel:
line_buffers.append(highway.geometry.buffer(highway.get_width()/2))
for railway in railways.values():
......@@ -545,7 +547,8 @@ def _link_building_zones_with_settlements(settlement_clusters: List[m.Settlement
z += 1
if z % 20 == 0:
logging.debug('%i out of %i building_zones', z, z_number)
# within because lit-areas are always
# using "within" instead of "intersect" because lit-areas are always larger than zones due to buffering
# and therefore a zone can always only be within one lit-area/settlement and not another
if zone.geometry.within(settlement.geometry):
zone.settlement_type = bl.SettlementType.periphery
# create city blocks
......@@ -617,7 +620,7 @@ def _check_clipping_border(building_zones: List[m.BuildingZone], bounds: m.Bound
return kept_zones
def count_zones_related_buildings(buildings: List[bl.Building], text: str) -> None:
def _count_zones_related_buildings(buildings: List[bl.Building], text: str) -> None:
total_related = 0
for building in buildings:
......@@ -688,14 +691,14 @@ def process(transformer: Transformation) -> Tuple[List[Polygon], List[bl.Buildin
del buildings_outside
last_time = time_logging("Time used in seconds for generating building zones", last_time)
count_zones_related_buildings(osm_buildings, 'after building generation')
_count_zones_related_buildings(osm_buildings, 'after building generation')
# =========== CREATE POLYGONS FOR LIGHTING OF STREETS ================================
# Needs to be before finding city blocks as we need the boundary
lit_areas = _process_landuse_for_lighting(building_zones)
last_time = time_logging("Time used in seconds for finding lit areas", last_time)
count_zones_related_buildings(osm_buildings, 'after lighting')
_count_zones_related_buildings(osm_buildings, 'after lighting')
# =========== REDUCE THE BUILDING_ZONES TO BE WITHIN BOUNDS ==========================
building_zones = _check_clipping_border(building_zones, bounds)
......@@ -708,21 +711,22 @@ def process(transformer: Transformation) -> Tuple[List[Polygon], List[bl.Buildin
railways_dict, waterways_dict)
last_time = time_logging("Time used in seconds for splitting building zones by major lines", last_time)
count_zones_related_buildings(osm_buildings, 'after split major lines')
_count_zones_related_buildings(osm_buildings, 'after split major lines')
# =========== Link urban places with settlement_area buffers ==================================
settlement_clusters = _create_settlement_clusters(lit_areas, water_areas, urban_places)
last_time = time_logging('Time used in seconds for creating settlement_clusters', last_time)
count_zones_related_buildings(osm_buildings, 'after settlement clusters')
_count_zones_related_buildings(osm_buildings, 'after settlement clusters')
_link_building_zones_with_settlements(settlement_clusters, building_zones, highways_dict)
last_time = time_logging('Time used in seconds for linking building zones with settlement_clusters', last_time)
_sanity_check_settlement_types(building_zones, highways_dict)
last_time = time_logging('Time used in seconds for sanity checking settlement types', last_time)
if parameters.OWBB_PLACE_CHECK_DENSITY:
_sanity_check_settlement_types(building_zones, highways_dict)
last_time = time_logging('Time used in seconds for sanity checking settlement types', last_time)
count_zones_related_buildings(osm_buildings, 'after settlement linking')
_count_zones_related_buildings(osm_buildings, 'after settlement linking')
# ============ Finally guess the land-use type ========================================
for my_zone in building_zones:
......@@ -742,7 +746,7 @@ def process(transformer: Transformation) -> Tuple[List[Polygon], List[bl.Buildin
waterways_dict)
osm_buildings.extend(generated_buildings)
count_zones_related_buildings(osm_buildings, 'after generating buildings')
_count_zones_related_buildings(osm_buildings, 'after generating buildings')
# =========== WRITE TO CACHE AND RETURN
if parameters.OWBB_LANDUSE_CACHE:
......
......@@ -162,7 +162,8 @@ def _draw_generated_zones(building_zones, ax: maxs.Axes) -> None:
face_color = "gold"
elif m.BuildingZoneType.corine_discontinuous is building_zone.type_:
face_color = "yellow"
_add_patch_for_building_zone(building_zone, face_color, face_color, ax)
edge_color = face_color
_add_patch_for_building_zone(building_zone, face_color, edge_color, ax)
def _draw_btg_building_zones(btg_building_zones, ax: maxs.Axes) -> None:
......@@ -340,7 +341,7 @@ gold=town and suburban, yellow=construction and industrial and port]")
# City blocks
my_figure = _create_a3_landscape_figure()
my_figure.suptitle("City blocks")
my_figure.suptitle("City blocks random pattern")
ax = my_figure.add_subplot(111)
ax.grid(True, linewidth=1, linestyle="--", color="silver")
_draw_city_blocks(building_zones, ax)
......
......@@ -321,6 +321,7 @@ OWBB_PLACE_RADIUS_FACTOR_TOWN = 1.
OWBB_PLACE_TILE_BORDER_EXTENSION = 10000
OWBB_PLACE_CHECK_DENSITY = False
OWBB_PLACE_SANITY_DENSITY = 0.15
# ==================== BUILDING GENERATION ============
......
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