Merge pull request #764 from afischerdev/change_dynamic

Change dynamic range meaning
This commit is contained in:
afischerdev 2025-03-12 10:44:56 +01:00 committed by GitHub
commit c72fc5f74d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 28 additions and 19 deletions

View File

@ -77,7 +77,8 @@ public final class RoutingContext {
public boolean correctMisplacedViaPoints; public boolean correctMisplacedViaPoints;
public double correctMisplacedViaPointsDistance; public double correctMisplacedViaPointsDistance;
public boolean useDynamicDistance; public boolean useDynamicDistance;
public boolean buildBeelineOnRange;
private void setModel(String className) { private void setModel(String className) {
if (className == null) { if (className == null) {
pm = new StdModel(); pm = new StdModel();
@ -120,7 +121,7 @@ public final class RoutingContext {
considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f); considerTurnRestrictions = 0.f != expctxGlobal.getVariableValue("considerTurnRestrictions", footMode ? 0.f : 1.f);
correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f); correctMisplacedViaPoints = 0.f != expctxGlobal.getVariableValue("correctMisplacedViaPoints", 1.f);
correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 40.f); correctMisplacedViaPointsDistance = expctxGlobal.getVariableValue("correctMisplacedViaPointsDistance", 0.f); // 0 == don't use distance
// process tags not used in the profile (to have them in the data-tab) // process tags not used in the profile (to have them in the data-tab)
processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f); processUnusedTags = 0.f != expctxGlobal.getVariableValue("processUnusedTags", 0.f);
@ -169,7 +170,8 @@ public final class RoutingContext {
// Constant power of the biker (in W) // Constant power of the biker (in W)
bikerPower = expctxGlobal.getVariableValue("bikerPower", 100.f); bikerPower = expctxGlobal.getVariableValue("bikerPower", 100.f);
useDynamicDistance = expctxGlobal.getVariableValue("use_dynamic_range", 0f) == 1f; useDynamicDistance = expctxGlobal.getVariableValue("use_dynamic_range", 1f) == 1f;
buildBeelineOnRange = expctxGlobal.getVariableValue("add_beeline", 0f) == 1f;
boolean test = expctxGlobal.getVariableValue("check_start_way", 1f) == 1f; boolean test = expctxGlobal.getVariableValue("check_start_way", 1f) == 1f;
if (!test) freeNoWays(); if (!test) freeNoWays();

View File

@ -1085,6 +1085,7 @@ public class RoutingEngine extends Thread {
private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) { private void matchWaypointsToNodes(List<MatchedWaypoint> unmatchedWaypoints) {
resetCache(false); resetCache(false);
boolean useDynamicDistance = routingContext.useDynamicDistance; boolean useDynamicDistance = routingContext.useDynamicDistance;
boolean bAddBeeline = routingContext.buildBeelineOnRange;
double range = routingContext.waypointCatchingRange; double range = routingContext.waypointCatchingRange;
boolean ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs); boolean ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs);
if (!ok && useDynamicDistance) { if (!ok && useDynamicDistance) {
@ -1093,7 +1094,8 @@ public class RoutingEngine extends Thread {
range = -MAX_DYNAMIC_RANGE; range = -MAX_DYNAMIC_RANGE;
List<MatchedWaypoint> tmp = new ArrayList<>(); List<MatchedWaypoint> tmp = new ArrayList<>();
for (MatchedWaypoint mwp : unmatchedWaypoints) { for (MatchedWaypoint mwp : unmatchedWaypoints) {
if (mwp.crosspoint == null || mwp.radius >= routingContext.waypointCatchingRange) tmp.add(mwp); if (mwp.crosspoint == null || mwp.radius >= routingContext.waypointCatchingRange)
tmp.add(mwp);
} }
ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs); ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs);
} }
@ -1104,7 +1106,7 @@ public class RoutingEngine extends Thread {
} }
} }
// add beeline points when not already done // add beeline points when not already done
if (useDynamicDistance && !useNodePoints) { if (useDynamicDistance && !useNodePoints && bAddBeeline) {
List<MatchedWaypoint> waypoints = new ArrayList<>(); List<MatchedWaypoint> waypoints = new ArrayList<>();
for (int i = 0; i < unmatchedWaypoints.size(); i++) { for (int i = 0; i < unmatchedWaypoints.size(); i++) {
MatchedWaypoint wp = unmatchedWaypoints.get(i); MatchedWaypoint wp = unmatchedWaypoints.get(i);

View File

@ -116,14 +116,18 @@ Some variable names are pre-defined and accessed by the routing engine:
table exported as CSV. Setting it to true/1, Brouter-web Data page will table exported as CSV. Setting it to true/1, Brouter-web Data page will
list all tags present in the RD5 file. list all tags present in the RD5 file.
- `use_dynamic_range` default=false - `use_dynamic_range` default=true
To find the start / end points for a route, BRouter normally uses the To find the start / end points for a route, BRouter normally uses for all
variable `waypointCatchingRange` with a default value of 250 m. In some waypoint matches the dynamic range logic instead of the variable
`waypointCatchingRange` with a default value of 250 m. In some
situations, adding a few meters here is not enough to find a point. situations, adding a few meters here is not enough to find a point.
With this new variable, it goes deeper and could reach a radius of about 50 km. With this new variable, it goes deeper and could reach a radius of about 50 km.
From this point, the more distant road connection is established as the beeline
and included in the calculation. - `add_beeline` default=false
This enables on dynamic range search the output for the more distant road connection
as a beeline.
This is helpful in areas with less road coverage like in the Arabic world or This is helpful in areas with less road coverage like in the Arabic world or
similar areas. similar areas.

View File

@ -17,7 +17,8 @@ assign avoid_toll = false # %avoid_toll% | Avoid paid roads | boolean
assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean assign avoid_unpaved = false # %avoid_unpaved% | Avoid unpaved roads, if possible | boolean
assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean assign avoid_motorways = false # %avoid_motorways% | Avoid motorways | boolean
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign use_offroad = false # %use_offroad% | Enable additional roads | boolean
# Kinematic model parameters # Kinematic model parameters
assign vmax = 90 # %vmax% | Target speed (in km/h) | number assign vmax = 90 # %vmax% | Target speed (in km/h) | number
@ -61,8 +62,8 @@ assign caraccess
switch highway=secondary|secondary_link 1 switch highway=secondary|secondary_link 1
switch highway=tertiary|tertiary_link 1 switch highway=tertiary|tertiary_link 1
switch highway=unclassified 1 switch highway=unclassified 1
switch and highway=track use_dynamic_range 1 switch and highway=track use_offroad 1
switch and highway=road use_dynamic_range 1 switch and highway=road use_offroad 1
switch route=ferry 1 switch route=ferry 1
switch isresidentialorliving 1 switch isresidentialorliving 1
switch highway=service 1 switch highway=service 1

View File

@ -8,7 +8,7 @@ assign turnInstructionRoundabouts true # %turnInstructionRoundabouts% | Special
assign considerTurnRestrictions true assign considerTurnRestrictions true
assign turnInstructionMode 1 # %turnInstructionMode% | Mode for the generated turn-by-turn directions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=oruxmaps-style] assign turnInstructionMode 1 # %turnInstructionMode% | Mode for the generated turn-by-turn directions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=oruxmaps-style]
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
#assign processUnusedTags true #assign processUnusedTags true
assign pass1coefficient 4 assign pass1coefficient 4

View File

@ -44,7 +44,7 @@ assign initialcost_value 0 # not used now
assign allow_steps true # %allow_steps% | Set to false to disallow steps | boolean assign allow_steps true # %allow_steps% | Set to false to disallow steps | boolean
assign allow_ferries true # %allow_ferries% | set to false to disallow ferries | boolean assign allow_ferries true # %allow_ferries% | set to false to disallow ferries | boolean
assign use_dynamic_range false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign cost_of_unknown 2 # 2 as default assign cost_of_unknown 2 # 2 as default

View File

@ -16,7 +16,7 @@ assign uphillcutoff 0
assign validForBikes 1 assign validForBikes 1
assign validForCars 1 assign validForCars 1
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style] assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style]

View File

@ -12,7 +12,7 @@
# bstart /global # bstart /global
---context:global ---context:global
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign iswet 0 # 0 as default, *) flag for weather conditions assign iswet 0 # 0 as default, *) flag for weather conditions
assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osmand-style

View File

@ -2,7 +2,7 @@
# the elevation parameters # the elevation parameters
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign downhillcost 0 assign downhillcost 0
assign downhillcutoff 1.5 assign downhillcutoff 1.5

View File

@ -15,7 +15,7 @@ assign ignore_cycleroutes = false # %ignore_cycleroutes% | Set true for
assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set true to just follow cycleroutes | boolean assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set true to just follow cycleroutes | boolean
assign avoid_unsafe = false # %avoid_unsafe% | Set true to avoid standard highways | boolean assign avoid_unsafe = false # %avoid_unsafe% | Set true to avoid standard highways | boolean
assign use_dynamic_range = false # %use_dynamic_range% | Enable distant start/end points | boolean assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean
assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean