Commit 32abff59 by Rick Gruber-Riemer

### Slopes for roads correction/documentation plus making sure that highways /...

`Slopes for roads correction/documentation plus making sure that highways / railways are joined only if same type.`
parent d4f05cfe
 ... ... @@ -152,14 +152,15 @@ POINTS_ON_LINE_DISTANCE_MAX Integer 1000 The maximum value should be chosen. The drawback of small values are that the number of faces gets bigger affecting frame rates. MAX_SLOPE_ROAD, MAX_SLOPE_* Decimal 0.08 The maximum allowed slope. It is used for ramps to bridges, but it is also used for other ramps. Especially in mountainous areas you might want to set higher values (e.g. 0.15 for roads works fine in Switzerand). This leads to steeper ramps to bridges, but give much fewer residuals with embankements. ============================================= ======== ======= ============================================================================== .. MAX_SLOPE_RAILWAY = 0.04 MAX_SLOPE_MOTORWAY = 0.03 # max slope for motorways MAX_SLOPE_ROAD = 0.08 MAX_TRANSVERSE_GRADIENT = 0.1 # BRIDGE_MIN_LENGTH = 20. # discard short bridges, draw road instead .. FIXME missing explanations for MAX_TRANSVERSE_GRADIENT = 0.1 # DEBUG_PLOT = 0 CREATE_BRIDGES_ONLY = 0 # create only bridges and embankments BRIDGE_LAYER_HEIGHT = 4. # bridge height per layer ... ...
This diff is collapsed.
 ... ... @@ -8,15 +8,14 @@ TODO: linear deck: limit slope if h_add too high, continue/insert bridge """ import linear import numpy as np import scipy.interpolate from pdb import pm from vec2d import vec2d import matplotlib.pyplot as plt import linear import parameters import textures.road #from turtle import Vec2D class Deck_shape_linear(object): def __init__(self, h0, h1): ... ... @@ -132,8 +131,9 @@ class LinearBridge(linear.LinearObject): if (self.D(0.5) - MSL_mid) > required_height: return dh_dx = linear.max_slope_for_road(self) import roads # late import due to circular dependency dh_dx = roads.max_slope_for_road(self) # -- need to elevate one or both ends deck_MSL_mid = MSL_mid + required_height ... ...
 ... ... @@ -137,12 +137,22 @@ def _compatible_ways(way1, way2): if _is_railway(way1) != _is_railway(way2): logging.debug("Nope, either both or none must be railway") return False if _is_bridge(way1) != _is_bridge(way2): elif _is_bridge(way1) != _is_bridge(way2): logging.debug("Nope, either both or none must be a bridge") return False if _is_highway(way1) != _is_highway(way2): elif _is_highway(way1) != _is_highway(way2): logging.debug("Nope, either both or none must be a highway") return False elif _is_highway(way1) and _is_highway(way2): highway_type1 = highway_type_from_osm_tags(way1.tags["highway"]) highway_type2 = highway_type_from_osm_tags(way2.tags["highway"]) if highway_type1 != highway_type2: logging.debug("Nope, both must be of same highway type") return False elif _is_railway(way1) and _is_railway(way2): if way1.tags['railway'] != way2.tags['railway']: logging.debug("Nope, both must be of same railway type") return False return True ... ... @@ -242,6 +252,17 @@ def highway_type_from_osm_tags(value): return None def max_slope_for_road(obj): if 'highway' in obj.tags: if obj.tags['highway'] in ['motorway']: return parameters.MAX_SLOPE_MOTORWAY else: return parameters.MAX_SLOPE_ROAD # must be aligned with accepted railways in Roads._create_linear_objects elif 'railway' in obj.tags and obj.tags['railway'] in ['rail', 'disused', 'preserved', 'subway', 'narrow_gauge']: return parameters.MAX_SLOPE_RAILWAY def _find_junctions(ways_list, degree=2): """ N = number of nodes ... ... @@ -411,7 +432,7 @@ class Roads(objectlist.ObjectList): def _propagate_h_add_over_edge(self, ref0, ref1, args): """propagate h_add over edges of graph""" obj = self.G[ref0][ref1]['obj'] dh_dx = linear.max_slope_for_road(obj) dh_dx = max_slope_for_road(obj) n0 = self.nodes_dict[ref0] n1 = self.nodes_dict[ref1] if n1.h_add > 0: ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!