Update profile definition, add a few tests

This commit is contained in:
Pieter Vander Vennet 2020-06-10 01:03:21 +02:00
parent 2d4accc1c3
commit 36c1a4fd7a
4 changed files with 33 additions and 14 deletions

View file

@ -6,11 +6,19 @@
A profile is a function which maps a set of tags onto a value. It is basically Haskell, except that functions can have _multiple_ types. During typechecking, some types will turn out not to be possible and they will dissappear, potentially fixing the implementation of the function itself.
# Injected tags
Aspects can use the following (extra) tags:
- `_direction` is the value to indicate if the traveller goes forward or backwards. It is not available when calculating the 'oneway' field
- `access` will become the value calculated in the field `access` (not available to calculate access)
- `oneway` will become the value calculated in the field `oneway` (not available to calculate access and speed)
# Vehicle.json
- Metdata: these tags will be copied to the routerdb, but can not be used for routeplanning. A prime example is `name` (the streetname), as it is useful for routeplanning but very useful for navigation afterwards
- vehciletypes: used for turn restrictions, legacy for use with itinero 1.0
- vehicletypes: used for turn restrictions, legacy for use with itinero 1.0
- defaults: a dictionary of `{"#paramName": "value"}`, used in determining the weight of an edge. note: the `#` has to be included
- `access` is a field in the vehicle file. It should be an expression returning a string. If (and only if) this string is `no`, the way will be marked as not accessible and no more values will be calculated. All other values are regarded as being accessible. When calculated, the tag `access` with the calculated value is written into the tag table or the other aspects to use.
- `oneway` is a field in the vehicle file. It should be an expression returning `both`, `with` or `against`.
@ -19,6 +27,15 @@ A profile is a function which maps a set of tags onto a value. It is basically H
- `priorities`: a table of `{'#paramName', expression}` determining the priority (1/cost) of a way, per meter. The formula used is `paramName * expression + paramName0 * expression0 + ...` (`speed`, `access` and `oneway` can be used here as tags indicate the earlier defined respective aspects). Use a weight == 1 to get the shortest route or `$speed` to get the fastest route
# Calculating oneway and forward/backward speeds
There are two possibilities in order to calculate the possible direction of a traveller can go over an edge:
1) This can be indicated explicitely with the 'oneway'-field. If this expression returns `both`, the edge is traversable in two directions. If it is either `with` or `against`, then it is not
2) This can be indicated with having a speed or factor which is equal to (or smaller then) 0, in conjunction with a `_direction=with` or `_direction=against` tag. Bicycle lanes are an excellent example for this: a `cycleway:right=yes; cycleway:left=no`, the speed and factor for `_direction=with` could be far greater then for `_direction=against`
Note that `_direction=with` and `_direction=against` are _not_ supported in Itinero1.0 profiles. For maximal compatibility and programming comfort, a mixture of both techniques should be used. For example, one aspect interpreting the legal onewayness in tandem with one aspect determining comfort by direction is optimal.
# Pitfalls

View file

@ -47,7 +47,7 @@
"share_busway": "both",
"opposite_lane": "both",
"opposite_track": "both",
"opposite": "both",
"opposite": "both"
}
}
}

View file

@ -1,12 +1,13 @@
access,oneway,speed,priority,highway,bicycle,surface,cycleway:left,oneway,oneway:bicycle,access,maxspeed
no,both,0,0,,,,,,,,
designated,both,15,15,cycleway,,,,,,,
no,both,0,0,primary,,,,,,,
yes,both,15,15,primary,yes,,,,,,
yes,both,15,15,residential,,,,,,,
yes,both,13.5,13.5,residential,yes,sett,,,,,
dismount,both,2.25,2.25,pedestrian,,,,,,,
yes,both,15,15,pedestrian,yes,,,,,,
yes,both,15,15,unclassified,,,track,yes,no,,
yes,both,15,15,service,,,,,,,
yes,both,15,15,tertiary,,,,,,yes,50
access,oneway,speed,priority,highway,bicycle,surface,cycleway:left,oneway,oneway:bicycle,access,maxspeed,junction
no,both,0,0,,,,,,,,,
designated,both,15,15,cycleway,,,,,,,,
no,both,0,0,primary,,,,,,,,
yes,both,15,15,primary,yes,,,,,,,
yes,both,15,15,residential,,,,,,,,
yes,both,13.5,13.5,residential,yes,sett,,,,,,
dismount,both,2.25,2.25,pedestrian,,,,,,,,
yes,both,15,15,pedestrian,yes,,,,,,,
yes,both,15,15,unclassified,,,track,yes,no,,,
yes,both,15,15,service,,,,,,,,
yes,both,15,15,tertiary,,,,,,yes,50,
yes,with,15,15,residential,,,,,,,,roundabout

1 access oneway speed priority highway bicycle surface cycleway:left oneway oneway:bicycle access maxspeed junction
2 no both 0 0
3 designated both 15 15 cycleway
4 no both 0 0 primary
5 yes both 15 15 primary yes
6 yes both 15 15 residential
7 yes both 13.5 13.5 residential yes sett
8 dismount both 2.25 2.25 pedestrian
9 yes both 15 15 pedestrian yes
10 yes both 15 15 unclassified track yes no
11 yes both 15 15 service
12 yes both 15 15 tertiary yes 50
13 yes with 15 15 residential roundabout

View file

@ -2,3 +2,4 @@ access,oneway,speed,priority,highway,surface
no,both,0,0,,
designated,both,15,1,cycleway,
yes,both,5.25,1,path,ground
no,both,15,0,primary,

1 access oneway speed priority highway surface
2 no both 0 0
3 designated both 15 1 cycleway
4 yes both 5.25 1 path ground
5 no both 15 0 primary