Changeset 918

Show
Ignore:
Timestamp:
05/25/07 13:48:44 (5 years ago)
Author:
bycycle
Message:

Fixed bicycle travel mode so that it takes into account MAX lines. In
particular, if a street has a MAX line and a bike lane, we need to convert
the street classification code to an equivalent non-MAX code (e.g., 5301 =>
1300).

Related to this, don't set lengths for unknown street class codes in
_adjustRowForMatrix. Before, if the code didn't have certain values,
the length for the corresponding segment would be set to something big
so the segment wouldn't get used. Beside the fact that this was already
being handled in getEdgeWeight, getEdgeWeight is the *correct*
place to do stuff like that anyway.

Location:
core/trunk/byCycle/model
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • core/trunk/byCycle/model/portlandor/__init__.py

    r912 r918  
    2323from byCycle.model.data.sqltypes import POINT, LINESTRING 
    2424from byCycle.model.portlandor.data import SRID, slug 
     25 
     26from dijkstar import infinity 
    2527 
    2628__all__ = ['Edge', 'Node', 'StreetName', 'City', 'State', 'Place'] 
     
    6466            'up_frac': encodeFloat(row.up_frac), 
    6567        } 
    66         code = row.code 
    67         if not ((1200 <= code < 1600) or (3200 <= code < 3300)): 
    68             adjustments['length'] = 5280000 
    6968        return adjustments 
    7069 
  • core/trunk/byCycle/model/portlandor/bicycle.py

    r907 r918  
    1818# Preferences 
    1919FASTER, SHORTER, FLATTER, SAFER, DEFAULT = range(5) 
     20 
     21# This maps MAX street class codes to "normal" codes, for use with bike lanes 
     22max_codes = { 
     23    5301: 1300, 
     24    5401: 1400, 
     25    5501: 1500, 
     26} 
    2027 
    2128 
     
    115122        node_f_id = edge_attrs[node_f_id_index] 
    116123        street_name_id = edge_attrs[street_name_id_index] 
    117         #cpd = edge_attrs[cpd_index] 
    118   
     124 
    119125        # -- Calculate base weight of edge (in hours) 
    120126         
     
    160166 
    161167        # -- Adjust weight based on user preference 
    162          
    163         if bikemode is not 'n': 
     168        if bikemode != 'n': 
    164169            # Adjust bike network street 
    165170            if   bikemode == 't':          hours *= mu 
    166171            elif bikemode == 'p':          hours *= mm 
    167172            elif bikemode == 'b': 
     173                code = max_codes.get(code, code) 
    168174                # Adjust bike lane for traffic (est. from st. type) 
    169175                if   code in (1500, 1521): hours *= blt    #lt 
  • core/trunk/byCycle/model/route.py

    r913 r918  
    8181                d['toward'], 
    8282                '%.2f' % (d['distance']['miles']), 
    83                 self.region.units, 
     83                'miles', 
    8484                bm, 
    8585            ))