source: subversion/applications/routing/pyroute-dev/weights.py @ 18454

Last change on this file since 18454 was 18454, checked in by buerste, 10 years ago

-further updates of spaces to tabs

  • Property svn:keywords set to Rev
File size: 1.7 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5"""
6
7__version__ = "$Rev: 18454 $"
8__license__ = """This program is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 3 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program. If not, see <http://www.gnu.org/licenses/>."""
20_debug = 0
21
22
23Weightings = { \
24        'motorway': {'car':10},
25        'trunk': {'car':10, 'cycle':0.05},
26        'primary': {'cycle': 0.3, 'car':2, 'foot':1, 'horse':0.1},
27        'secondary': {'cycle': 1, 'car':1.5, 'foot':1, 'horse':0.2},
28        'tertiary': {'cycle': 1, 'car':1, 'foot':1, 'horse':0.3},
29        'unclassified': {'cycle': 1, 'car':1, 'foot':1, 'horse':1},
30        'minor': {'cycle': 1, 'car':1, 'foot':1, 'horse':1},
31        'cycleway': {'cycle': 3, 'foot':0.2},
32        'residential': {'cycle': 3, 'car':0.7, 'foot':1, 'horse':1},
33        'track': {'cycle': 1, 'car':1, 'foot':1, 'horse':1, 'mtb':3},
34        'service': {'cycle': 1, 'car':1, 'foot':1, 'horse':1},
35        'bridleway': {'cycle': 0.8, 'foot':1, 'horse':10, 'mtb':3},
36        'footway': {'cycle': 0.2, 'foot':1},
37        'steps': {'foot':1, 'cycle':0.3},
38        'rail':{'train':1},
39        'light_rail':{'train':1},
40        'subway':{'train':1}
41        }
42
43def getWeight(transport, wayType):
44        try:
45                return(Weightings[wayType][transport])
46        except KeyError:
47                # Default: if no weighting is defined, then assume it can't be routed
48                return(0)
49
Note: See TracBrowser for help on using the repository browser.