From 1fd007d043ba803aabcbcf9c01503e6ba8485d45 Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sun, 17 May 2020 23:09:51 +0200
Subject: [PATCH 01/33] export Oruxmaps Navigation instructions
---
.../src/main/java/btools/router/OsmTrack.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java
index 9e283b4..c732a03 100644
--- a/brouter-core/src/main/java/btools/router/OsmTrack.java
+++ b/brouter-core/src/main/java/btools/router/OsmTrack.java
@@ -528,6 +528,23 @@ public final class OsmTrack
.append( "\n" );
}
}
+
+ if ( turnInstructionMode == 6 ) // orux style
+ {
+ for( VoiceHint hint: voiceHints.list )
+ {
+ sb.append( " " )
+ .append( hint.selev == Short.MIN_VALUE ? "" : "" + (hint.selev / 4.) + "" )
+ .append( "\n" +
+ "\n" +
+ "" ).append("" + hint.getOruxAction() )
+ .append( "\n" +
+ "\n" +
+ "\n" +
+ "" );
+ }
+ }
for( int i=0; i<=pois.size() - 1; i++ )
{
From 8dca37558986afafeb17ef7e5d3376643451f952 Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sun, 17 May 2020 23:24:01 +0200
Subject: [PATCH 02/33] export Oruxmaps Navigation instructions
---
.../main/java/btools/router/VoiceHint.java | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/brouter-core/src/main/java/btools/router/VoiceHint.java b/brouter-core/src/main/java/btools/router/VoiceHint.java
index 1e15bac..c3ec1a4 100644
--- a/brouter-core/src/main/java/btools/router/VoiceHint.java
+++ b/brouter-core/src/main/java/btools/router/VoiceHint.java
@@ -158,6 +158,27 @@ public class VoiceHint
default : throw new IllegalArgumentException( "unknown command: " + cmd );
}
}
+
+ public int getOruxAction()
+ {
+ switch ( cmd )
+ {
+ case TU : return 1003;
+ case TSHL : return 1019;
+ case TL : return 1000;
+ case TSLL : return 1017;
+ case KL : return 1015; // ?
+ case C : return 1002;
+ case KR : return 1014; // ?
+ case TSLR : return 1016;
+ case TR : return 1001;
+ case TSHR : return 1018;
+ case TRU : return 1003;
+ case RNDB : return 1008 + roundaboutExit;
+ case RNLB : return 1008 + roundaboutExit;
+ default : throw new IllegalArgumentException( "unknown command: " + cmd );
+ }
+ }
public void calcCommand()
{
From ac38737927a1beac4ec583849167ed8a780036b2 Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Fri, 29 May 2020 02:10:28 +0200
Subject: [PATCH 03/33] Update fastbike.brf
---
misc/profiles2/fastbike.brf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/misc/profiles2/fastbike.brf b/misc/profiles2/fastbike.brf
index 2463b7b..1227146 100644
--- a/misc/profiles2/fastbike.brf
+++ b/misc/profiles2/fastbike.brf
@@ -62,6 +62,9 @@ assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobbl
assign turncost = if junction=roundabout then 0
else 90
+assign initialclassifier =
+ if route=ferry then 1
+ else 0
assign initialcost switch route=ferry 10000 0
From 8f4b5709e36dd717a9f8045b6d187c450f28e33d Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Fri, 29 May 2020 02:13:16 +0200
Subject: [PATCH 04/33] Update moped.brf
---
misc/profiles2/moped.brf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/misc/profiles2/moped.brf b/misc/profiles2/moped.brf
index 5a5a260..fb4033b 100644
--- a/misc/profiles2/moped.brf
+++ b/misc/profiles2/moped.brf
@@ -23,6 +23,10 @@ assign turnInstructionMode = 1 # 0=none, 1=auto-choose, 2=locus-style, 3=osman
assign turncost = if junction=roundabout then 0
else 90
+assign initialclassifier =
+ if route=ferry then 1
+ else 0
+
assign initialcost switch route=ferry 20000 0
From 43a79e4cb51c97508aed50c04e2a5490fcda430f Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Fri, 29 May 2020 02:15:50 +0200
Subject: [PATCH 05/33] Update hiking-beta.brf
---
misc/profiles2/hiking-beta.brf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/misc/profiles2/hiking-beta.brf b/misc/profiles2/hiking-beta.brf
index 25159d2..aa359b0 100644
--- a/misc/profiles2/hiking-beta.brf
+++ b/misc/profiles2/hiking-beta.brf
@@ -109,6 +109,10 @@ assign issidewalk not or sidewalk= or sidewalk=none sidewalk=no
assign turncost switch or shortest_way is_ldhr 0 turncost_value #v1.5
+assign initialclassifier =
+ if route=ferry then 1
+ else 0
+
assign initialcost
switch route=ferry 10000
From 5b419b6b2a060ba71813afaa71aa855fe03bc446 Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Fri, 29 May 2020 02:17:41 +0200
Subject: [PATCH 06/33] Update shortest.brf
---
misc/profiles2/shortest.brf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/misc/profiles2/shortest.brf b/misc/profiles2/shortest.brf
index 4295e29..31153cb 100644
--- a/misc/profiles2/shortest.brf
+++ b/misc/profiles2/shortest.brf
@@ -17,6 +17,10 @@ assign nodeaccessgranted or any_cycleroute lcn=yes
assign turncost 0
+assign initialclassifier =
+ if route=ferry then 1
+ else 0
+
assign initialcost switch route=ferry 10000 0
#
From 7da925a21276f3ec9ede18fc16ece6df964279de Mon Sep 17 00:00:00 2001
From: Marcus Jaschen
Date: Sat, 13 Jun 2020 16:43:39 +0200
Subject: [PATCH 07/33] add `dummyUsage` to certain profiles
If BRouter calculates a route with a cycling or hiking profile,
the `smoothness` tag is included in the response. That enables
a statistical analysis for the calculated route (distribution of
smoothness tags by distance).
See the analysis sidebar at https://brouter.m11n.de/ for an example.
---
misc/profiles2/fastbike-verylowtraffic.brf | 2 ++
misc/profiles2/fastbike.brf | 2 ++
misc/profiles2/hiking-beta.brf | 5 ++++-
misc/profiles2/moped.brf | 2 ++
misc/profiles2/shortest.brf | 3 +++
misc/profiles2/trekking.brf | 2 ++
misc/profiles2/vm-forum-liegerad-schnell.brf | 3 ++-
misc/profiles2/vm-forum-velomobil-schnell.brf | 3 ++-
8 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/misc/profiles2/fastbike-verylowtraffic.brf b/misc/profiles2/fastbike-verylowtraffic.brf
index ee1bdc0..b13979c 100644
--- a/misc/profiles2/fastbike-verylowtraffic.brf
+++ b/misc/profiles2/fastbike-verylowtraffic.brf
@@ -331,6 +331,8 @@ assign classifiermask
add multiply islinktype 8
multiply isgoodforcars 16
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/fastbike.brf b/misc/profiles2/fastbike.brf
index 1227146..2767c2e 100644
--- a/misc/profiles2/fastbike.brf
+++ b/misc/profiles2/fastbike.brf
@@ -260,6 +260,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/hiking-beta.brf b/misc/profiles2/hiking-beta.brf
index aa359b0..3e0869c 100644
--- a/misc/profiles2/hiking-beta.brf
+++ b/misc/profiles2/hiking-beta.brf
@@ -237,7 +237,10 @@ assign costfactor
switch highway=tertiary|tertiary_link|unclassified switch ismuddy 2.0 switch iswet switch issidewalk 1.4 1.7
switch issidewalk 1.7 2.0
- add cost_of_unknown ( switch ismuddy 0.5 0.0 )
+ add cost_of_unknown ( switch ismuddy 0.5 0.0 )
+
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/moped.brf b/misc/profiles2/moped.brf
index fb4033b..b290370 100644
--- a/misc/profiles2/moped.brf
+++ b/misc/profiles2/moped.brf
@@ -144,6 +144,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/shortest.brf b/misc/profiles2/shortest.brf
index 31153cb..c55f3db 100644
--- a/misc/profiles2/shortest.brf
+++ b/misc/profiles2/shortest.brf
@@ -114,6 +114,9 @@ assign classifiermask add multiply isroundabout 4
add multiply islinktype 8
multiply isgoodforcars 16
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
+
---context:node # following code refers to node tags
assign defaultaccess
diff --git a/misc/profiles2/trekking.brf b/misc/profiles2/trekking.brf
index b8f3390..7d9a1a9 100644
--- a/misc/profiles2/trekking.brf
+++ b/misc/profiles2/trekking.brf
@@ -301,6 +301,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/vm-forum-liegerad-schnell.brf b/misc/profiles2/vm-forum-liegerad-schnell.brf
index 414e0a0..61c7604 100644
--- a/misc/profiles2/vm-forum-liegerad-schnell.brf
+++ b/misc/profiles2/vm-forum-liegerad-schnell.brf
@@ -396,7 +396,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
-
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
diff --git a/misc/profiles2/vm-forum-velomobil-schnell.brf b/misc/profiles2/vm-forum-velomobil-schnell.brf
index bfa2ebd..ae6588e 100644
--- a/misc/profiles2/vm-forum-velomobil-schnell.brf
+++ b/misc/profiles2/vm-forum-velomobil-schnell.brf
@@ -396,7 +396,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
-
+# include `smoothness=` tags in the response's WayTags for track analysis
+assign dummyUsage = smoothness=
---context:node # following code refers to node tags
From 43961b8d08dffd861c4da84dd006e2e5b39c8461 Mon Sep 17 00:00:00 2001
From: Marcus Jaschen
Date: Sat, 13 Jun 2020 20:00:32 +0200
Subject: [PATCH 08/33] remove `assign dummyUsage = smoothness=` for `vm-*`
profiles as they consider the smoothness already
---
misc/profiles2/vm-forum-liegerad-schnell.brf | 3 ---
misc/profiles2/vm-forum-velomobil-schnell.brf | 3 ---
2 files changed, 6 deletions(-)
diff --git a/misc/profiles2/vm-forum-liegerad-schnell.brf b/misc/profiles2/vm-forum-liegerad-schnell.brf
index 61c7604..20cad10 100644
--- a/misc/profiles2/vm-forum-liegerad-schnell.brf
+++ b/misc/profiles2/vm-forum-liegerad-schnell.brf
@@ -396,9 +396,6 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
-# include `smoothness=` tags in the response's WayTags for track analysis
-assign dummyUsage = smoothness=
-
---context:node # following code refers to node tags
# Parameter für Knotenpunkte
diff --git a/misc/profiles2/vm-forum-velomobil-schnell.brf b/misc/profiles2/vm-forum-velomobil-schnell.brf
index ae6588e..eddb815 100644
--- a/misc/profiles2/vm-forum-velomobil-schnell.brf
+++ b/misc/profiles2/vm-forum-velomobil-schnell.brf
@@ -396,9 +396,6 @@ assign classifiermask add isbadoneway
add multiply islinktype 8
multiply isgoodforcars 16
-# include `smoothness=` tags in the response's WayTags for track analysis
-assign dummyUsage = smoothness=
-
---context:node # following code refers to node tags
# Parameter für Knotenpunkte
From 74b1f1308d9898c5d2cf5f5733fb2e3acc3f4b87 Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sun, 21 Jun 2020 23:01:26 +0200
Subject: [PATCH 09/33] update vm-forum profiles
use the brouter-web options for profile adjustment
---
misc/profiles2/vm-forum-liegerad-schnell.brf | 901 +++++++++---------
misc/profiles2/vm-forum-velomobil-schnell.brf | 901 +++++++++---------
2 files changed, 920 insertions(+), 882 deletions(-)
diff --git a/misc/profiles2/vm-forum-liegerad-schnell.brf b/misc/profiles2/vm-forum-liegerad-schnell.brf
index 20cad10..91efd23 100644
--- a/misc/profiles2/vm-forum-liegerad-schnell.brf
+++ b/misc/profiles2/vm-forum-liegerad-schnell.brf
@@ -1,441 +1,460 @@
-#
-# Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de
-
----context:global
-
-assign totalMass = 90 #Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg
-assign maxSpeed = 60 #Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
-assign S_C_x = 0.23 #Effektive Stirnfläche in m²
-assign C_r = 0.004 #Rollwiderstand
-assign bikerPower = 125 #Dauerleistung in Watt
-
-assign ignore_bicycle_no = false # für Regionen mit falschen bicyle=no tags können sie mit "true" ignoriert werden. Auch Shuttletransporte (bicycle=dismount + foot=no) werden geroutet
-assign consider_smoothness_tags = true # mit false kann die kanne die Auswertung der smoothness tags abgeschaltet werden
-assign low_memory_cutoff = false # mit true werden Wege mit hohen Kosten aus der Berechnung genommen und damit wird die Berechnung schneller und benötigt weniger Arbeitspeicher.
-
-assign turnInstructionMode 1 #Ausgabe von Abiegehinweise 0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style
-assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert
-assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
-
-assign downhillcost 80 # Kosten für die Höhenmeter bergab
-assign downhillcutoff 0.1 # Gefälle unter diesem Wert in Prozent werden nicht gewertet
-assign uphillcost 80 # Kosten für die Höhenmeter bergauf
-assign uphillcutoff 1 # Steigungen unter diesem Wert in Prozent werden nicht gewertet
-
-assign validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
-assign considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
-
-assign pass1coefficient 2.5 # Berechnugskoeffizient für erste schnelle Berechnung
-assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
-# sinnvolle Werte für den ersten Koeffizienten:
-# 1 exakte Berechnung beim ersten Durchlauf
-# umso größer die Werte umso schneller und ungenauer die erste Berechnung
-# sinnvolle Werte für den zweiten Koeffizienten:
-# 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
-# -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
-
-# Um die ungenauen SRTM Höhendaten zu filtern werden für jeweils für Anstiege und Gefälle Puffer verwendet. Erst wenn diese überschritten werden die Segmente als Anstiege oder Gefälle gewertet.
-
-assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
-assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
-assign elevationbufferreduce 1 # im Bereich zwischen elevationpenaltybuffer und elevationmaxbuffer wird eine Höhenstrafe, die einer Steigung oder Gefälle dieses Wertes (in Prozent) entspricht, verhängt und diese Höhenmeter vom Puffer abgezogen.
-
-assign lmc switch low_memory_cutoff 10000 0
----context:way
-
-# Parameter für die Wege
-#zusätzliche Kosten in Meter für jeden Streckenabschnitt
-
-assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
-assign nodeaccessgranted or any_cycleroute lcn=yes
-
-assign cycleway
- or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
-
-assign footway
- or highway=footway and highway=path foot=designated|yes
-
-assign turncost
- switch junction=roundabout 0
- 150 # Kosten die für eine 90 Grad Abbiegung berechnet werden. Für kleinere Winkel werden sie mit turncost*cos(Winkel) berechnet, bei Kreisverkehr keine weitere Kosten
-
-assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
- switch route=ferry 2
- switch highway=steps 3
- switch cycleway 4
- switch footway 5
- 1
-
-assign initialcost
- switch route=ferry 10000 # Kosten wenn eine Fähre verwendet wird
- switch highway=steps 1000 # Kosten für Stufen
- switch cycleway 100 # Kosten für Radwege
- switch footway 1000 # Kosten für Fußwege
- 0
-
-# Kosten ab hier als Meter für jeden tatsächlichen Meter
-
-assign oneway
- switch oneway=
- junction=roundabout
- or oneway=yes or oneway=true oneway=1
-
-assign onewaypenalty
- switch switch reversedirection=yes oneway oneway=-1
- switch or cycleway=opposite or cycleway=opposite_lane or cycleway=opposite_track oneway:bicycle=no 0 #zusätzliche Kosten für in Gegenrichtung für Radfahrer freigegebene Einbahnstraßen in Gegenrichtung
- switch or highway=primary highway=primary_link add lmc 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
- switch or highway=secondary highway=secondary_link add lmc 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
- switch or highway=tertiary highway=tertiary_link add lmc 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
- 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
- 0.0
-
-assign defaultaccess
- switch access=
- not motorroad=yes
- switch or access=private access=no
- 0
- 1
-
-assign bikeaccess
- or any_cycleroute
- switch bicycle=
- switch bicycle_road=yes
- 1
- switch vehicle=
- defaultaccess
- switch or vehicle=private vehicle=no
- 0
- 1
- not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
-
-
-assign footaccess
- or bikeaccess
- or and bicycle=dismount ignore_bicycle_no
- switch foot=
- defaultaccess
- not or foot=private foot=no
-
-assign accesspenalty
- switch bikeaccess
- 0
- switch footaccess
- 10 #Zusatzkosten fürs Schieben
- 10000 #Zusatzkosten für gesperrte oder private Wege
-
-assign maxspeed_forward
- switch maxspeed:forward=50 50
- switch maxspeed:forward=30 30
- switch maxspeed:forward=10 10
- switch maxspeed:forward=20 20
- switch maxspeed:forward=40 40
- switch maxspeed:forward=60 60
- switch maxspeed:forward=70 70
- switch maxspeed:forward=80 80
- switch maxspeed:forward=90 90
- switch maxspeed:forward=100 100
- switch maxspeed:forward=110 110
- switch maxspeed:forward=120 120
- switch maxspeed:forward=130 130
- switch maxspeed:forward=urban 50
- switch maxspeed:forward=rural 100
- 0
-
-assign maxspeed_backward
- switch maxspeed:backward=50 50
- switch maxspeed:backward=30 30
- switch maxspeed:backward=10 10
- switch maxspeed:backward=20 20
- switch maxspeed:backward=40 40
- switch maxspeed:backward=60 60
- switch maxspeed:backward=70 70
- switch maxspeed:backward=80 80
- switch maxspeed:backward=90 90
- switch maxspeed:backward=100 100
- switch maxspeed:backward=110 110
- switch maxspeed:backward=120 120
- switch maxspeed:backward=130 130
- switch maxspeed:backward=urban 50
- switch maxspeed:backward=rural 100
- 0
-
-assign maxspeed
- switch and reversedirection=yes maxspeed_backward maxspeed_backward
- switch and not reversedirection=yes maxspeed_forward maxspeed_forward
- switch maxspeed=50 50
- switch maxspeed=30 30
- switch maxspeed=10 10
- switch maxspeed=20 20
- switch maxspeed=40 40
- switch maxspeed=60 60
- switch maxspeed=70 70
- switch maxspeed=80 80
- switch maxspeed=90 90
- switch maxspeed=100 100
- switch maxspeed=110 110
- switch maxspeed=120 120
- switch maxspeed=130 130
- switch maxspeed=urban 50
- switch maxspeed=rural 100
- 999
-
-
-assign downspeedpenalty
- switch equal maxspeed 10 4 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle
- switch equal maxspeed 20 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle
- switch equal maxspeed 30 0.7 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
- switch equal maxspeed 40 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
- switch equal maxspeed 50 0.2 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
- 0
-
-assign flatspeedpenalty
- switch equal maxspeed 10 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
- switch equal maxspeed 20 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
- switch equal maxspeed 30 0.15 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
- switch equal maxspeed 40 0.12 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
- switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
- 0
-
-assign upspeedpenalty
- switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
- switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
- switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
- 0
-
-
-assign surfacepenalty
- add switch embedded_rails=tram|yes|rail 10 # Zusatzkosten bei Schienen in der Fahrbahn
- 0
- switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
- switch concrete=plates 1 # Zusatzkosten für Betonplattenwege
- switch concrete=lanes 2 # Zusatzkosten für Betonspurplatten
- switch surface=concrete|paving_stones|wood|metal 0.4 #Zusatzkosten für Beton, Pflastersteine, Holz oder Metall
- switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 4 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine
- switch surface=gravel|sand|pebblestone add lmc 10 #Zusatzkosten für Schotter, Sand oder Kies
- switch surface=ground|grass|unpaved|dirt|earth|mud|clay add lmc 50 #Zusatzkosten für naturbelassene Wege, Grasswege, unbefestigte Wege, Schmutzwege, erdige Wege, schlammige Wege oder Lehmwege
- 0
-
-assign smoothnesspenalty
- switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen
- switch smoothness=intermediate|medium 0.2 #Zusatzkosten für mittelmäßige Oberflächen
- switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
- switch smoothness=robust_wheels|bad add lmc 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
- switch smoothness=high_clearance|off_road_wheels|very_bad|horrible|very_horrible|impassable add lmc 100 #Zusatzkosten für Oberflächen die eine erhöhte Bodenfreiheit oder Geländebereifung benötigen, schrecklich, sehr schrecklich oder unpasierbar sind
- 0
-
-
-assign costfactor
-
-# dieser Abschnitt ist für die Kosten in der Ebene
-
- switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
- switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
-
- min 9999
-
- add onewaypenalty
- add accesspenalty
- add surfacepenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add flatspeedpenalty
-
- switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
- switch route=ferry 10.67 # Kosten für Fähren
- switch highway=trunk|trunk_link 5 # Kosten für eine autobahnänliche Straße
- switch highway=primary|primary_link 2 # Kosten für Bundesstraßen
- switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
- switch highway=tertiary|tertiary_link 1 # Kosten für Kreisstraßen
- switch highway=unclassified 1 # Kosten für Verbindungsstraßen
- switch highway=residential|service 1.2 # Kosten für Wohn- und Zufahrtsstraßen
- switch highway=track
- switch tracktype=grade1 1.2 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
- switch tracktype=grade2 7 # Kosten für geschotterte Feldwege
- switch tracktype=grade3 add lmc 40 # Kosten für Feldwege mit weichem Untergrund
- switch tracktype=grade4 add lmc 50 # Kosten für unbefestigte Feldwege
- switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege
- add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
- switch cycleway 1.3 # Kosten für Fahrradwege
- switch ( or highway=living_street living_street=yes ) 4 # Kosten für Spielstraßen
- switch highway=road 7 # Kosten für noch nicht genauer beschriebene Straße
- switch footway 15 # Kosten für Fußwege
- switch highway=pedestrian 20 # Kosten für Gehwege
- switch highway=steps 30 # Kosten für Stufen
- switch highway=path
- switch surface= add lmc 40 # Kosten für Pfade ohne Oberflächenangabe
- 1.3 # Kosten für Pfade mit Oberflächenangabe
- switch highway=bridleway add lmc 80 # Kosten für Reitwege
- add lmc 20 # Kosten für sonstige Wege
-
-assign uphillcostfactor
-
-# dieser Abschnitt ist für die Kosten bei Anstiegen
-# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
-
- switch and highway= not route=ferry 10000
- switch or highway=proposed highway=abandoned 10000
-
- min 9999
-
- add upspeedpenalty
- add onewaypenalty
- add accesspenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add surfacepenalty
-
- switch highway=motorway|motorway_link 10000
- switch route=ferry 10.67
- switch highway=trunk|trunk_link 7
- switch highway=primary|primary_link 3
- switch highway=secondary|secondary_link 1.2
- switch highway=tertiary|tertiary_link 1
- switch highway=unclassified 1
- switch highway=residential|service 1
- switch highway=track
- switch tracktype=grade1 1
- switch tracktype=grade2 3
- switch tracktype=grade3 add lmc 40
- switch tracktype=grade4 add lmc 50
- switch tracktype=grade5 add lmc 50
- add lmc 20
- switch cycleway 1
- switch ( or highway=living_street living_street=yes ) 2.5
- switch highway=road 5
- switch footway 15
- switch highway=pedestrian 20
- switch highway=steps 30
- switch highway=path
- switch surface= add lmc 30
- 1
- switch highway=bridleway add lmc 80
- add lmc 20
-
-assign downhillcostfactor
-
-# dieser Abschnitt ist für die Kosten bei Gefälle
-# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
-
- switch and highway= not route=ferry 10000
- switch or highway=proposed highway=abandoned 10000
-
- min 9999
-
- add downspeedpenalty
- add onewaypenalty
- add accesspenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add surfacepenalty
-
- switch highway=motorway|motorway_link 10000
- switch route=ferry 10.67
- switch highway=trunk|trunk_link 3
- switch highway=primary|primary_link 2
- switch highway=secondary|secondary_link 1
- switch highway=tertiary|tertiary_link 1
- switch highway=unclassified 1.2
- switch highway=residential|service 2
- switch highway=track
- switch tracktype=grade1 2
- switch tracktype=grade2 8
- switch tracktype=grade3 add lmc 40
- switch tracktype=grade4 add lmc 50
- switch tracktype=grade5 add lmc 50
- add lmc 20
- switch cycleway 2
- switch ( or highway=living_street living_street=yes ) 8
- switch highway=road 10
- switch footway 20
- switch highway=pedestrian 30
- switch highway=steps 40
- switch highway=path
- switch surface= add lmc 40
- 2
- switch highway=bridleway add lmc 80
- add lmc 20
-
-
-# hier kommen Variablen die zur Generierung der Abiegehinweise benötigt werden
-
-assign priorityclassifier =
-
- if ( highway=motorway ) then 30
- else if ( highway=motorway_link ) then 29
- else if ( highway=trunk ) then 28
- else if ( highway=trunk_link ) then 27
- else if ( highway=primary ) then 26
- else if ( highway=primary_link ) then 25
- else if ( highway=secondary ) then 24
- else if ( highway=secondary_link ) then 23
- else if ( highway=tertiary ) then 22
- else if ( highway=tertiary_link ) then 21
- else if ( highway=unclassified ) then 20
- else if ( or highway=residential|living_street living_street=yes ) then 6
- else if ( highway=service ) then 6
- else if ( highway=cycleway ) then 6
- else if ( or bicycle=designated bicycle_road=yes ) then 6
- else if ( highway=track ) then if tracktype=grade1 then 6 else 4
- else if ( highway=bridleway|road|path|footway ) then 4
- else if ( highway=steps ) then 2
- else if ( highway=pedestrian ) then 2
- else 0
-
-
-
-assign isbadoneway = not equal onewaypenalty 0
-assign isgoodoneway = if reversedirection=yes then oneway=-1
- else if oneway= then junction=roundabout else oneway=yes|true|1
-assign isroundabout = junction=roundabout
-assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
-assign isgoodforcars = if greater priorityclassifier 6 then true
- else if ( or highway=residential|living_street|service living_street=yes ) then true
- else if ( and highway=track tracktype=grade1 ) then true
- else false
-
-assign classifiermask add isbadoneway
- add multiply isgoodoneway 2
- add multiply isroundabout 4
- add multiply islinktype 8
- multiply isgoodforcars 16
-
----context:node # following code refers to node tags
-
-# Parameter für Knotenpunkte
-# Kosten an Knotenpunkten in Meter
-
-
-assign defaultaccess
- switch access=
- 1 # add default barrier restrictions here!
- switch or access=private access=no
- 0
- 1
-
-assign bikeaccess
- or nodeaccessgranted=yes
- switch bicycle=
- switch vehicle=
- defaultaccess
- switch or vehicle=private vehicle=no
- 0
- 1
- switch or bicycle=private or and not or highway=crossing ignore_bicycle_no bicycle=no bicycle=dismount
- 0
- 1
-
-assign footaccess
- or bicycle=dismount
- switch foot=
- defaultaccess
- switch or foot=private foot=no
- 0
- 1
-
-assign initialcost
- add switch highway=traffic_signals 200 # Kosten für Ampel
- switch highway=stop 150 # Kosten für Stoppschild
- switch railway=crossing|level_crossing 200 # Kosten für Bahnübergang
- 0
- switch bikeaccess
- 0
- switch footaccess
- 10000 # Kosten fürs Absteigen
- 1000000 #Kosten für verbotene oder private Wege
+#
+# Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de
+
+---context:global
+
+assign no_steps = false # %no_steps% | keine Stufen, das Liegerad soll nicht getragen werden müssen | boolean
+assign no_wrong_oneway = false # %no_wrong oneway% | keine Einbahnstrasse in falsche Richtung, auch nicht schiebend | boolean
+
+assign dismount_cost = 1000 # %dismount_cost% | Umweg in Meter der in Kauf genommen wird bevor eine Strecke genommen wird bei der man austeigen muss, ab 1 000 000 wird keine Schiebestrecke mehr genommen | number
+assign avoid_main_roads = 5 # %avoid_main_roads% | große Straße vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 3 = Standard, 10 = stark vermeiden | number
+assign avoid_small_roads = 5 # %avoid_small_roads% | kleine Straße vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
+assign avoid_cycleways = 3 # %avoid_cycleways% | Radwege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 3 = Standard, 10 = stark vermeiden | number
+assign avoid_elevation = 5 # %avoid_elevation% | Hohenmeter vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
+assign avoid_bad_ways = 8 # %avoid_bad_ways% | Schlechte Wege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 8 = Standard, 10 = stark vermeiden | number
+
+assign totalMass = 90 # %totalMass% | Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg, für Fahrtzeitschätzung | number
+assign maxSpeed = 60 # Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
+assign S_C_x = 0.23 # Effektive Stirnfläche in m²
+assign C_r = 0.004 # Rollwiderstand
+assign bikerPower = 125 # %bikerPower% | Dauerleistung in Watt, für Fahrtzeitschätzung| number
+
+
+assign ignore_bicycle_no = false # %ignore_bicycle_no% | für Regionen mit falschen bicyle=no tags können sie mit "true" ignoriert werden. Auch Shuttletransporte (bicycle=dismount + foot=no) werden geroutet | boolean
+
+
+assign turnInstructionMode = 1 # %turnInstructionMode% | Modus für die Abbiegehinweise | [0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style, 4=comment-Style, 5=gpsies-Style, 6=orux-Style]
+assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert
+assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
+
+assign avoidmr2 multiply 0.04 multiply avoid_main_roads avoid_main_roads
+assign avoidsr multiply 0.2 avoid_small_roads
+assign avoidbw multiply 0.125 avoid_bad_ways
+assign avoid_ele multiply avoid_elevation 0.2
+
+assign downhillcost multiply avoid_ele 80 # Kosten für die Höhenmeter bergab
+assign downhillcutoff 0.1 # Gefälle unter diesem Wert in Prozent werden nicht gewertet
+assign uphillcost multiply avoid_ele 80 # Kosten für die Höhenmeter bergauf
+assign uphillcutoff 1 # Steigungen unter diesem Wert in Prozent werden nicht gewertet
+
+assign validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
+assign considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
+
+assign pass1coefficient 2.5 # Berechnugskoeffizient für erste schnelle Berechnung
+assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
+# sinnvolle Werte für den ersten Koeffizienten:
+# 1 exakte Berechnung beim ersten Durchlauf
+# umso größer die Werte umso schneller und ungenauer die erste Berechnung
+# sinnvolle Werte für den zweiten Koeffizienten:
+# 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
+# -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
+
+# Um die ungenauen SRTM Höhendaten zu filtern werden für jeweils für Anstiege und Gefälle Puffer verwendet. Erst wenn diese überschritten werden die Segmente als Anstiege oder Gefälle gewertet.
+
+assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
+assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
+assign elevationbufferreduce 1 # im Bereich zwischen elevationpenaltybuffer und elevationmaxbuffer wird eine Höhenstrafe, die einer Steigung oder Gefälle dieses Wertes (in Prozent) entspricht, verhängt und diese Höhenmeter vom Puffer abgezogen.
+
+---context:way
+
+# Parameter für die Wege
+#zusätzliche Kosten in Meter für jeden Streckenabschnitt
+
+assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
+assign nodeaccessgranted or any_cycleroute lcn=yes
+
+assign cycleway
+ or highway=cycleway and highway=path|footway|pedestrian bicycle=designated|yes
+
+assign footway
+ or highway=footway|pedestrian and highway=path foot=designated|yes
+
+assign turncost
+ switch junction=roundabout 0
+ 150 # Kosten die für eine 90 Grad Abbiegung berechnet werden. Für kleinere Winkel werden sie mit turncost*cos(Winkel) berechnet, bei Kreisverkehr keine weitere Kosten
+
+assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
+ switch route=ferry 2
+ switch highway=steps 3
+ switch cycleway 4
+ switch footway 5
+ 1
+
+assign initialcost
+ switch route=ferry 10000 # Kosten wenn eine Fähre verwendet wird
+ switch highway=steps switch no_steps 1000000 dismount_cost # Kosten für Stufen
+ switch cycleway multiply 11.1111112 multiply avoid_cycleways avoid_cycleways # Kosten für Radwege
+ switch footway dismount_cost # Kosten für Fußwege
+ 0
+
+# Kosten ab hier als Meter für jeden tatsächlichen Meter
+
+assign oneway
+ switch oneway=
+ junction=roundabout
+ or oneway=yes or oneway=true oneway=1
+
+assign onewaypenalty
+ switch switch reversedirection=yes oneway oneway=-1
+ switch or cycleway=opposite or cycleway=opposite_lane or cycleway=opposite_track oneway:bicycle=no 0 #zusätzliche Kosten für in Gegenrichtung für Radfahrer freigegebene Einbahnstraßen in Gegenrichtung
+ switch no_wrong_oneway 10000
+ switch or highway=primary highway=primary_link 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
+ switch or highway=secondary highway=secondary_link 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
+ switch or highway=tertiary highway=tertiary_link 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
+ 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
+ 0.0
+
+assign defaultaccess
+ switch access=
+ not motorroad=yes
+ switch or access=private access=no
+ 0
+ 1
+
+assign bikeaccess
+ or any_cycleroute
+ switch bicycle=
+ switch vehicle=
+ defaultaccess
+ switch or vehicle=private vehicle=no
+ 0
+ 1
+ not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
+
+
+assign footaccess
+ or bikeaccess
+ or and bicycle=dismount ignore_bicycle_no
+ switch foot=
+ defaultaccess
+ not or foot=private foot=no
+
+assign accesspenalty
+ switch bikeaccess
+ 0
+ switch footaccess
+ 10 #Zusatzkosten fürs Schieben
+ 10000 #Zusatzkosten für gesperrte oder private Wege
+
+assign maxspeed_forward
+ switch maxspeed:forward=50 50
+ switch maxspeed:forward=30 30
+ switch maxspeed:forward=10 10
+ switch maxspeed:forward=20 20
+ switch maxspeed:forward=40 40
+ switch maxspeed:forward=60 60
+ switch maxspeed:forward=70 70
+ switch maxspeed:forward=80 80
+ switch maxspeed:forward=90 90
+ switch maxspeed:forward=100 100
+ switch maxspeed:forward=110 110
+ switch maxspeed:forward=120 120
+ switch maxspeed:forward=130 130
+ switch maxspeed:forward=urban 50
+ switch maxspeed:forward=rural 100
+ 0
+
+assign maxspeed_backward
+ switch maxspeed:backward=50 50
+ switch maxspeed:backward=30 30
+ switch maxspeed:backward=10 10
+ switch maxspeed:backward=20 20
+ switch maxspeed:backward=40 40
+ switch maxspeed:backward=60 60
+ switch maxspeed:backward=70 70
+ switch maxspeed:backward=80 80
+ switch maxspeed:backward=90 90
+ switch maxspeed:backward=100 100
+ switch maxspeed:backward=110 110
+ switch maxspeed:backward=120 120
+ switch maxspeed:backward=130 130
+ switch maxspeed:backward=urban 50
+ switch maxspeed:backward=rural 100
+ 0
+
+assign maxspeed
+ switch and reversedirection=yes maxspeed_backward maxspeed_backward
+ switch and not reversedirection=yes maxspeed_forward maxspeed_forward
+ switch maxspeed=50 50
+ switch maxspeed=30 30
+ switch maxspeed=10 10
+ switch maxspeed=20 20
+ switch maxspeed=40 40
+ switch maxspeed=60 60
+ switch maxspeed=70 70
+ switch maxspeed=80 80
+ switch maxspeed=90 90
+ switch maxspeed=100 100
+ switch maxspeed=110 110
+ switch maxspeed=120 120
+ switch maxspeed=130 130
+ switch maxspeed=urban 50
+ switch maxspeed=rural 100
+ 999
+
+
+assign downspeedpenalty
+ switch equal maxspeed 10 4 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle
+ switch equal maxspeed 20 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle
+ switch equal maxspeed 30 0.7 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
+ switch equal maxspeed 40 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
+ switch equal maxspeed 50 0.2 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
+ 0
+
+assign flatspeedpenalty
+ switch equal maxspeed 10 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
+ switch equal maxspeed 20 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
+ switch equal maxspeed 30 0.15 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
+ switch equal maxspeed 40 0.12 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h in der Ebene
+ switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
+ 0
+
+assign upspeedpenalty
+ switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
+ switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
+ switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
+ 0
+
+
+assign surfacepenalty
+ add switch embedded_rails=tram|yes|rail 10 # Zusatzkosten bei Schienen in der Fahrbahn
+ 0
+ multiply avoidbw
+ switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
+ switch concrete=plates 1 # Zusatzkosten für Betonplattenwege
+ switch concrete=lanes 2 # Zusatzkosten für Betonspurplatten
+ switch surface=concrete|paving_stones|wood|metal 0.4 #Zusatzkosten für Beton, Pflastersteine, Holz oder Metall
+ switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 4 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine
+ switch surface=gravel|sand|pebblestone 10 #Zusatzkosten für Schotter, Sand oder Kies
+ switch surface=ground|grass|unpaved|dirt|earth|mud|clay 50 #Zusatzkosten für naturbelassene Wege, Grasswege, unbefestigte Wege, Schmutzwege, erdige Wege, schlammige Wege oder Lehmwege
+ 0
+
+assign smoothnesspenalty
+ multiply avoidbw
+ switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen
+ switch smoothness=intermediate|medium 0.7 #Zusatzkosten für mittelmäßige Oberflächen
+ switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
+ switch smoothness=robust_wheels|bad 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
+ switch smoothness=high_clearance|off_road_wheels|very_bad|horrible|very_horrible|impassable 100 #Zusatzkosten für Oberflächen die eine erhöhte Bodenfreiheit oder Geländebereifung benötigen, schrecklich, sehr schrecklich oder unpasierbar sind
+ 0
+
+
+assign costfactor
+
+# dieser Abschnitt ist für die Kosten in der Ebene
+
+ switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
+ switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
+
+ min 9999
+ max 1
+
+ add onewaypenalty
+ add accesspenalty
+ add max surfacepenalty smoothnesspenalty
+ add flatspeedpenalty
+
+ max 1
+ switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
+ switch route=ferry 10.67 # Kosten für Fähren
+ switch highway=trunk|trunk_link add 1 multiply avoidmr2 4 # Kosten für eine autobahnänliche Straße
+ switch highway=primary|primary_link add 0.7 multiply avoidmr2 1.3 # Kosten für Bundesstraßen
+ switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
+ switch highway=tertiary|tertiary_link add 0.7 multiply avoidsr 0.3 # Kosten für Kreisstraßen
+ switch highway=unclassified add 0.7 multiply avoidsr 0.3 # Kosten für Verbindungsstraßen
+ switch highway=residential|service add 0.7 multiply avoidsr 0.5 # Kosten für Wohn- und Zufahrtsstraßen
+ switch highway=track
+ switch tracktype=grade1 add 0.7 multiply avoidsr 0.5 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
+ switch tracktype=grade2 multiply avoidbw add 1 multiply avoidsr 6 # Kosten für geschotterte Feldwege
+ switch tracktype=grade3 multiply avoidbw 40 # Kosten für Feldwege mit weichem Untergrund
+ switch tracktype=grade4 multiply avoidbw 50 # Kosten für unbefestigte Feldwege
+ switch tracktype=grade5 multiply avoidbw 50 # Kosten für kaum erkennbare Feldwege
+ switch surface= multiply avoidbw 20 # Kosten für Feldwege ohne Oberflächenangabe
+ add 0.7 multiply avoidsr 0.5 # Kosten für Feldwege mit Oberflächenangabe
+ switch cycleway add 0.58 multiply avoid_cycleways 0.24 # Kosten für Fahrradwege
+ switch highway=living_street add 2 multiply avoidsr 2 # Kosten für Spielstraßen
+ switch highway=road add 3 multiply avoidsr 4 # Kosten für noch nicht genauer beschriebene Straße
+ switch footway 20 # Kosten für Fußwege
+ switch highway=steps 30 # Kosten für Stufen
+ switch highway=path
+ switch surface= multiply avoidbw 40 # Kosten für Pfade ohne Oberflächenangabe
+ multiply avoidsr add 0.58 multiply avoid_cycleways 0.24 # Kosten für Pfade mit Oberflächenangabe
+ switch highway=bridleway multiply avoidbw 80 # Kosten für Reitwege
+ 20 # Kosten für sonstige Wege
+
+assign uphillcostfactor
+
+# dieser Abschnitt ist für die Kosten bei Anstiegen
+# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
+
+ switch and highway= not route=ferry 10000
+ switch or highway=proposed highway=abandoned 10000
+
+ min 9999
+ max 1
+
+ add onewaypenalty
+ add accesspenalty
+ add max surfacepenalty smoothnesspenalty
+ add upspeedpenalty
+ max 1
+ switch highway=motorway|motorway_link 10000
+ switch route=ferry 10.67
+ switch highway=trunk|trunk_link add 1 multiply avoidmr2 6
+ switch highway=primary|primary_link add 0.7 multiply avoidmr2 2.3
+ switch highway=secondary|secondary_link add 0.7 multiply avoidmr2 0.5
+ switch highway=tertiary|tertiary_link 1
+ switch highway=unclassified 1
+ switch highway=residential|service add 0.7 multiply avoidsr 0.3
+ switch highway=track
+ switch tracktype=grade1 add 0.7 multiply avoidsr 0.3
+ switch tracktype=grade2 multiply avoidbw add 1 multiply avoidsr 2
+ switch tracktype=grade3 multiply avoidbw 40
+ switch tracktype=grade4 multiply avoidbw 50
+ switch tracktype=grade5 multiply avoidbw 50
+ switch surface= multiply avoidbw 20
+ add 0.7 multiply avoidsr 0.3
+ switch cycleway add 0.28 multiply avoid_cycleways 0.24
+ switch highway=living_street add 1 multiply avoidsr 1.5
+ switch highway=road add 4 multiply avoidsr 6
+ switch footway 30
+ switch highway=steps 40
+ switch highway=path
+ switch surface= multiply avoidbw 40
+ multiply avoidsr add 0.28 multiply avoid_cycleways 0.24
+ switch highway=bridleway multiply avoidbw 80
+ 20
+
+assign downhillcostfactor
+
+# dieser Abschnitt ist für die Kosten bei Gefälle
+# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
+
+ switch and highway= not route=ferry 10000
+ switch or highway=proposed highway=abandoned 10000
+
+ min 9999
+ max 1
+
+ add downspeedpenalty
+ add onewaypenalty
+ add accesspenalty
+ add max smoothnesspenalty surfacepenalty
+ max 1
+ switch highway=motorway|motorway_link 10000
+ switch route=ferry 10.67
+ switch highway=trunk|trunk_link add 1 multiply avoidmr2 2
+ switch highway=primary|primary_link add 0.7 multiply avoidmr2 1.3
+ switch highway=secondary|secondary_link 1
+ switch highway=tertiary|tertiary_link add 0.5 multiply avoidsr 0.5
+ switch highway=unclassified add 0.6 multiply avoidsr 0.6
+ switch highway=residential|service add 1 multiply avoidsr 1
+ switch highway=track
+ switch tracktype=grade1 add 1 multiply avoidsr 1
+ switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 4
+ switch tracktype=grade3 multiply avoidbw 40
+ switch tracktype=grade4 multiply avoidbw 50
+ switch tracktype=grade5 multiply avoidbw 50
+ switch surface= multiply avoidbw 20
+ add 1 multiply avoidsr 1
+ switch cycleway add 0.5 multiply avoid_cycleways 0.5
+ switch highway=living_street add 2 multiply avoidsr 6
+ switch highway=road add 4 multiply avoidsr 6
+ switch footway 30
+ switch highway=steps 40
+ switch highway=path
+ switch surface= multiply avoidbw 40
+ multiply avoidsr add 0.5 multiply avoid_cycleways 0.5
+ switch highway=bridleway multiply avoidbw 80
+ 20
+
+
+# hier kommen Variablen die zur Generierung der Abbiegehinweise benötigt werden
+
+assign priorityclassifier =
+
+ if ( highway=motorway ) then 30
+ else if ( highway=motorway_link ) then 29
+ else if ( highway=trunk ) then 28
+ else if ( highway=trunk_link ) then 27
+ else if ( highway=primary ) then 26
+ else if ( highway=primary_link ) then 25
+ else if ( highway=secondary ) then 24
+ else if ( highway=secondary_link ) then 23
+ else if ( highway=tertiary ) then 22
+ else if ( highway=tertiary_link ) then 21
+ else if ( highway=unclassified ) then 20
+ else if ( highway=residential|living_street ) then 6
+ else if ( highway=service ) then 6
+ else if ( highway=cycleway ) then 6
+ else if ( bicycle=designated ) then 6
+ else if ( highway=track ) then if tracktype=grade1 then 6 else 4
+ else if ( highway=bridleway|road|path|footway ) then 4
+ else if ( highway=steps ) then 2
+ else if ( highway=pedestrian ) then 2
+ else 0
+
+
+
+assign isbadoneway = not equal onewaypenalty 0
+assign isgoodoneway = if reversedirection=yes then oneway=-1
+ else if oneway= then junction=roundabout else oneway=yes|true|1
+assign isroundabout = junction=roundabout
+assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
+assign isgoodforcars = if greater priorityclassifier 6 then true
+ else if highway=residential|living_street|service then true
+ else if ( and highway=track tracktype=grade1 ) then true
+ else false
+
+assign classifiermask add isbadoneway
+ add multiply isgoodoneway 2
+ add multiply isroundabout 4
+ add multiply islinktype 8
+ multiply isgoodforcars 16
+
+
+
+---context:node # following code refers to node tags
+
+# Parameter für Knotenpunkte
+# Kosten an Knotenpunkten in Meter
+
+
+assign defaultaccess
+ switch access=
+ 1 # add default barrier restrictions here!
+ switch or access=private access=no
+ 0
+ 1
+
+assign bikeaccess
+ or nodeaccessgranted=yes
+ switch bicycle=
+ switch vehicle=
+ defaultaccess
+ switch or vehicle=private vehicle=no
+ 0
+ 1
+ switch or bicycle=private and not or highway=crossing ignore_bicycle_no or bicycle=no bicycle=dismount
+ 0
+ 1
+
+assign footaccess
+ or bicycle=dismount
+ switch foot=
+ defaultaccess
+ switch or foot=private foot=no
+ 0
+ 1
+
+assign initialcost
+ add switch highway=traffic_signals 200 # Kosten für Ampel
+ switch highway=stop 150 # Kosten für Stoppschild
+ switch railway=crossing|level_crossing 200 # Kosten für Bahnübergang
+ switch highway=steps switch no_steps 1000000 dismount_cost #Kosten für Stufe
+ 0
+ switch bikeaccess
+ 0
+ switch footaccess
+ dismount_cost # Kosten fürs Aussteigen
+ 1000000 #Kosten für verbotene oder private Wege
\ No newline at end of file
diff --git a/misc/profiles2/vm-forum-velomobil-schnell.brf b/misc/profiles2/vm-forum-velomobil-schnell.brf
index eddb815..953a3ad 100644
--- a/misc/profiles2/vm-forum-velomobil-schnell.brf
+++ b/misc/profiles2/vm-forum-velomobil-schnell.brf
@@ -1,441 +1,460 @@
-#
-# Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de
-
----context:global
-
-assign totalMass = 110 #Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg
-assign maxSpeed = 60 #Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
-assign S_C_x = 0.05 #Effektive Stirnfläche in m²
-assign C_r = 0.005 #Rollwiderstand
-assign bikerPower = 125 #Dauerleistung in Watt
-
-assign ignore_bicycle_no = false # für Regionen mit falschen bicyle=no tags können sie mit "true" ignoriert werden. Auch Shuttletransporte (bicycle=dismount + foot=no) werden geroutet
-assign consider_smoothness_tags = true # mit false kann die kanne die Auswertung der smoothness tags abgeschaltet werden
-assign low_memory_cutoff = false # mit true werden Wege mit hohen Kosten aus der Berechnung genommen und damit wird die Berechnung schneller und benötigt weniger Arbeitspeicher.
-
-assign turnInstructionMode 1 #Ausgabe von Abiegehinweise 0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style
-assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert
-assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
-
-assign downhillcost 80 # Kosten für die Höhenmeter bergab
-assign downhillcutoff 0.1 # Gefälle unter diesem Wert in Prozent werden nicht gewertet
-assign uphillcost 80 # Kosten für die Höhenmeter bergauf
-assign uphillcutoff 1 # Steigungen unter diesem Wert in Prozent werden nicht gewertet
-
-assign validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
-assign considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
-
-assign pass1coefficient 3 # Berechnugskoeffizient für erste schnelle Berechnung
-assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
-# sinnvolle Werte für den ersten Koeffizienten:
-# 1 exakte Berechnung beim ersten Durchlauf
-# umso größer die Werte umso schneller und ungenauer die erste Berechnung
-# sinnvolle Werte für den zweiten Koeffizienten:
-# 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
-# -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
-
-# Um die ungenauen SRTM Höhendaten zu filtern werden für jeweils für Anstiege und Gefälle Puffer verwendet. Erst wenn diese überschritten werden die Segmente als Anstiege oder Gefälle gewertet.
-
-assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
-assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
-assign elevationbufferreduce 1 # im Bereich zwischen elevationpenaltybuffer und elevationmaxbuffer wird eine Höhenstrafe, die einer Steigung oder Gefälle dieses Wertes (in Prozent) entspricht, verhängt und diese Höhenmeter vom Puffer abgezogen.
-
-assign lmc switch low_memory_cutoff 10000 0
----context:way
-
-# Parameter für die Wege
-#zusätzliche Kosten in Meter für jeden Streckenabschnitt
-
-assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
-assign nodeaccessgranted or any_cycleroute lcn=yes
-
-assign cycleway
- or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
-
-assign footway
- or highway=footway and highway=path foot=designated|yes
-
-assign turncost
- switch junction=roundabout 0
- 150 # Kosten die für eine 90 Grad Abbiegung berechnet werden. Für kleinere Winkel werden sie mit turncost*cos(Winkel) berechnet, bei Kreisverkehr keine weitere Kosten
-
-assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
- switch route=ferry 2
- switch highway=steps 3
- switch cycleway 4
- switch footway 5
- 1
-
-assign initialcost
- switch route=ferry 15000 # Kosten wenn eine Fähre verwendet wird
- switch highway=steps 1000 # Kosten für Stufen
- switch cycleway 800 # Kosten für Radwege
- switch footway 1000 # Kosten für Fußwege
- 0
-
-# Kosten ab hier als Meter für jeden tatsächlichen Meter
-
-assign oneway
- switch oneway=
- junction=roundabout
- or oneway=yes or oneway=true oneway=1
-
-assign onewaypenalty
- switch switch reversedirection=yes oneway oneway=-1
- switch or cycleway=opposite or cycleway=opposite_lane or cycleway=opposite_track oneway:bicycle=no 0 #zusätzliche Kosten für in Gegenrichtung für Radfahrer freigegebene Einbahnstraßen in Gegenrichtung
- switch or highway=primary highway=primary_link add lmc 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
- switch or highway=secondary highway=secondary_link add lmc 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
- switch or highway=tertiary highway=tertiary_link add lmc 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
- 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
- 0.0
-
-assign defaultaccess
- switch access=
- not motorroad=yes
- switch or access=private access=no
- 0
- 1
-
-assign bikeaccess
- or any_cycleroute
- switch bicycle=
- switch bicycle_road=yes
- 1
- switch vehicle=
- defaultaccess
- switch or vehicle=private vehicle=no
- 0
- 1
- not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
-
-
-assign footaccess
- or bikeaccess
- or and bicycle=dismount ignore_bicycle_no
- switch foot=
- defaultaccess
- not or foot=private foot=no
-
-assign accesspenalty
- switch bikeaccess
- 0
- switch footaccess
- 15 #Zusatzkosten fürs Schieben
- 10000 #Zusatzkosten für gesperrte oder private Wege
-
-assign maxspeed_forward
- switch maxspeed:forward=50 50
- switch maxspeed:forward=30 30
- switch maxspeed:forward=10 10
- switch maxspeed:forward=20 20
- switch maxspeed:forward=40 40
- switch maxspeed:forward=60 60
- switch maxspeed:forward=70 70
- switch maxspeed:forward=80 80
- switch maxspeed:forward=90 90
- switch maxspeed:forward=100 100
- switch maxspeed:forward=110 110
- switch maxspeed:forward=120 120
- switch maxspeed:forward=130 130
- switch maxspeed:forward=urban 50
- switch maxspeed:forward=rural 100
- 0
-
-assign maxspeed_backward
- switch maxspeed:backward=50 50
- switch maxspeed:backward=30 30
- switch maxspeed:backward=10 10
- switch maxspeed:backward=20 20
- switch maxspeed:backward=40 40
- switch maxspeed:backward=60 60
- switch maxspeed:backward=70 70
- switch maxspeed:backward=80 80
- switch maxspeed:backward=90 90
- switch maxspeed:backward=100 100
- switch maxspeed:backward=110 110
- switch maxspeed:backward=120 120
- switch maxspeed:backward=130 130
- switch maxspeed:backward=urban 50
- switch maxspeed:backward=rural 100
- 0
-
-assign maxspeed
- switch and reversedirection=yes maxspeed_backward maxspeed_backward
- switch and not reversedirection=yes maxspeed_forward maxspeed_forward
- switch maxspeed=50 50
- switch maxspeed=30 30
- switch maxspeed=10 10
- switch maxspeed=20 20
- switch maxspeed=40 40
- switch maxspeed=60 60
- switch maxspeed=70 70
- switch maxspeed=80 80
- switch maxspeed=90 90
- switch maxspeed=100 100
- switch maxspeed=110 110
- switch maxspeed=120 120
- switch maxspeed=130 130
- switch maxspeed=urban 50
- switch maxspeed=rural 100
- 999
-
-
-assign downspeedpenalty
- switch equal maxspeed 10 5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle
- switch equal maxspeed 20 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle
- switch equal maxspeed 30 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
- switch equal maxspeed 40 0.8 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
- switch equal maxspeed 50 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
- 0
-
-assign flatspeedpenalty
- switch equal maxspeed 10 3 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
- switch equal maxspeed 20 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
- switch equal maxspeed 30 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
- switch equal maxspeed 40 0.3 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h in der Ebene
- switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
- 0
-
-assign upspeedpenalty
- switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
- switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
- switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
- 0
-
-
-assign surfacepenalty
- add switch embedded_rails=tram|yes|rail 20 # Zusatzkosten bei Schienen in der Fahrbahn
- 0
- switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
- switch concrete=plates 1 # Zusatzkosten für Betonplattenwege
- switch concrete=lanes 5 # Zusatzkosten für Betonspurplatten
- switch surface=concrete|paving_stones|wood|metal 0.5 #Zusatzkosten für Beton, Pflastersteine, Holz oder Metall
- switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 5 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine
- switch surface=gravel|sand|pebblestone add lmc 10 #Zusatzkosten für Schotter, Sand oder Kies
- switch surface=ground|grass|unpaved|dirt|earth|mud|clay add lmc 50 #Zusatzkosten für naturbelassene Wege, Grasswege, unbefestigte Wege, Schmutzwege, erdige Wege, schlammige Wege oder Lehmwege
- 0
-
-assign smoothnesspenalty
- switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen
- switch smoothness=intermediate|medium 0.2 #Zusatzkosten für mittelmäßige Oberflächen
- switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
- switch smoothness=robust_wheels|bad add lmc 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
- switch smoothness=high_clearance|off_road_wheels|very_bad|horrible|very_horrible|impassable add lmc 100 #Zusatzkosten für Oberflächen die eine erhöhte Bodenfreiheit oder Geländebereifung benötigen, schrecklich, sehr schrecklich oder unpasierbar sind
- 0
-
-
-assign costfactor
-
-# dieser Abschnitt ist für die Kosten in der Ebene
-
- switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
- switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
-
- min 9999
-
- add onewaypenalty
- add accesspenalty
- add surfacepenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add flatspeedpenalty
-
- switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
- switch route=ferry 10.67 # Kosten für Fähren
- switch highway=trunk|trunk_link 2.5 # Kosten für eine autobahnänliche Straße
- switch highway=primary|primary_link 1.2 # Kosten für Bundesstraßen
- switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
- switch highway=tertiary|tertiary_link 1.1 # Kosten für Kreisstraßen
- switch highway=unclassified 1.2 # Kosten für Verbindungsstraßen
- switch highway=residential|service 1.7 # Kosten für Wohn- und Zufahrtsstraßen
- switch highway=track
- switch tracktype=grade1 2.5 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
- switch tracktype=grade2 10 # Kosten für geschotterte Feldwege
- switch tracktype=grade3 add lmc 40 # Kosten für Feldwege mit weichem Untergrund
- switch tracktype=grade4 add lmc 50 # Kosten für unbefestigte Feldwege
- switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege
- add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
- switch cycleway 2.5 # Kosten für Fahrradwege
- switch ( or highway=living_street living_street=yes ) 5 # Kosten für Spielstraßen
- switch highway=road 10 # Kosten für noch nicht genauer beschriebene Straße
- switch footway 30 # Kosten für Fußwege
- switch highway=pedestrian 30 # Kosten für Gehwege
- switch highway=steps 40 # Kosten für Stufen
- switch highway=path
- switch surface= add lmc 40 # Kosten für Pfade ohne Oberflächenangabe
- 10 # Kosten für Pfade mit Oberflächenangabe
- switch highway=bridleway add lmc 80 # Kosten für Reitwege
- add lmc 20 # Kosten für sonstige Wege
-
-assign uphillcostfactor
-
-# dieser Abschnitt ist für die Kosten bei Anstiegen
-# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
-
- switch and highway= not route=ferry 10000
- switch or highway=proposed highway=abandoned 10000
-
- min 9999
-
- add upspeedpenalty
- add onewaypenalty
- add accesspenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add surfacepenalty
-
- switch highway=motorway|motorway_link 10000
- switch route=ferry 10.67
- switch highway=trunk|trunk_link 6.5
- switch highway=primary|primary_link 3
- switch highway=secondary|secondary_link 1.2
- switch highway=tertiary|tertiary_link 1
- switch highway=unclassified 1
- switch highway=residential|service 1.5
- switch highway=track
- switch tracktype=grade1 2
- switch tracktype=grade2 10
- switch tracktype=grade3 add lmc 40
- switch tracktype=grade4 add lmc 50
- switch tracktype=grade5 add lmc 50
- add lmc 20
- switch cycleway 2
- switch ( or highway=living_street living_street=yes ) 5
- switch highway=road 10
- switch footway 30
- switch highway=pedestrian 30
- switch highway=steps 40
- switch highway=path
- switch surface= add lmc 40
- 10
- switch highway=bridleway add lmc 80
- add lmc 20
-
-assign downhillcostfactor
-
-# dieser Abschnitt ist für die Kosten bei Gefälle
-# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
-
- switch and highway= not route=ferry 10000
- switch or highway=proposed highway=abandoned 10000
-
- min 9999
-
- add downspeedpenalty
- add onewaypenalty
- add accesspenalty
- add switch consider_smoothness_tags smoothnesspenalty 0
- add surfacepenalty
-
- switch highway=motorway|motorway_link 10000
- switch route=ferry 10.67
- switch highway=trunk|trunk_link 1.5
- switch highway=primary|primary_link 1
- switch highway=secondary|secondary_link 1
- switch highway=tertiary|tertiary_link 1.5
- switch highway=unclassified 1.7
- switch highway=residential|service 2.5
- switch highway=track
- switch tracktype=grade1 4
- switch tracktype=grade2 10
- switch tracktype=grade3 add lmc 40
- switch tracktype=grade4 add lmc 50
- switch tracktype=grade5 add lmc 50
- add lmc 20
- switch cycleway 5
- switch ( or highway=living_street living_street=yes ) 8
- switch highway=road 10
- switch footway 30
- switch highway=pedestrian 30
- switch highway=steps 40
- switch highway=path
- switch surface= add lmc 40
- 10
- switch highway=bridleway add lmc 80
- add lmc 20
-
-
-# hier kommen Variablen die zur Generierung der Abiegehinweise benötigt werden
-
-assign priorityclassifier =
-
- if ( highway=motorway ) then 30
- else if ( highway=motorway_link ) then 29
- else if ( highway=trunk ) then 28
- else if ( highway=trunk_link ) then 27
- else if ( highway=primary ) then 26
- else if ( highway=primary_link ) then 25
- else if ( highway=secondary ) then 24
- else if ( highway=secondary_link ) then 23
- else if ( highway=tertiary ) then 22
- else if ( highway=tertiary_link ) then 21
- else if ( highway=unclassified ) then 20
- else if ( or highway=residential|living_street living_street=yes ) then 6
- else if ( highway=service ) then 6
- else if ( highway=cycleway ) then 6
- else if ( or bicycle=designated bicycle_road=yes ) then 6
- else if ( highway=track ) then if tracktype=grade1 then 6 else 4
- else if ( highway=bridleway|road|path|footway ) then 4
- else if ( highway=steps ) then 2
- else if ( highway=pedestrian ) then 2
- else 0
-
-
-
-assign isbadoneway = not equal onewaypenalty 0
-assign isgoodoneway = if reversedirection=yes then oneway=-1
- else if oneway= then junction=roundabout else oneway=yes|true|1
-assign isroundabout = junction=roundabout
-assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
-assign isgoodforcars = if greater priorityclassifier 6 then true
- else if ( or highway=residential|living_street|service living_street=yes ) then true
- else if ( and highway=track tracktype=grade1 ) then true
- else false
-
-assign classifiermask add isbadoneway
- add multiply isgoodoneway 2
- add multiply isroundabout 4
- add multiply islinktype 8
- multiply isgoodforcars 16
-
----context:node # following code refers to node tags
-
-# Parameter für Knotenpunkte
-# Kosten an Knotenpunkten in Meter
-
-
-assign defaultaccess
- switch access=
- 1 # add default barrier restrictions here!
- switch or access=private access=no
- 0
- 1
-
-assign bikeaccess
- or nodeaccessgranted=yes
- switch bicycle=
- switch vehicle=
- defaultaccess
- switch or vehicle=private vehicle=no
- 0
- 1
- switch or bicycle=private or and not or highway=crossing ignore_bicycle_no bicycle=no bicycle=dismount
- 0
- 1
-
-assign footaccess
- or bicycle=dismount
- switch foot=
- defaultaccess
- switch or foot=private foot=no
- 0
- 1
-
-assign initialcost
- add switch highway=traffic_signals 250 # Kosten für Ampel
- switch highway=stop 250 # Kosten für Stoppschild
- switch railway=crossing|level_crossing 350 # Kosten für Bahnübergang
- 0
- switch bikeaccess
- 0
- switch footaccess
- 10000 # Kosten fürs Absteigen
- 1000000 #Kosten für verbotene oder private Wege
+#
+# Profile for fast velomobiles, contributed by http://www.velomobilforum.de
+
+---context:global
+
+assign no_steps = true # %no_steps% | keine Stufen, das Velomobil soll nicht getragen werden müssen | boolean
+assign no_wrong_oneway = false # %no_wrong oneway% | keine Einbahnstrasse in falsche Richtung, auch nicht schiebend | boolean
+
+assign dismount_cost = 1000 # %dismount_cost% | Umweg in Meter der in Kauf genommen wird bevor eine Strecke genommen wird bei der man austeigen muss, ab 1 000 000 wird keine Schiebestrecke mehr genommen | number
+assign avoid_main_roads = 3 # %avoid_main_roads% | große Straße vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 3 = Standard, 10 = stark vermeiden | number
+assign avoid_small_roads = 5 # %avoid_small_roads% | kleine Straße vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
+assign avoid_cycleways = 8 # %avoid_cycleways% | Radwege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 8 = Standard, 10 = stark vermeiden | number
+assign avoid_elevation = 5 # %avoid_elevation% | Hohenmeter vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
+assign avoid_bad_ways = 8 # %avoid_bad_ways% | Schlechte Wege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 8 = Standard, 10 = stark vermeiden | number
+
+assign totalMass = 110 # %totalMass% | Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg, für Fahrtzeitschätzung | number
+assign maxSpeed = 60 # Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
+assign S_C_x = 0.05 # Effektive Stirnfläche in m²
+assign C_r = 0.005 # Rollwiderstand
+assign bikerPower = 125 # %bikerPower% | Dauerleistung in Watt, für Fahrtzeitschätzung| number
+
+
+assign ignore_bicycle_no = false # %ignore_bicycle_no% | für Regionen mit falschen bicyle=no tags können sie mit "true" ignoriert werden. Auch Shuttletransporte (bicycle=dismount + foot=no) werden geroutet | boolean
+
+
+assign turnInstructionMode = 1 # %turnInstructionMode% | Modus für die Abbiegehinweise | [0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style, 4=comment-Style, 5=gpsies-Style, 6=orux-Style]
+assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert
+assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
+
+assign avoidmr2 multiply 0.11111111 multiply avoid_main_roads avoid_main_roads
+assign avoidsr multiply 0.2 avoid_small_roads
+assign avoidbw multiply 0.125 avoid_bad_ways
+assign avoid_ele multiply avoid_elevation 0.2
+
+assign downhillcost multiply avoid_ele 80 # Kosten für die Höhenmeter bergab
+assign downhillcutoff 0.1 # Gefälle unter diesem Wert in Prozent werden nicht gewertet
+assign uphillcost multiply avoid_ele 80 # Kosten für die Höhenmeter bergauf
+assign uphillcutoff 1 # Steigungen unter diesem Wert in Prozent werden nicht gewertet
+
+assign validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
+assign considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
+
+assign pass1coefficient 3 # Berechnugskoeffizient für erste schnelle Berechnung
+assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
+# sinnvolle Werte für den ersten Koeffizienten:
+# 1 exakte Berechnung beim ersten Durchlauf
+# umso größer die Werte umso schneller und ungenauer die erste Berechnung
+# sinnvolle Werte für den zweiten Koeffizienten:
+# 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
+# -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
+
+# Um die ungenauen SRTM Höhendaten zu filtern werden für jeweils für Anstiege und Gefälle Puffer verwendet. Erst wenn diese überschritten werden die Segmente als Anstiege oder Gefälle gewertet.
+
+assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
+assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
+assign elevationbufferreduce 1 # im Bereich zwischen elevationpenaltybuffer und elevationmaxbuffer wird eine Höhenstrafe, die einer Steigung oder Gefälle dieses Wertes (in Prozent) entspricht, verhängt und diese Höhenmeter vom Puffer abgezogen.
+
+---context:way
+
+# Parameter für die Wege
+#zusätzliche Kosten in Meter für jeden Streckenabschnitt
+
+assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
+assign nodeaccessgranted or any_cycleroute lcn=yes
+
+assign cycleway
+ or highway=cycleway and highway=path|footway|pedestrian bicycle=designated|yes
+
+assign footway
+ or highway=footway|pedestrian and highway=path foot=designated|yes
+
+assign turncost
+ switch junction=roundabout 0
+ 150 # Kosten die für eine 90 Grad Abbiegung berechnet werden. Für kleinere Winkel werden sie mit turncost*cos(Winkel) berechnet, bei Kreisverkehr keine weitere Kosten
+
+assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
+ switch route=ferry 2
+ switch highway=steps 3
+ switch cycleway 4
+ switch footway 5
+ 1
+
+assign initialcost
+ switch route=ferry 15000 # Kosten wenn eine Fähre verwendet wird
+ switch highway=steps switch no_steps 1000000 dismount_cost # Kosten für Stufen
+ switch cycleway multiply 12.5 multiply avoid_cycleways avoid_cycleways # Kosten für Radwege
+ switch footway dismount_cost # Kosten für Fußwege
+ 0
+
+# Kosten ab hier als Meter für jeden tatsächlichen Meter
+
+assign oneway
+ switch oneway=
+ junction=roundabout
+ or oneway=yes or oneway=true oneway=1
+
+assign onewaypenalty
+ switch switch reversedirection=yes oneway oneway=-1
+ switch or cycleway=opposite or cycleway=opposite_lane or cycleway=opposite_track oneway:bicycle=no 0 #zusätzliche Kosten für in Gegenrichtung für Radfahrer freigegebene Einbahnstraßen in Gegenrichtung
+ switch no_wrong_oneway 10000
+ switch or highway=primary highway=primary_link 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
+ switch or highway=secondary highway=secondary_link 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
+ switch or highway=tertiary highway=tertiary_link 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
+ 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
+ 0.0
+
+assign defaultaccess
+ switch access=
+ not motorroad=yes
+ switch or access=private access=no
+ 0
+ 1
+
+assign bikeaccess
+ or any_cycleroute
+ switch bicycle=
+ switch vehicle=
+ defaultaccess
+ switch or vehicle=private vehicle=no
+ 0
+ 1
+ not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
+
+
+assign footaccess
+ or bikeaccess
+ or and bicycle=dismount ignore_bicycle_no
+ switch foot=
+ defaultaccess
+ not or foot=private foot=no
+
+assign accesspenalty
+ switch bikeaccess
+ 0
+ switch footaccess
+ 15 #Zusatzkosten fürs Schieben
+ 10000 #Zusatzkosten für gesperrte oder private Wege
+
+assign maxspeed_forward
+ switch maxspeed:forward=50 50
+ switch maxspeed:forward=30 30
+ switch maxspeed:forward=10 10
+ switch maxspeed:forward=20 20
+ switch maxspeed:forward=40 40
+ switch maxspeed:forward=60 60
+ switch maxspeed:forward=70 70
+ switch maxspeed:forward=80 80
+ switch maxspeed:forward=90 90
+ switch maxspeed:forward=100 100
+ switch maxspeed:forward=110 110
+ switch maxspeed:forward=120 120
+ switch maxspeed:forward=130 130
+ switch maxspeed:forward=urban 50
+ switch maxspeed:forward=rural 100
+ 0
+
+assign maxspeed_backward
+ switch maxspeed:backward=50 50
+ switch maxspeed:backward=30 30
+ switch maxspeed:backward=10 10
+ switch maxspeed:backward=20 20
+ switch maxspeed:backward=40 40
+ switch maxspeed:backward=60 60
+ switch maxspeed:backward=70 70
+ switch maxspeed:backward=80 80
+ switch maxspeed:backward=90 90
+ switch maxspeed:backward=100 100
+ switch maxspeed:backward=110 110
+ switch maxspeed:backward=120 120
+ switch maxspeed:backward=130 130
+ switch maxspeed:backward=urban 50
+ switch maxspeed:backward=rural 100
+ 0
+
+assign maxspeed
+ switch and reversedirection=yes maxspeed_backward maxspeed_backward
+ switch and not reversedirection=yes maxspeed_forward maxspeed_forward
+ switch maxspeed=50 50
+ switch maxspeed=30 30
+ switch maxspeed=10 10
+ switch maxspeed=20 20
+ switch maxspeed=40 40
+ switch maxspeed=60 60
+ switch maxspeed=70 70
+ switch maxspeed=80 80
+ switch maxspeed=90 90
+ switch maxspeed=100 100
+ switch maxspeed=110 110
+ switch maxspeed=120 120
+ switch maxspeed=130 130
+ switch maxspeed=urban 50
+ switch maxspeed=rural 100
+ 999
+
+
+assign downspeedpenalty
+ switch equal maxspeed 10 5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle
+ switch equal maxspeed 20 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle
+ switch equal maxspeed 30 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
+ switch equal maxspeed 40 0.8 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
+ switch equal maxspeed 50 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
+ 0
+
+assign flatspeedpenalty
+ switch equal maxspeed 10 3 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
+ switch equal maxspeed 20 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
+ switch equal maxspeed 30 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
+ switch equal maxspeed 40 0.3 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h in der Ebene
+ switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
+ 0
+
+assign upspeedpenalty
+ switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
+ switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
+ switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
+ 0
+
+
+assign surfacepenalty
+ add switch embedded_rails=tram|yes|rail 20 # Zusatzkosten bei Schienen in der Fahrbahn
+ 0
+ multiply avoidbw
+ switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
+ switch concrete=plates 1 # Zusatzkosten für Betonplattenwege
+ switch concrete=lanes 5 # Zusatzkosten für Betonspurplatten
+ switch surface=concrete|paving_stones|wood|metal 0.5 #Zusatzkosten für Beton, Pflastersteine, Holz oder Metall
+ switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 5 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine
+ switch surface=gravel|sand|pebblestone 10 #Zusatzkosten für Schotter, Sand oder Kies
+ switch surface=ground|grass|unpaved|dirt|earth|mud|clay 50 #Zusatzkosten für naturbelassene Wege, Grasswege, unbefestigte Wege, Schmutzwege, erdige Wege, schlammige Wege oder Lehmwege
+ 0
+
+assign smoothnesspenalty
+ multiply avoidbw
+ switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen
+ switch smoothness=intermediate|medium 1 #Zusatzkosten für mittelmäßige Oberflächen
+ switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
+ switch smoothness=robust_wheels|bad 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
+ switch smoothness=high_clearance|off_road_wheels|very_bad|horrible|very_horrible|impassable 100 #Zusatzkosten für Oberflächen die eine erhöhte Bodenfreiheit oder Geländebereifung benötigen, schrecklich, sehr schrecklich oder unpasierbar sind
+ 0
+
+
+assign costfactor
+
+# dieser Abschnitt ist für die Kosten in der Ebene
+
+ switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
+ switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
+
+ min 9999
+ max 1
+
+ add onewaypenalty
+ add accesspenalty
+ add max surfacepenalty smoothnesspenalty
+ add flatspeedpenalty
+
+ max 1
+ switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
+ switch route=ferry 10.67 # Kosten für Fähren
+ switch highway=trunk|trunk_link add 1 multiply avoidmr2 1.5 # Kosten für eine autobahnänliche Straße
+ switch highway=primary|primary_link add 0.5 multiply avoidmr2 0.7 # Kosten für Bundesstraßen
+ switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
+ switch highway=tertiary|tertiary_link add 0.5 multiply avoidsr 0.6 # Kosten für Kreisstraßen
+ switch highway=unclassified add 0.5 multiply avoidsr 0.7 # Kosten für Verbindungsstraßen
+ switch highway=residential|service add 0.7 multiply avoidsr 1 # Kosten für Wohn- und Zufahrtsstraßen
+ switch highway=track
+ switch tracktype=grade1 add 1 multiply avoidsr 1.5 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
+ switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 6 # Kosten für geschotterte Feldwege
+ switch tracktype=grade3 multiply avoidbw 40 # Kosten für Feldwege mit weichem Untergrund
+ switch tracktype=grade4 multiply avoidbw 50 # Kosten für unbefestigte Feldwege
+ switch tracktype=grade5 multiply avoidbw 50 # Kosten für kaum erkennbare Feldwege
+ switch surface= multiply avoidbw 20 # Kosten für Feldwege ohne Oberflächenangabe
+ add 1 multiply avoidsr 1.5 # Kosten für Feldwege mit Oberflächenangabe
+ switch cycleway add 0.58 multiply avoid_cycleways 0.24 # Kosten für Fahrradwege
+ switch highway=living_street add 2 multiply avoidsr 3 # Kosten für Spielstraßen
+ switch highway=road add 4 multiply avoidsr 6 # Kosten für noch nicht genauer beschriebene Straße
+ switch footway 30 # Kosten für Fußwege
+ switch highway=steps 40 # Kosten für Stufen
+ switch highway=path
+ switch surface= multiply avoidbw 40 # Kosten für Pfade ohne Oberflächenangabe
+ add 4 multiply avoidsr 6 # Kosten für Pfade mit Oberflächenangabe
+ switch highway=bridleway multiply avoidbw 80 # Kosten für Reitwege
+ 20 # Kosten für sonstige Wege
+
+assign uphillcostfactor
+
+# dieser Abschnitt ist für die Kosten bei Anstiegen
+# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
+
+ switch and highway= not route=ferry 10000
+ switch or highway=proposed highway=abandoned 10000
+
+ min 9999
+ max 1
+
+ add onewaypenalty
+ add accesspenalty
+ add max surfacepenalty smoothnesspenalty
+ add upspeedpenalty
+ max 1
+ switch highway=motorway|motorway_link 10000
+ switch route=ferry 10.67
+ switch highway=trunk|trunk_link add 1 multiply avoidmr2 5.5
+ switch highway=primary|primary_link add 0.5 multiply avoidmr2 2.5
+ switch highway=secondary|secondary_link add 0.5 multiply avoidmr2 0.7
+ switch highway=tertiary|tertiary_link 1
+ switch highway=unclassified 1
+ switch highway=residential|service add 0.6 multiply avoidsr 0.9
+ switch highway=track
+ switch tracktype=grade1 add 0.8 multiply avoidsr 1.2
+ switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 6
+ switch tracktype=grade3 multiply avoidbw 40
+ switch tracktype=grade4 multiply avoidbw 50
+ switch tracktype=grade5 multiply avoidbw 50
+ switch surface= multiply avoidbw 20
+ add 1 multiply avoidsr 1.5
+ switch cycleway add 0.24 multiply avoid_cycleways 0.22
+ switch highway=living_street add 2 multiply avoidsr 3
+ switch highway=road add 4 multiply avoidsr 6
+ switch footway 30
+ switch highway=steps 40
+ switch highway=path
+ switch surface= multiply avoidbw 40
+ add 4 multiply avoidsr 6
+ switch highway=bridleway multiply avoidbw 80
+ 20
+
+assign downhillcostfactor
+
+# dieser Abschnitt ist für die Kosten bei Gefälle
+# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
+
+ switch and highway= not route=ferry 10000
+ switch or highway=proposed highway=abandoned 10000
+
+ min 9999
+ max 1
+
+ add downspeedpenalty
+ add onewaypenalty
+ add accesspenalty
+ add max smoothnesspenalty surfacepenalty
+ max 1
+ switch highway=motorway|motorway_link 10000
+ switch route=ferry 10.67
+ switch highway=trunk|trunk_link add 0.5 multiply avoidmr2 1
+ switch highway=primary|primary_link add 0.5 multiply avoidmr2 0.5
+ switch highway=secondary|secondary_link 1
+ switch highway=tertiary|tertiary_link add 0.6 multiply avoidsr 0.9
+ switch highway=unclassified add 0.6 multiply avoidsr 1.1
+ switch highway=residential|service add 1 multiply avoidsr 1.5
+ switch highway=track
+ switch tracktype=grade1 add 1.8 multiply avoidsr 1.2
+ switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 6
+ switch tracktype=grade3 multiply avoidbw 40
+ switch tracktype=grade4 multiply avoidbw 50
+ switch tracktype=grade5 multiply avoidbw 50
+ switch surface= multiply avoidbw 20
+ add 1.8 multiply avoidsr 1.2
+ switch cycleway add 0.2 multiply avoid_cycleways 0.6
+ switch highway=living_street add 2 multiply avoidsr 6
+ switch highway=road add 4 multiply avoidsr 6
+ switch footway 30
+ switch highway=steps 40
+ switch highway=path
+ switch surface= multiply avoidbw 40
+ add 4 multiply avoidsr 6
+ switch highway=bridleway multiply avoidbw 80
+ 20
+
+
+# hier kommen Variablen die zur Generierung der Abbiegehinweise benötigt werden
+
+assign priorityclassifier =
+
+ if ( highway=motorway ) then 30
+ else if ( highway=motorway_link ) then 29
+ else if ( highway=trunk ) then 28
+ else if ( highway=trunk_link ) then 27
+ else if ( highway=primary ) then 26
+ else if ( highway=primary_link ) then 25
+ else if ( highway=secondary ) then 24
+ else if ( highway=secondary_link ) then 23
+ else if ( highway=tertiary ) then 22
+ else if ( highway=tertiary_link ) then 21
+ else if ( highway=unclassified ) then 20
+ else if ( highway=residential|living_street ) then 6
+ else if ( highway=service ) then 6
+ else if ( highway=cycleway ) then 6
+ else if ( bicycle=designated ) then 6
+ else if ( highway=track ) then if tracktype=grade1 then 6 else 4
+ else if ( highway=bridleway|road|path|footway ) then 4
+ else if ( highway=steps ) then 2
+ else if ( highway=pedestrian ) then 2
+ else 0
+
+
+
+assign isbadoneway = not equal onewaypenalty 0
+assign isgoodoneway = if reversedirection=yes then oneway=-1
+ else if oneway= then junction=roundabout else oneway=yes|true|1
+assign isroundabout = junction=roundabout
+assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
+assign isgoodforcars = if greater priorityclassifier 6 then true
+ else if highway=residential|living_street|service then true
+ else if ( and highway=track tracktype=grade1 ) then true
+ else false
+
+assign classifiermask add isbadoneway
+ add multiply isgoodoneway 2
+ add multiply isroundabout 4
+ add multiply islinktype 8
+ multiply isgoodforcars 16
+
+
+
+---context:node # following code refers to node tags
+
+# Parameter für Knotenpunkte
+# Kosten an Knotenpunkten in Meter
+
+
+assign defaultaccess
+ switch access=
+ 1 # add default barrier restrictions here!
+ switch or access=private access=no
+ 0
+ 1
+
+assign bikeaccess
+ or nodeaccessgranted=yes
+ switch bicycle=
+ switch vehicle=
+ defaultaccess
+ switch or vehicle=private vehicle=no
+ 0
+ 1
+ switch or bicycle=private and not or highway=crossing ignore_bicycle_no or bicycle=no bicycle=dismount
+ 0
+ 1
+
+assign footaccess
+ or bicycle=dismount
+ switch foot=
+ defaultaccess
+ switch or foot=private foot=no
+ 0
+ 1
+
+assign initialcost
+ add switch highway=traffic_signals 250 # Kosten für Ampel
+ switch highway=stop 250 # Kosten für Stoppschild
+ switch railway=crossing|level_crossing 350 # Kosten für Bahnübergang
+ switch highway=steps switch no_steps 1000000 dismount_cost #Kosten für Stufe
+ 0
+ switch bikeaccess
+ 0
+ switch footaccess
+ dismount_cost # Kosten fürs Aussteigen
+ 1000000 #Kosten für verbotene oder private Wege
\ No newline at end of file
From 7e4bcebd3c5ec6ed9dd7a6fc4d51986d5fb554e5 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sat, 27 Jun 2020 12:37:15 +0200
Subject: [PATCH 10/33] fixed problem for same-segment searches with exact node
matches
---
.../src/main/java/btools/router/RoutingEngine.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java
index 4dcc23a..bc50346 100644
--- a/brouter-core/src/main/java/btools/router/RoutingEngine.java
+++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java
@@ -590,11 +590,18 @@ public class RoutingEngine extends Thread
OsmPath p = getStartPath( n1, n2, new OsmNodeNamed( mwp.waypoint ), endPos );
// special case: start+end on same segment
- if ( sameSegmentSearch )
+ if ( p.cost >= 0 && sameSegmentSearch )
{
+ OsmPath path2end = getStartPath( n1, n2, endPos, endPos );
+ boolean isDirect = path2end.cost >= p.cost;
+
OsmPath pe = getEndPath( n1, p.getLink(), endPos );
OsmPath pt = getEndPath( n1, p.getLink(), null );
int costdelta = pt.cost - p.cost;
+ if ( isDirect && pe.cost < costdelta )
+ {
+ costdelta = pe.cost;
+ }
if ( pe.cost >= costdelta )
{
pe.cost -= costdelta;
From 080057fb522b4f03fd9acf37bb55a9ad2e97ef2f Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:23:41 +0200
Subject: [PATCH 11/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/car-vario.brf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/profiles2/car-vario.brf b/misc/profiles2/car-vario.brf
index 5994c59..ce88b8c 100644
--- a/misc/profiles2/car-vario.brf
+++ b/misc/profiles2/car-vario.brf
@@ -27,7 +27,7 @@ assign f_recup = 400 # %f_recup% | Newton | number
assign p_standby = 250 # %p_standby% | Watt | number
# Turn instructions settings
-assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-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]
# Technical parameters
assign pass1coefficient = 1.3
From 43635284e7503fa9d2efaed3e3117ec2bf7cbf2d Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:25:09 +0200
Subject: [PATCH 12/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/fastbike.brf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/profiles2/fastbike.brf b/misc/profiles2/fastbike.brf
index 2767c2e..d39bc9d 100644
--- a/misc/profiles2/fastbike.brf
+++ b/misc/profiles2/fastbike.brf
@@ -47,7 +47,7 @@ assign C_r = 0.01 # %C_r% | Rolling resistance coefficient (dimensionle
assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
# Turn instructions settings
-assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-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]
assign turnInstructionCatchingRange = 40 # %turnInstructionCatchingRange% | Within this distance (in m) several turning instructions are combined into one and the turning angles are better approximated to the general direction | number
assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
From e18447e48fef02b3fb2eb431e33bb96bb37c6d4b Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:29:18 +0200
Subject: [PATCH 13/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/fastbike-verylowtraffic.brf | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/misc/profiles2/fastbike-verylowtraffic.brf b/misc/profiles2/fastbike-verylowtraffic.brf
index b13979c..5a8b7b8 100644
--- a/misc/profiles2/fastbike-verylowtraffic.brf
+++ b/misc/profiles2/fastbike-verylowtraffic.brf
@@ -16,7 +16,7 @@
---context:global # following code refers to global config
# to generate turn instructions, adapt the mode by need
-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, 4=comment-style, 5=gpsies-style, 6=orux-style
# Use the following switches to change behaviour
# (1=yes, 0=no):
@@ -136,15 +136,15 @@ assign onewaypenalty =
assign surfacepenalty
switch highway=unclassified|service|track|road|path|footway|cycleway
switch surface=asphalt 0
- switch surface=paved switch smoothness=good|excellent 0 0.1 # befestigte(harte)Oberfläsche
+ switch surface=paved switch smoothness=good|excellent 0 0.1 # befestigte(harte)Oberfläche
switch concrete=plates 1 # Betonplattenwege
switch surface=concrete|paving_stones|wood|metal 0.7 # Beton, Pflastersteine, Holz, Metall
switch surface=cobblestone 2 # Kopfsteinpflaster
switch concrete=lanes 3 # Betonspurplatten
- switch surface=fine_gravel|compacted 4 # Splitt,verdichtete Oberfläsche
+ switch surface=fine_gravel|compacted 4 # Splitt,verdichtete Oberfläche
switch surface=sett|grass_paver 5 # behauene Pflastersteine, Rasengittersteine
switch surface=gravel|sand|pebblestone|unpaved 10 # Schotter, Sand, Kies, unbefestigt
- switch surface=ground|grass|dirt|earth|mud|clay 25 # naturbelassene Oberfläsche, Gras, Schutz Schlamm...
+ switch surface=ground|grass|dirt|earth|mud|clay 25 # naturbelassene Oberfläche, Gras, Schutz Schlamm...
# if "surface" is not defined, for service and road asphalt is probable
switch surface=
switch highway=service|road 0.1
@@ -371,4 +371,4 @@ assign initialcost
0
switch footaccess
300
- 1000000
\ No newline at end of file
+ 1000000
From 3229657bc4861b10c95065cc2df49e3974417f5c Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:30:29 +0200
Subject: [PATCH 14/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/moped.brf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/profiles2/moped.brf b/misc/profiles2/moped.brf
index b290370..82a7ed5 100644
--- a/misc/profiles2/moped.brf
+++ b/misc/profiles2/moped.brf
@@ -16,7 +16,7 @@ assign uphillcutoff 0
assign validForBikes 1
assign validForCars 1
-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, 4=comment-style, 5=gpsies-style, 6=orux-style
---context:way # following code refers to way-tags
From 5ea7a6695bd450cf45f750a813d479041b24620d Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:31:49 +0200
Subject: [PATCH 15/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/shortest.brf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/profiles2/shortest.brf b/misc/profiles2/shortest.brf
index c55f3db..a4cc7f3 100644
--- a/misc/profiles2/shortest.brf
+++ b/misc/profiles2/shortest.brf
@@ -7,7 +7,7 @@ assign downhillcutoff 1.5
assign uphillcost 0
assign uphillcutoff 1.5
-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, 4=comment-style, 5=gpsies-style, 6=orux-style
assign validForFoot 1
---context:way # following code refers to way-tags
From d47e5af1fa855136627f5915654883c00d793c4b Mon Sep 17 00:00:00 2001
From: vodie <45155869+vodie@users.noreply.github.com>
Date: Sat, 27 Jun 2020 23:32:52 +0200
Subject: [PATCH 16/33] turninstructionmodes in profiles
add description for turninstructionmodes in profiles
---
misc/profiles2/trekking.brf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/profiles2/trekking.brf b/misc/profiles2/trekking.brf
index 7d9a1a9..fe12f54 100644
--- a/misc/profiles2/trekking.brf
+++ b/misc/profiles2/trekking.brf
@@ -35,7 +35,7 @@ assign C_r = 0.01 # %C_r% | Rolling resistance coefficient (dimensionle
assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
# Turn instructions settings
-assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-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]
assign turnInstructionCatchingRange = 40 # %turnInstructionCatchingRange% | Within this distance (in m) several turning instructions are combined into one and the turning angles are better approximated to the general direction | number
assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
From cdd3a80b9efd44c74b1db10758ad184e8c7eb170 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sun, 28 Jun 2020 13:52:45 +0200
Subject: [PATCH 17/33] rework same-segment search logic
---
.../src/main/java/btools/router/OsmPath.java | 10 ++
.../java/btools/router/RoutingContext.java | 20 ++++
.../java/btools/router/RoutingEngine.java | 92 +++++--------------
3 files changed, 51 insertions(+), 71 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/OsmPath.java b/brouter-core/src/main/java/btools/router/OsmPath.java
index 86149b7..c76089b 100644
--- a/brouter-core/src/main/java/btools/router/OsmPath.java
+++ b/brouter-core/src/main/java/btools/router/OsmPath.java
@@ -298,6 +298,16 @@ abstract class OsmPath implements OsmLinkHolder
originElement = null; // prevent duplicate point
}
}
+
+ if ( rc.checkPendingEndpoint() )
+ {
+ dist = rc.calcDistance( rc.ilonshortest, rc.ilatshortest, lon2, lat2 );
+ if ( rc.shortestmatch )
+ {
+ stopAtEndpoint = true;
+ ele2 = interpolateEle( ele1, ele2, rc.wayfraction );
+ }
+ }
}
}
diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java
index 78dccd3..3e207fd 100644
--- a/brouter-core/src/main/java/btools/router/RoutingContext.java
+++ b/brouter-core/src/main/java/btools/router/RoutingContext.java
@@ -192,6 +192,7 @@ public final class RoutingContext
public List nogopoints = null;
private List keepnogopoints = null;
+ private OsmNodeNamed pendingEndpoint = null;
public Integer startDirection;
public boolean startDirectionValid;
@@ -297,17 +298,36 @@ public final class RoutingContext
}
public void setWaypoint( OsmNodeNamed wp, boolean endpoint )
+ {
+ setWaypoint( wp, null, endpoint );
+ }
+
+ public void setWaypoint( OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint )
{
keepnogopoints = nogopoints;
nogopoints = new ArrayList();
nogopoints.add( wp );
if ( keepnogopoints != null ) nogopoints.addAll( keepnogopoints );
isEndpoint = endpoint;
+ this.pendingEndpoint = pendingEndpoint;
+ }
+
+ public boolean checkPendingEndpoint()
+ {
+ if ( pendingEndpoint != null )
+ {
+ isEndpoint = true;
+ nogopoints.set( 0, pendingEndpoint );
+ pendingEndpoint = null;
+ return true;
+ }
+ return false;
}
public void unsetWaypoint()
{
nogopoints = keepnogopoints;
+ pendingEndpoint = null;
isEndpoint = false;
}
diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java
index bc50346..9fcea0b 100644
--- a/brouter-core/src/main/java/btools/router/RoutingEngine.java
+++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java
@@ -587,62 +587,27 @@ public class RoutingEngine extends Thread
private OsmPath getStartPath( OsmNode n1, OsmNode n2, MatchedWaypoint mwp, OsmNodeNamed endPos, boolean sameSegmentSearch )
{
- OsmPath p = getStartPath( n1, n2, new OsmNodeNamed( mwp.waypoint ), endPos );
+ if ( endPos != null )
+ {
+ endPos.radius = 1.5;
+ }
+ OsmPath p = getStartPath( n1, n2, new OsmNodeNamed( mwp.crosspoint ), endPos, sameSegmentSearch );
// special case: start+end on same segment
- if ( p.cost >= 0 && sameSegmentSearch )
+ if ( p.cost >= 0 && sameSegmentSearch && endPos != null && endPos.radius < 1.5 )
{
- OsmPath path2end = getStartPath( n1, n2, endPos, endPos );
- boolean isDirect = path2end.cost >= p.cost;
-
- OsmPath pe = getEndPath( n1, p.getLink(), endPos );
- OsmPath pt = getEndPath( n1, p.getLink(), null );
- int costdelta = pt.cost - p.cost;
- if ( isDirect && pe.cost < costdelta )
- {
- costdelta = pe.cost;
- }
- if ( pe.cost >= costdelta )
- {
- pe.cost -= costdelta;
-
- if ( guideTrack != null )
- {
- // nasty stuff: combine the path cause "new OsmPath()" cannot handle start+endpoint
- OsmPathElement startElement = p.originElement;
- while( startElement.origin != null )
- {
- startElement = startElement.origin;
- }
- if ( pe.originElement.cost > costdelta )
- {
- OsmPathElement e = pe.originElement;
- while( e.origin != null && e.origin.cost > costdelta )
- {
- e = e.origin;
- e.cost -= costdelta;
- }
- e.origin = startElement;
- }
- else
- {
- pe.originElement = startElement;
- }
- }
- pe.treedepth = 0; // hack: mark for the final-check
- return pe;
- }
+ p.treedepth = 0; // hack: mark for the final-check
}
return p;
}
- private OsmPath getStartPath( OsmNode n1, OsmNode n2, OsmNodeNamed wp, OsmNodeNamed endPos )
+ private OsmPath getStartPath( OsmNode n1, OsmNode n2, OsmNodeNamed wp, OsmNodeNamed endPos, boolean sameSegmentSearch )
{
try
{
- routingContext.setWaypoint( wp, false );
+ routingContext.setWaypoint( wp, sameSegmentSearch ? endPos : null, false );
OsmPath bestPath = null;
OsmLink bestLink = null;
OsmLink startLink = new OsmLink( null, n1 );
@@ -657,7 +622,7 @@ public class RoutingEngine extends Thread
if ( nextNode == n1 ) continue; // ?
if ( nextNode != n2 ) continue; // just that link
- wp.radius = 1e9;
+ wp.radius = 1.5;
OsmPath testPath = routingContext.createPath( startPath, link, null, guideTrack != null );
testPath.airdistance = endPos == null ? 0 : nextNode.calcDistance( endPos );
if ( wp.radius < minradius )
@@ -681,25 +646,6 @@ public class RoutingEngine extends Thread
}
}
- private OsmPath getEndPath( OsmNode n1, OsmLink link, OsmNodeNamed wp )
- {
- try
- {
- if ( wp != null ) routingContext.setWaypoint( wp, true );
- OsmLink startLink = new OsmLink( null, n1 );
- OsmPath startPath = routingContext.createPath( startLink );
- startLink.addLinkHolder( startPath, null );
-
- if ( wp != null ) wp.radius = 1.5;
-
- return routingContext.createPath( startPath, link, null, guideTrack != null );
- }
- finally
- {
- if ( wp != null ) routingContext.unsetWaypoint();
- }
- }
-
private OsmTrack findTrack( String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc )
{
try
@@ -985,13 +931,16 @@ public class RoutingEngine extends Thread
((OsmPath)linkHolder).airdistance = -1; // invalidate the entry in the open set;
}
- boolean isBidir = currentLink.isBidirectional();
- sourceNode.unlinkLink ( currentLink );
-
- // if the counterlink is alive and does not yet have a path, remove it
- if ( isBidir && currentLink.getFirstLinkHolder( currentNode ) == null && !routingContext.considerTurnRestrictions )
+ if ( path.treedepth > 1 )
{
- currentNode.unlinkLink(currentLink);
+ boolean isBidir = currentLink.isBidirectional();
+ sourceNode.unlinkLink( currentLink );
+
+ // if the counterlink is alive and does not yet have a path, remove it
+ if ( isBidir && currentLink.getFirstLinkHolder( currentNode ) == null && !routingContext.considerTurnRestrictions )
+ {
+ currentNode.unlinkLink( currentLink );
+ }
}
// recheck cutoff before doing expensive stuff
@@ -1123,7 +1072,8 @@ public class RoutingEngine extends Thread
OsmLinkHolder dominator = link.getFirstLinkHolder( currentNode );
while( !trafficSim && dominator != null )
{
- if ( bestPath.definitlyWorseThan( (OsmPath)dominator, routingContext ) )
+ OsmPath dp = (OsmPath)dominator;
+ if ( dp.airdistance != -1 && bestPath.definitlyWorseThan( dp, routingContext ) )
{
break;
}
From 98b7b7312c62fa424df9e219bd8562c97e9836d3 Mon Sep 17 00:00:00 2001
From: afischerdev
Date: Mon, 29 Jun 2020 10:02:27 +0200
Subject: [PATCH 18/33] add json export
---
.../src/main/java/btools/router/OsmTrack.java | 9 ++++
.../java/btools/routingapp/BRouterWorker.java | 45 ++++++++++++++++---
2 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java
index c732a03..60c4bb2 100644
--- a/brouter-core/src/main/java/btools/router/OsmTrack.java
+++ b/brouter-core/src/main/java/btools/router/OsmTrack.java
@@ -708,6 +708,15 @@ public final class OsmTrack
public List iternity;
+ public void writeJson( String filename ) throws Exception
+ {
+ BufferedWriter bw = new BufferedWriter( new FileWriter( filename ) );
+
+ bw.write( formatAsGeoJson() );
+ bw.close();
+ }
+
+
public String formatAsGeoJson()
{
StringBuilder sb = new StringBuilder( 8192 );
diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
index 1dc7eb4..600b099 100644
--- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
+++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
@@ -5,7 +5,9 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.StringTokenizer;
import android.os.Bundle;
import btools.router.OsmNodeNamed;
@@ -16,6 +18,10 @@ import btools.router.RoutingEngine;
public class BRouterWorker
{
+ private static final int OUTPUT_FORMAT_GPX = 0;
+ private static final int OUTPUT_FORMAT_KML = 1;
+ private static final int OUTPUT_FORMAT_JSON = 2;
+
public String baseDir;
public String segmentDir;
public String profileName;
@@ -65,6 +71,22 @@ public class BRouterWorker
{
rc.startDirection = Integer.valueOf( params.getInt( "direction" ) );
}
+ if (params.containsKey( "extraParams" )) { // add user params
+ String extraParams = params.getString("extraParams");
+ if (rc.keyValues == null) rc.keyValues = new HashMap();
+ StringTokenizer tk = new StringTokenizer( extraParams, "?&" );
+ while( tk.hasMoreTokens() ) {
+ String t = tk.nextToken();
+ StringTokenizer tk2 = new StringTokenizer( t, "=" );
+ if ( tk2.hasMoreTokens() ) {
+ String key = tk2.nextToken();
+ if ( tk2.hasMoreTokens() ) {
+ String value = tk2.nextToken();
+ rc.keyValues.put( key, value );
+ }
+ }
+ }
+ }
readNogos( params ); // add interface provided nogos
RoutingContext.prepareNogoPoints( nogoList );
@@ -99,20 +121,33 @@ public class BRouterWorker
}
String format = params.getString("trackFormat");
- boolean writeKml = format != null && "kml".equals( format );
+ int writeFromat = OUTPUT_FORMAT_GPX;
+ if (format != null) {
+ if ("kml".equals(format)) writeFromat = OUTPUT_FORMAT_KML;
+ if ("json".equals(format)) writeFromat = OUTPUT_FORMAT_JSON;
+ }
OsmTrack track = cr.getFoundTrack();
if ( track != null )
{
if ( pathToFileResult == null )
{
- if ( writeKml ) return track.formatAsKml();
- return track.formatAsGpx();
+ switch ( writeFromat ) {
+ case OUTPUT_FORMAT_GPX: return track.formatAsGpx();
+ case OUTPUT_FORMAT_KML: return track.formatAsKml();
+ case OUTPUT_FORMAT_JSON: return track.formatAsGeoJson();
+ default: return track.formatAsGpx();
+ }
+
}
try
{
- if ( writeKml ) track.writeKml(pathToFileResult);
- else track.writeGpx(pathToFileResult);
+ switch ( writeFromat ) {
+ case OUTPUT_FORMAT_GPX: track.writeGpx(pathToFileResult); break;
+ case OUTPUT_FORMAT_KML: track.writeKml(pathToFileResult); break;
+ case OUTPUT_FORMAT_JSON: track.writeJson(pathToFileResult); break;
+ default: track.writeGpx(pathToFileResult); break;
+ }
}
catch( Exception e )
{
From 54eb4e7b1e43d98b1470a39ed66c790f937a3bf3 Mon Sep 17 00:00:00 2001
From: afischerdev
Date: Mon, 29 Jun 2020 10:06:11 +0200
Subject: [PATCH 19/33] add json export and extra params
---
.../java/btools/routingapp/BRouterWorker.java | 460 +++++++++---------
1 file changed, 230 insertions(+), 230 deletions(-)
diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
index 600b099..65e743f 100644
--- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
+++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java
@@ -1,230 +1,230 @@
-package btools.routingapp;
-
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import android.os.Bundle;
-import btools.router.OsmNodeNamed;
-import btools.router.OsmPathElement;
-import btools.router.OsmTrack;
-import btools.router.RoutingContext;
-import btools.router.RoutingEngine;
-
-public class BRouterWorker
-{
- private static final int OUTPUT_FORMAT_GPX = 0;
- private static final int OUTPUT_FORMAT_KML = 1;
- private static final int OUTPUT_FORMAT_JSON = 2;
-
- public String baseDir;
- public String segmentDir;
- public String profileName;
- public String profilePath;
- public String rawTrackPath;
- public List waypoints;
- public List nogoList;
-
- public String getTrackFromParams(Bundle params)
- {
- String pathToFileResult = params.getString("pathToFileResult");
-
- if (pathToFileResult != null)
- {
- File f = new File (pathToFileResult);
- File dir = f.getParentFile();
- if (!dir.exists() || !dir.canWrite()){
- return "file folder does not exists or can not be written!";
- }
- }
-
- long maxRunningTime = 60000;
- String sMaxRunningTime = params.getString( "maxRunningTime" );
- if ( sMaxRunningTime != null )
- {
- maxRunningTime = Integer.parseInt( sMaxRunningTime ) * 1000;
- }
-
- RoutingContext rc = new RoutingContext();
- rc.rawTrackPath = rawTrackPath;
- rc.localFunction = profilePath;
-
- String tiFormat = params.getString( "turnInstructionFormat" );
- if ( tiFormat != null )
- {
- if ( "osmand".equalsIgnoreCase( tiFormat ) )
- {
- rc.turnInstructionMode = 3;
- }
- else if ( "locus".equalsIgnoreCase( tiFormat ) )
- {
- rc.turnInstructionMode = 2;
- }
- }
-
- if ( params.containsKey( "direction" ) )
- {
- rc.startDirection = Integer.valueOf( params.getInt( "direction" ) );
- }
- if (params.containsKey( "extraParams" )) { // add user params
- String extraParams = params.getString("extraParams");
- if (rc.keyValues == null) rc.keyValues = new HashMap();
- StringTokenizer tk = new StringTokenizer( extraParams, "?&" );
- while( tk.hasMoreTokens() ) {
- String t = tk.nextToken();
- StringTokenizer tk2 = new StringTokenizer( t, "=" );
- if ( tk2.hasMoreTokens() ) {
- String key = tk2.nextToken();
- if ( tk2.hasMoreTokens() ) {
- String value = tk2.nextToken();
- rc.keyValues.put( key, value );
- }
- }
- }
- }
-
- readNogos( params ); // add interface provided nogos
- RoutingContext.prepareNogoPoints( nogoList );
- rc.nogopoints = nogoList;
-
- waypoints = readPositions(params);
-
- try
- {
- writeTimeoutData( rc );
- }
- catch( Exception e ) {}
-
- RoutingEngine cr = new RoutingEngine( null, null, segmentDir, waypoints, rc );
- cr.quite = true;
- cr.doRun( maxRunningTime );
-
- // store new reference track if any
- // (can exist for timed-out search)
- if ( cr.getFoundRawTrack() != null )
- {
- try
- {
- cr.getFoundRawTrack().writeBinary( rawTrackPath );
- }
- catch( Exception e ) {}
- }
-
- if ( cr.getErrorMessage() != null )
- {
- return cr.getErrorMessage();
- }
-
- String format = params.getString("trackFormat");
- int writeFromat = OUTPUT_FORMAT_GPX;
- if (format != null) {
- if ("kml".equals(format)) writeFromat = OUTPUT_FORMAT_KML;
- if ("json".equals(format)) writeFromat = OUTPUT_FORMAT_JSON;
- }
-
- OsmTrack track = cr.getFoundTrack();
- if ( track != null )
- {
- if ( pathToFileResult == null )
- {
- switch ( writeFromat ) {
- case OUTPUT_FORMAT_GPX: return track.formatAsGpx();
- case OUTPUT_FORMAT_KML: return track.formatAsKml();
- case OUTPUT_FORMAT_JSON: return track.formatAsGeoJson();
- default: return track.formatAsGpx();
- }
-
- }
- try
- {
- switch ( writeFromat ) {
- case OUTPUT_FORMAT_GPX: track.writeGpx(pathToFileResult); break;
- case OUTPUT_FORMAT_KML: track.writeKml(pathToFileResult); break;
- case OUTPUT_FORMAT_JSON: track.writeJson(pathToFileResult); break;
- default: track.writeGpx(pathToFileResult); break;
- }
- }
- catch( Exception e )
- {
- return "error writing file: " + e;
- }
- }
- return null;
- }
-
- private List readPositions( Bundle params )
- {
- List wplist = new ArrayList();
-
- double[] lats = params.getDoubleArray("lats");
- double[] lons = params.getDoubleArray("lons");
-
- if (lats == null || lats.length < 2 || lons == null || lons.length < 2)
- {
- throw new IllegalArgumentException( "we need two lat/lon points at least!" );
- }
-
- for( int i=0; i wps ) throws Exception
- {
- bw.write( wps.size() + "\n" );
- for( OsmNodeNamed wp : wps )
- {
- bw.write( wp.toString() );
- bw.write( "\n" );
- }
- }
-}
+package btools.routingapp;
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import android.os.Bundle;
+import btools.router.OsmNodeNamed;
+import btools.router.OsmPathElement;
+import btools.router.OsmTrack;
+import btools.router.RoutingContext;
+import btools.router.RoutingEngine;
+
+public class BRouterWorker
+{
+ private static final int OUTPUT_FORMAT_GPX = 0;
+ private static final int OUTPUT_FORMAT_KML = 1;
+ private static final int OUTPUT_FORMAT_JSON = 2;
+
+ public String baseDir;
+ public String segmentDir;
+ public String profileName;
+ public String profilePath;
+ public String rawTrackPath;
+ public List waypoints;
+ public List nogoList;
+
+ public String getTrackFromParams(Bundle params)
+ {
+ String pathToFileResult = params.getString("pathToFileResult");
+
+ if (pathToFileResult != null)
+ {
+ File f = new File (pathToFileResult);
+ File dir = f.getParentFile();
+ if (!dir.exists() || !dir.canWrite()){
+ return "file folder does not exists or can not be written!";
+ }
+ }
+
+ long maxRunningTime = 60000;
+ String sMaxRunningTime = params.getString( "maxRunningTime" );
+ if ( sMaxRunningTime != null )
+ {
+ maxRunningTime = Integer.parseInt( sMaxRunningTime ) * 1000;
+ }
+
+ RoutingContext rc = new RoutingContext();
+ rc.rawTrackPath = rawTrackPath;
+ rc.localFunction = profilePath;
+
+ String tiFormat = params.getString( "turnInstructionFormat" );
+ if ( tiFormat != null )
+ {
+ if ( "osmand".equalsIgnoreCase( tiFormat ) )
+ {
+ rc.turnInstructionMode = 3;
+ }
+ else if ( "locus".equalsIgnoreCase( tiFormat ) )
+ {
+ rc.turnInstructionMode = 2;
+ }
+ }
+
+ if ( params.containsKey( "direction" ) )
+ {
+ rc.startDirection = Integer.valueOf( params.getInt( "direction" ) );
+ }
+ if (params.containsKey( "extraParams" )) { // add user params
+ String extraParams = params.getString("extraParams");
+ if (rc.keyValues == null) rc.keyValues = new HashMap();
+ StringTokenizer tk = new StringTokenizer( extraParams, "?&" );
+ while( tk.hasMoreTokens() ) {
+ String t = tk.nextToken();
+ StringTokenizer tk2 = new StringTokenizer( t, "=" );
+ if ( tk2.hasMoreTokens() ) {
+ String key = tk2.nextToken();
+ if ( tk2.hasMoreTokens() ) {
+ String value = tk2.nextToken();
+ rc.keyValues.put( key, value );
+ }
+ }
+ }
+ }
+
+ readNogos( params ); // add interface provided nogos
+ RoutingContext.prepareNogoPoints( nogoList );
+ rc.nogopoints = nogoList;
+
+ waypoints = readPositions(params);
+
+ try
+ {
+ writeTimeoutData( rc );
+ }
+ catch( Exception e ) {}
+
+ RoutingEngine cr = new RoutingEngine( null, null, segmentDir, waypoints, rc );
+ cr.quite = true;
+ cr.doRun( maxRunningTime );
+
+ // store new reference track if any
+ // (can exist for timed-out search)
+ if ( cr.getFoundRawTrack() != null )
+ {
+ try
+ {
+ cr.getFoundRawTrack().writeBinary( rawTrackPath );
+ }
+ catch( Exception e ) {}
+ }
+
+ if ( cr.getErrorMessage() != null )
+ {
+ return cr.getErrorMessage();
+ }
+
+ String format = params.getString("trackFormat");
+ int writeFromat = OUTPUT_FORMAT_GPX;
+ if (format != null) {
+ if ("kml".equals(format)) writeFromat = OUTPUT_FORMAT_KML;
+ if ("json".equals(format)) writeFromat = OUTPUT_FORMAT_JSON;
+ }
+
+ OsmTrack track = cr.getFoundTrack();
+ if ( track != null )
+ {
+ if ( pathToFileResult == null )
+ {
+ switch ( writeFromat ) {
+ case OUTPUT_FORMAT_GPX: return track.formatAsGpx();
+ case OUTPUT_FORMAT_KML: return track.formatAsKml();
+ case OUTPUT_FORMAT_JSON: return track.formatAsGeoJson();
+ default: return track.formatAsGpx();
+ }
+
+ }
+ try
+ {
+ switch ( writeFromat ) {
+ case OUTPUT_FORMAT_GPX: track.writeGpx(pathToFileResult); break;
+ case OUTPUT_FORMAT_KML: track.writeKml(pathToFileResult); break;
+ case OUTPUT_FORMAT_JSON: track.writeJson(pathToFileResult); break;
+ default: track.writeGpx(pathToFileResult); break;
+ }
+ }
+ catch( Exception e )
+ {
+ return "error writing file: " + e;
+ }
+ }
+ return null;
+ }
+
+ private List readPositions( Bundle params )
+ {
+ List wplist = new ArrayList();
+
+ double[] lats = params.getDoubleArray("lats");
+ double[] lons = params.getDoubleArray("lons");
+
+ if (lats == null || lats.length < 2 || lons == null || lons.length < 2)
+ {
+ throw new IllegalArgumentException( "we need two lat/lon points at least!" );
+ }
+
+ for( int i=0; i wps ) throws Exception
+ {
+ bw.write( wps.size() + "\n" );
+ for( OsmNodeNamed wp : wps )
+ {
+ bw.write( wp.toString() );
+ bw.write( "\n" );
+ }
+ }
+}
From ca48edda04b51a682af56b61ee5d5101784d2244 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sat, 14 Nov 2020 09:39:10 +0100
Subject: [PATCH 20/33] new diff file format, fixing empty-microtile-bug
---
.../java/btools/mapaccess/Rd5DiffManager.java | 8 +-
.../java/btools/mapaccess/Rd5DiffTool.java | 190 ++++++++++++------
.../btools/mapaccess/Rd5DiffValidator.java | 70 +++++++
.../btools/routingapp/BInstallerView.java | 2 +-
4 files changed, 207 insertions(+), 63 deletions(-)
create mode 100644 brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffValidator.java
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffManager.java b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffManager.java
index faa860b..86ff392 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffManager.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffManager.java
@@ -1,5 +1,5 @@
/**
- * Proof of concept for delta rd5's
+ * Manage rd5 diff-file creation
*
* @author ab
*/
@@ -56,10 +56,10 @@ final public class Rd5DiffManager
File specificNewDiffs = new File( newDiffDir, basename );
specificNewDiffs.mkdirs();
- String diffFileName = md5 + ".rd5diff";
+ String diffFileName = md5 + ".df5";
File diffFile = new File( specificNewDiffs, diffFileName );
- String dummyDiffFileName = md5New + ".rd5diff";
+ String dummyDiffFileName = md5New + ".df5";
File dummyDiffFile = new File( specificNewDiffs, dummyDiffFileName );
dummyDiffFile.createNewFile();
@@ -73,7 +73,7 @@ final public class Rd5DiffManager
File[] oldDiffs = specificOldDiffs.listFiles();
for( File od : oldDiffs )
{
- if ( !od.getName().endsWith( ".rd5diff" ) )
+ if ( !od.getName().endsWith( ".df5" ) )
{
continue;
}
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
index 1f796f7..426e40a 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
@@ -1,5 +1,5 @@
/**
- * Proof of concept for delta rd5's
+ * Calculate, add or merge rd5 delta files
*
* @author ab
*/
@@ -31,9 +31,9 @@ final public class Rd5DiffTool implements ProgressListener
return;
}
- if ( args[1].endsWith( ".rd5diff" ) )
+ if ( args[1].endsWith( ".df5" ) )
{
- if ( args[0].endsWith( ".rd5diff" ) )
+ if ( args[0].endsWith( ".df5" ) )
{
addDeltas( new File( args[0] ),new File( args[1] ), new File( args[2] ) );
}
@@ -152,6 +152,7 @@ final public class Rd5DiffTool implements ProgressListener
DataInputStream dis1 = new DataInputStream( new BufferedInputStream( new FileInputStream( f1 ) ) );
DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) );
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
+ MCOutputStream mcOut = new MCOutputStream( dos, abBuf1 );
// copy header to outfile
long[] fileIndex1 = readFileIndex( dis1, null );
@@ -175,10 +176,6 @@ final public class Rd5DiffTool implements ProgressListener
byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false );
byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, false );
- if ( ab2 == null )
- {
- continue; // empty target tile
- }
MicroCache mc;
if ( Arrays.equals( ab1, ab2 ) )
{
@@ -191,17 +188,10 @@ final public class Rd5DiffTool implements ProgressListener
mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
mc.calcDelta( mc1, mc2 );
}
-
- if ( mc.getSize() == 0 )
- {
- dos.writeInt( 0 );
- }
- else
- {
- int len = mc.encodeMicroCache( abBuf1 );
- dos.writeInt( len );
- dos.write( abBuf1, 0, len );
+ int len = mcOut.writeMC( mc );
+ if ( len > 0 )
+ {
bytesDiff += len;
nodesDiff += mc.getSize();
diffedTiles++;
@@ -244,7 +234,9 @@ final public class Rd5DiffTool implements ProgressListener
*/
}
}
+ mcOut.finish();
}
+
// write any remaining data to the output file
for(;;)
{
@@ -324,10 +316,12 @@ final public class Rd5DiffTool implements ProgressListener
try
{
DataBuffers dataBuffers = new DataBuffers();
+ MCInputStream mcIn = new MCInputStream( dis2, dataBuffers );
+
for ( int subFileIdx = 0; subFileIdx < 25; subFileIdx++ )
{
- boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx );
- boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx );
+ boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx ); // has the basefile data
+ boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx ); // has the *result* data
// boolean hasDataCmp = getTileStart( fileIndexCmp, subFileIdx ) < getTileEnd( fileIndexCmp, subFileIdx );
@@ -352,11 +346,8 @@ final public class Rd5DiffTool implements ProgressListener
}
byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false );
- byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, true );
- if ( ab2 == null )
- {
- continue; // no target tile expected
- }
+ MicroCache mc2 = mcIn.readMC();
+ int targetSize = getPosIdx( posIdx2, tileIdx ) - getPosIdx( posIdx2, tileIdx-1 );
/* int targetSizeCmp = getPosIdx( posIdxCmp, tileIdx ) - getPosIdx( posIdxCmp, tileIdx-1 );
if ( targetSizeCmp != targetSize ) throw new IllegalArgumentException( "target size mismatch: "+ targetSize + "," + targetSizeCmp );
@@ -365,21 +356,35 @@ final public class Rd5DiffTool implements ProgressListener
*/
// no-delta shortcut: just copy base data
- if ( ab2.length == 0 )
+ if ( mc2.getSize() == 0 )
{
if ( ab1 != null )
{
dos.write( ab1 );
}
+ int newTargetSize = ab1 == null ? 0 : ab1.length;
+ if ( targetSize != newTargetSize )
+ {
+ throw new RuntimeException( "size mismatch at " + subFileIdx + "/" + tileIdx + " " + targetSize + "!=" + newTargetSize );
+ }
continue;
}
// this is the real delta case (using decode->delta->encode )
+
MicroCache mc1 = createMicroCache( ab1, dataBuffers );
- MicroCache mc2 = createMicroCache( ab2, dataBuffers );
MicroCache mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
mc.addDelta( mc1, mc2, false );
+
+ if ( mc.size() == 0 )
+ {
+ if ( targetSize != 0 )
+ {
+ throw new RuntimeException( "size mismatch at " + subFileIdx + "/" + tileIdx + " " + targetSize + ">0" );
+ }
+ continue;
+ }
int len = mc.encodeMicroCache( abBuf1 );
@@ -403,8 +408,13 @@ final public class Rd5DiffTool implements ProgressListener
*/
dos.write( abBuf1, 0, len );
dos.writeInt( Crc32.crc( abBuf1, 0, len ) ^ 2 );
+ if ( targetSize != len+4 )
+ {
+ throw new RuntimeException( "size mismatch at " + subFileIdx + "/" + tileIdx + " " + targetSize + "<>" + (len+4) );
+ }
}
+ mcIn.finish();
}
// write any remaining data to the output file
for(;;)
@@ -529,7 +539,7 @@ final public class Rd5DiffTool implements ProgressListener
DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) );
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
- // copy header to outfile
+ // copy subfile-header to outfile
long[] fileIndex1 = readFileIndex( dis1, null );
long[] fileIndex2 = readFileIndex( dis2, dos );
@@ -538,51 +548,37 @@ final public class Rd5DiffTool implements ProgressListener
try
{
DataBuffers dataBuffers = new DataBuffers();
+ MCInputStream mcIn1 = new MCInputStream( dis1, dataBuffers );
+ MCInputStream mcIn2 = new MCInputStream( dis2, dataBuffers );
+ MCOutputStream mcOut = new MCOutputStream( dos, abBuf1 );
+
for ( int subFileIdx = 0; subFileIdx < 25; subFileIdx++ )
{
+ // copy tile-header to outfile
boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx );
boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx );
-
int[] posIdx1 = hasData1 ? readPosIndex( dis1, null ) : null;
int[] posIdx2 = hasData2 ? readPosIndex( dis2, dos ) : null;
for ( int tileIdx = 0; tileIdx < 1024; tileIdx++ )
{
- byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, true );
- byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, true );
- if ( ab2 == null )
+ MicroCache mc1 = mcIn1.readMC();
+ MicroCache mc2 = mcIn2.readMC();
+ MicroCache mc;
+ if ( mc1.getSize() == 0 && mc2.getSize() == 0 )
{
- continue; // no target tile expected
+ mc = mc1;
}
-
- // no-delta shortcut: just copy base data
- if ( ab2.length == 0 )
+ else
{
- if ( ab1 == null )
- {
- dos.writeInt( 0 );
- }
- else
- {
- dos.writeInt( ab1.length );
- dos.write( ab1 );
- }
- continue;
+ mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
+ mc.addDelta( mc1, mc2, true );
}
-
- // this is the real delta case (using decode->add->encode )
- MicroCache mc1 = createMicroCache( ab1, dataBuffers );
- MicroCache mc2 = createMicroCache( ab2, dataBuffers );
-
- MicroCache mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
- mc.addDelta( mc1, mc2, true );
-
- int len = mc.encodeMicroCache( abBuf1 );
-
- dos.writeInt( len+4 );
- dos.write( abBuf1, 0, len );
- dos.writeInt( Crc32.crc( abBuf1, 0, len ) ^ 2 );
+ mcOut.writeMC( mc );
}
+ mcIn1.finish();
+ mcIn2.finish();
+ mcOut.finish();
}
// write any remaining data to the output file
for(;;)
@@ -706,5 +702,83 @@ final public class Rd5DiffTool implements ProgressListener
}
}
+ private static class MCOutputStream
+ {
+ private DataOutputStream dos;
+ private byte[] buffer;
+ private short skips = 0;
+
+ public MCOutputStream(DataOutputStream dos, byte[] buffer)
+ {
+ this.dos = dos;
+ this.buffer = buffer;
+ }
+
+ public int writeMC(MicroCache mc) throws Exception
+ {
+ if ( mc.getSize() == 0 )
+ {
+ skips++;
+ return 0;
+ }
+ dos.writeShort( skips );
+ skips = 0;
+ int len = mc.encodeMicroCache( buffer );
+ if ( len == 0 )
+ {
+ throw new IllegalArgumentException( "encoded buffer of non-empty micro-cache cannot be empty" );
+ }
+ dos.writeInt( len );
+ dos.write( buffer, 0, len );
+ return len;
+ }
+
+ public void finish() throws Exception
+ {
+ if ( skips > 0 )
+ {
+ dos.writeShort( skips );
+ skips = 0;
+ }
+ }
+ }
+
+ private static class MCInputStream
+ {
+ private short skips = -1;
+ private DataInputStream dis;
+ private DataBuffers dataBuffers;
+ private MicroCache empty = MicroCache.emptyCache();
+
+ public MCInputStream( DataInputStream dis, DataBuffers dataBuffers )
+ {
+ this.dis = dis;
+ this.dataBuffers = dataBuffers;
+ }
+
+ public MicroCache readMC() throws Exception
+ {
+ if (skips < 0 )
+ {
+ skips = dis.readShort();
+ }
+ MicroCache mc = empty;
+ if ( skips == 0 )
+ {
+ int size = dis.readInt();
+ byte[] ab = new byte[size];
+ dis.readFully( ab );
+ StatCoderContext bc = new StatCoderContext( ab );
+ mc = new MicroCache2( bc, dataBuffers, 0, 0, 32, null, null );
+ }
+ skips--;
+ return mc;
+ }
+
+ public void finish() throws Exception
+ {
+ skips = -1;
+ }
+ }
}
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffValidator.java b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffValidator.java
new file mode 100644
index 0000000..99bca62
--- /dev/null
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffValidator.java
@@ -0,0 +1,70 @@
+/**
+ * Manage rd5 diff-file creation
+ *
+ * @author ab
+ */
+package btools.mapaccess;
+
+import java.io.File;
+
+final public class Rd5DiffValidator
+{
+ public static void main( String[] args ) throws Exception
+ {
+ validateDiffs( new File( args[0] ),new File( args[1] ) );
+ }
+
+ /**
+ * Validate diffs for all DF5 files
+ */
+ public static void validateDiffs( File oldDir, File newDir ) throws Exception
+ {
+ File oldDiffDir = new File( oldDir, "diff" );
+ File newDiffDir = new File( newDir, "diff" );
+
+ File[] filesNew = newDir.listFiles();
+
+ for( File fn : filesNew )
+ {
+ String name = fn.getName();
+ if ( !name.endsWith( ".rd5" ) )
+ {
+ continue;
+ }
+ if ( fn.length() < 1024*1024 )
+ {
+ continue; // expecting no diff for small files
+ }
+ String basename = name.substring( 0, name.length() - 4 );
+ File fo = new File( oldDir, name );
+ if ( !fo.isFile() )
+ {
+ continue;
+ }
+
+ // calculate MD5 of old file
+ String md5 = Rd5DiffManager.getMD5( fo );
+
+ String md5New = Rd5DiffManager.getMD5( fn );
+
+ System.out.println( "name=" + name + " md5=" + md5 );
+
+ File specificNewDiffs = new File( newDiffDir, basename );
+
+ String diffFileName = md5 + ".df5";
+ File diffFile = new File( specificNewDiffs, diffFileName );
+
+ File fcmp = new File( oldDir, name + "_tmp" );
+
+ // merge old file and diff
+ Rd5DiffTool.recoverFromDelta( fo, diffFile, fcmp, new Rd5DiffTool() );
+ String md5Cmp = Rd5DiffManager.getMD5( fcmp );
+
+ if ( !md5Cmp.equals( md5New ) )
+ {
+ throw new RuntimeException( "**************** md5 mismatch!! *****************" );
+ }
+ }
+ }
+
+}
diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java
index 6c43fb7..b5e0422 100644
--- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java
+++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java
@@ -687,7 +687,7 @@ float tx, ty;
// first check for a delta file
String md5 = Rd5DiffManager.getMD5( targetFile );
- String surlDelta = surlBase + "diff/" + name.replace( ".rd5", "/" + md5 + ".rd5diff" );
+ String surlDelta = surlBase + "diff/" + name.replace( ".rd5", "/" + md5 + ".df5" );
URL urlDelta = new URL(surlDelta);
From 372a04a6cf4608cf14bc7045aed9499012a23f52 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sat, 14 Nov 2020 10:10:08 +0100
Subject: [PATCH 21/33] fixed nullpointer in Rd5DiffTool
---
.../src/main/java/btools/mapaccess/Rd5DiffTool.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
index 426e40a..ac2f1d9 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/Rd5DiffTool.java
@@ -347,7 +347,7 @@ final public class Rd5DiffTool implements ProgressListener
byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false );
MicroCache mc2 = mcIn.readMC();
- int targetSize = getPosIdx( posIdx2, tileIdx ) - getPosIdx( posIdx2, tileIdx-1 );
+ int targetSize = posIdx2 == null ? 0 : getPosIdx( posIdx2, tileIdx ) - getPosIdx( posIdx2, tileIdx-1 );
/* int targetSizeCmp = getPosIdx( posIdxCmp, tileIdx ) - getPosIdx( posIdxCmp, tileIdx-1 );
if ( targetSizeCmp != targetSize ) throw new IllegalArgumentException( "target size mismatch: "+ targetSize + "," + targetSizeCmp );
From eb716506fd934989177e8c3933b22c58b5a41574 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Wed, 31 Mar 2021 16:07:21 +0200
Subject: [PATCH 22/33] bee-line patch: Nogo covering 2 Waypoints triggers a
beeline segment
---
.../src/main/java/btools/router/OsmPath.java | 5 +-
.../java/btools/router/RoutingContext.java | 47 +++++++++++++++++--
.../java/btools/router/RoutingEngine.java | 32 +++++++++++--
3 files changed, 77 insertions(+), 7 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/OsmPath.java b/brouter-core/src/main/java/btools/router/OsmPath.java
index c76089b..4a42b0c 100644
--- a/brouter-core/src/main/java/btools/router/OsmPath.java
+++ b/brouter-core/src/main/java/btools/router/OsmPath.java
@@ -139,7 +139,10 @@ abstract class OsmPath implements OsmLinkHolder
protected void addAddionalPenalty(OsmTrack refTrack, boolean detailMode, OsmPath origin, OsmLink link, RoutingContext rc )
{
byte[] description = link.descriptionBitmap;
- if ( description == null ) throw new IllegalArgumentException( "null description for: " + link );
+ if ( description == null )
+ {
+ return; // could be a beeline path
+ }
boolean recordTransferNodes = detailMode || rc.countTraffic;
diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java
index 3e207fd..204a072 100644
--- a/brouter-core/src/main/java/btools/router/RoutingContext.java
+++ b/brouter-core/src/main/java/btools/router/RoutingContext.java
@@ -16,6 +16,7 @@ import btools.expressions.BExpressionContextNode;
import btools.expressions.BExpressionContextWay;
import btools.mapaccess.GeometryDecoder;
import btools.mapaccess.OsmLink;
+import btools.mapaccess.OsmNode;
import btools.util.CheapAngleMeter;
import btools.util.CheapRuler;
@@ -191,6 +192,7 @@ public final class RoutingContext
public List poipoints;
public List nogopoints = null;
+ private List nogopoints_all = null; // full list not filtered for wayoints-in-nogos
private List keepnogopoints = null;
private OsmNodeNamed pendingEndpoint = null;
@@ -258,14 +260,29 @@ public final class RoutingContext
}
}
- public void cleanNogolist( List waypoints )
+ /**
+ * restore the full nogolist previously saved by cleanNogoList
+ */
+ public void restoreNogoList()
{
+ nogopoints = nogopoints_all;
+ }
+
+ /**
+ * clean the nogolist (previoulsy saved by saveFullNogolist())
+ * by removing nogos with waypoints within
+ *
+ * @return true if all wayoints are all in the same (full-weigth) nogo area (triggering bee-line-mode)
+ */
+ public void cleanNogoList( List waypoints )
+ {
+ nogopoints_all = nogopoints;
if ( nogopoints == null ) return;
List nogos = new ArrayList();
for( OsmNodeNamed nogo : nogopoints )
{
boolean goodGuy = true;
- for( OsmNodeNamed wp : waypoints )
+ for( OsmNode wp : waypoints )
{
if ( wp.calcDistance( nogo ) < nogo.radius
&& (!(nogo instanceof OsmNogoPolygon)
@@ -274,7 +291,6 @@ public final class RoutingContext
: ((OsmNogoPolygon)nogo).isOnPolyline(wp.ilon, wp.ilat))))
{
goodGuy = false;
- break;
}
}
if ( goodGuy ) nogos.add( nogo );
@@ -282,6 +298,31 @@ public final class RoutingContext
nogopoints = nogos.isEmpty() ? null : nogos;
}
+ public boolean allInOneNogo( List waypoints )
+ {
+ if ( nogopoints == null ) return false;
+ boolean allInTotal = false;
+ for( OsmNodeNamed nogo : nogopoints )
+ {
+ boolean allIn = Double.isNaN( nogo.nogoWeight );
+ for( OsmNode wp : waypoints )
+ {
+ int dist = wp.calcDistance( nogo );
+ if ( dist < nogo.radius
+ && (!(nogo instanceof OsmNogoPolygon)
+ || (((OsmNogoPolygon)nogo).isClosed
+ ? ((OsmNogoPolygon)nogo).isWithin(wp.ilon, wp.ilat)
+ : ((OsmNogoPolygon)nogo).isOnPolyline(wp.ilon, wp.ilat))))
+ {
+ continue;
+ }
+ allIn = false;
+ }
+ allInTotal |= allIn;
+ }
+ return allInTotal;
+ }
+
public long[] getNogoChecksums()
{
long[] cs = new long[3];
diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java
index 9fcea0b..1f9c99b 100644
--- a/brouter-core/src/main/java/btools/router/RoutingEngine.java
+++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java
@@ -151,9 +151,6 @@ public class RoutingEngine extends Thread
{
try
{
- // delete nogos with waypoints in them
- routingContext.cleanNogolist( waypoints );
-
startTime = System.currentTimeMillis();
long startTime0 = startTime;
this.maxRunningTime = maxRunningTime;
@@ -459,6 +456,29 @@ public class RoutingEngine extends Thread
}
private OsmTrack searchTrack( MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack nearbyTrack, OsmTrack refTrack )
+ {
+ // remove nogos with waypoints inside
+ try
+ {
+ List wpts2 = new ArrayList();
+ wpts2.add( startWp.waypoint );
+ wpts2.add( endWp.waypoint );
+ boolean calcBeeline = routingContext.allInOneNogo(wpts2);
+
+ if ( !calcBeeline ) return searchRoutedTrack( startWp, endWp, nearbyTrack, refTrack );
+
+ // we want a beeline-segment
+ OsmPath path = routingContext.createPath( new OsmLink( null, startWp.crosspoint ) );
+ path = routingContext.createPath( path, new OsmLink( startWp.crosspoint, endWp.crosspoint ), null, false );
+ return compileTrack( path, false );
+ }
+ finally
+ {
+ routingContext.restoreNogoList();
+ }
+ }
+
+ private OsmTrack searchRoutedTrack( MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack nearbyTrack, OsmTrack refTrack )
{
OsmTrack track = null;
double[] airDistanceCostFactors = new double[]{ routingContext.pass1coefficient, routingContext.pass2coefficient };
@@ -650,6 +670,11 @@ public class RoutingEngine extends Thread
{
try
{
+ List wpts2 = new ArrayList();
+ if ( startWp != null ) wpts2.add( startWp.waypoint );
+ if ( endWp != null ) wpts2.add( endWp.waypoint );
+ routingContext.cleanNogoList(wpts2);
+
boolean detailed = guideTrack != null;
resetCache( detailed );
nodesCache.nodesMap.cleanupMode = detailed ? 0 : ( routingContext.considerTurnRestrictions ? 2 : 1 );
@@ -657,6 +682,7 @@ public class RoutingEngine extends Thread
}
finally
{
+ routingContext.restoreNogoList();
nodesCache.clean( false ); // clean only non-virgin caches
}
}
From 1e542d19b7c45a4ee685acf20a858934bb4e2f6c Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Mon, 5 Apr 2021 20:58:15 +0200
Subject: [PATCH 23/33] more aliases for highway=proposed|abandoned
---
misc/profiles2/lookups.dat | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/misc/profiles2/lookups.dat b/misc/profiles2/lookups.dat
index d8e935b..5a9599e 100644
--- a/misc/profiles2/lookups.dat
+++ b/misc/profiles2/lookups.dat
@@ -27,10 +27,10 @@ highway;0000079637 tertiary_link
highway;0000070238 construction
highway;0000058257 bridleway
highway;0000039003 platform
-highway;0000037192 proposed
+highway;0000037192 proposed planned virtual
highway;0000010307 raceway
highway;0000003152 rest_area
-highway;0000002942 abandoned
+highway;0000002942 abandoned disused razed demolished dismantled
highway;0000002631 services
highway;0000002133 corridor
highway;0000002093 crossing
@@ -227,7 +227,7 @@ cycleway;0000000892 left
cycleway;0000000399 street
cycleway;0000000344 shoulder
cycleway;0000000326 designated
-cycleway;0000000247 proposed
+cycleway;0000000247 proposed planned virtual
cycleway;0000000224 cyclestreet
cycleway;0000000172 path
cycleway;0000000154 sidewalk
From 3565f39914a05b04ef648a6a68b70ae2b5c10e91 Mon Sep 17 00:00:00 2001
From: Norbert Renner
Date: Sat, 10 Apr 2021 10:04:50 +0200
Subject: [PATCH 24/33] Complete voice hints and add times to GeoJSON
---
.../src/main/java/btools/router/OsmTrack.java | 39 +++++++++++++++++--
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java
index c732a03..e2a6145 100644
--- a/brouter-core/src/main/java/btools/router/OsmTrack.java
+++ b/brouter-core/src/main/java/btools/router/OsmTrack.java
@@ -19,8 +19,11 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import btools.mapaccess.MatchedWaypoint;
import btools.mapaccess.OsmPos;
@@ -710,6 +713,8 @@ public final class OsmTrack
public String formatAsGeoJson()
{
+ int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0;
+
StringBuilder sb = new StringBuilder( 8192 );
sb.append( "{\n" );
@@ -731,7 +736,20 @@ public final class OsmTrack
sb.append( " \"voicehints\": [\n" );
for( VoiceHint hint: voiceHints.list )
{
- sb.append( " [" ).append( hint.indexInTrack ).append( ',' ).append( hint.getCommand() ).append( ',' ).append( hint.getExitNumber() ).append( "],\n" );
+ sb.append( " [" );
+ sb.append( hint.indexInTrack );
+ sb.append( ',' ).append( hint.getCommand() );
+ sb.append( ',' ).append( hint.getExitNumber() );
+ sb.append( ',' ).append( hint.distanceToNext );
+ sb.append( ',' ).append( (int) hint.angle );
+
+ // not always include geometry because longer and only needed for comment style
+ if ( turnInstructionMode == 4 ) // comment style
+ {
+ sb.append( ",\"" ).append( hint.formatGeometry() ).append( "\"" );
+ }
+
+ sb.append( "],\n" );
}
sb.deleteCharAt( sb.lastIndexOf( "," ) );
sb.append( " ],\n" );
@@ -746,7 +764,7 @@ public final class OsmTrack
{
sb.append( " [" ).append( sp.get(i) ).append( i> 0 ? "],\n" : "]\n" );
}
- sb.append( " ]\n" );
+ sb.append( " ],\n" );
}
}
else // ... otherwise traditional message list
@@ -758,9 +776,24 @@ public final class OsmTrack
sb.append( " [\"" ).append( m.replaceAll( "\t", "\", \"" ) ).append( "\"],\n" );
}
sb.deleteCharAt( sb.lastIndexOf( "," ) );
- sb.append( " ]\n" );
+ sb.append( " ],\n" );
}
+
+ if ( getTotalSeconds() > 0 ) {
+ sb.append( " \"times\": [" );
+ DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getInstance( Locale.ENGLISH );
+ decimalFormat.applyPattern( "0.###" );
+ for ( OsmPathElement n : nodes ) {
+ sb.append( decimalFormat.format( n.getTime() ) ).append( "," );
+ }
+ sb.deleteCharAt( sb.lastIndexOf( "," ) );
+ sb.append( "]\n" );
+ } else {
+ sb.deleteCharAt( sb.lastIndexOf( "," ) );
+ }
+
sb.append( " },\n" );
+
if ( iternity != null )
{
sb.append( " \"iternity\": [\n" );
From 8206a1ae845982512f69c8de8fb0d28643552ee7 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sun, 18 Apr 2021 17:35:50 +0200
Subject: [PATCH 25/33] ip/session monitoring
---
.../java/btools/server/IpAccessMonitor.java | 42 +++++++++++++++++++
.../main/java/btools/server/RouteServer.java | 19 ++++++---
2 files changed, 56 insertions(+), 5 deletions(-)
create mode 100644 brouter-server/src/main/java/btools/server/IpAccessMonitor.java
diff --git a/brouter-server/src/main/java/btools/server/IpAccessMonitor.java b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
new file mode 100644
index 0000000..2aa1c8e
--- /dev/null
+++ b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
@@ -0,0 +1,42 @@
+package btools.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class IpAccessMonitor
+{
+ private static Object sync = new Object();
+ private static HashMap ipAccess = new HashMap();
+ private static long MAX_IDLE = 900000; // 15 minutes
+
+ public static boolean touchIpAccess( String ip )
+ {
+ long t = System.currentTimeMillis();
+ synchronized( sync )
+ {
+ Long lastTime = ipAccess.get( ip );
+ if ( lastTime == null || t - lastTime.longValue() > MAX_IDLE )
+ {
+ ipAccess.put( ip, Long.valueOf( t ) );
+ cleanup(t);
+ return true; // new session detected
+ }
+ ipAccess.put( ip, Long.valueOf( t ) ); // touch existing session
+ return false;
+ }
+ }
+
+ private static void cleanup( long t )
+ {
+ HashMap newMap = new HashMap(ipAccess.size());
+ for( Map.Entry e : ipAccess.entrySet() )
+ {
+ if ( t - e.getValue().longValue() <= MAX_IDLE )
+ {
+ newMap.put( e.getKey(), e.getValue() );
+ }
+ }
+ ipAccess = newMap;
+ }
+
+}
diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java
index dbb3624..ce79ec2 100644
--- a/brouter-server/src/main/java/btools/server/RouteServer.java
+++ b/brouter-server/src/main/java/btools/server/RouteServer.java
@@ -82,6 +82,7 @@ public class RouteServer extends Thread implements Comparable
String getline = null;
String agent = null;
String encodings = null;
+ String xff = null; // X-Forwarded-For
// more headers until first empty line
for(;;)
@@ -102,13 +103,18 @@ public class RouteServer extends Thread implements Comparable
{
getline = line;
}
- if ( line.startsWith( "User-Agent: " ) )
+ line = line.toLowerCase();
+ if ( line.startsWith( "user-agent: " ) )
{
- agent = line.substring( "User-Agent: ".length() );
+ agent = line.substring( "user-agent: ".length() );
}
- if ( line.startsWith( "Accept-Encoding: " ) )
+ if ( line.startsWith( "accept-encoding: " ) )
{
- encodings = line.substring( "Accept-Encoding: ".length() );
+ encodings = line.substring( "accept-encoding: ".length() );
+ }
+ if ( line.startsWith( "x-forwarded-for: " ) )
+ {
+ xff = line.substring( "x-forwarded-for: ".length() );
}
}
@@ -143,8 +149,11 @@ public class RouteServer extends Thread implements Comparable
return;
}
+
InetAddress ip = clientSocket.getInetAddress();
- System.out.println( formattedTimestamp() + " ip=" + (ip==null ? "null" : ip.toString() ) + " -> " + getline );
+ String sIp = xff == null ? (ip==null ? "null" : ip.toString() ) : xff;
+ String sessionMode = IpAccessMonitor.touchIpAccess( sIp ) ? " new " : " ";
+ System.out.println( formattedTimestamp() + sessionMode + " ip=" + sIp + " -> " + getline );
String url = getline.split(" ")[1];
HashMap params = getUrlParams(url);
From 31e761e731519df0fd2908e16d8d93492b7af9f5 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sun, 18 Apr 2021 19:32:07 +0200
Subject: [PATCH 26/33] session/ip info
---
.../java/btools/server/IpAccessMonitor.java | 24 +++++++++++++------
.../main/java/btools/server/RouteServer.java | 11 +++++++--
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/brouter-server/src/main/java/btools/server/IpAccessMonitor.java b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
index 2aa1c8e..3f3da83 100644
--- a/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
+++ b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
@@ -8,21 +8,31 @@ public class IpAccessMonitor
private static Object sync = new Object();
private static HashMap ipAccess = new HashMap();
private static long MAX_IDLE = 900000; // 15 minutes
-
+ private static long CLEANUP_INTERVAL = 10000; // 10 seconds
+ private static long lastCleanup;
+
public static boolean touchIpAccess( String ip )
{
long t = System.currentTimeMillis();
synchronized( sync )
{
Long lastTime = ipAccess.get( ip );
- if ( lastTime == null || t - lastTime.longValue() > MAX_IDLE )
+ ipAccess.put( ip, Long.valueOf( t ) );
+ return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
+ }
+ }
+
+ public static int getSessionCount()
+ {
+ long t = System.currentTimeMillis();
+ synchronized( sync )
+ {
+ if ( t - lastCleanup > CLEANUP_INTERVAL )
{
- ipAccess.put( ip, Long.valueOf( t ) );
- cleanup(t);
- return true; // new session detected
+ cleanup( t );
+ lastCleanup = t;
}
- ipAccess.put( ip, Long.valueOf( t ) ); // touch existing session
- return false;
+ return ipAccess.size();
}
}
diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java
index ce79ec2..4d0887e 100644
--- a/brouter-server/src/main/java/btools/server/RouteServer.java
+++ b/brouter-server/src/main/java/btools/server/RouteServer.java
@@ -152,8 +152,15 @@ public class RouteServer extends Thread implements Comparable
InetAddress ip = clientSocket.getInetAddress();
String sIp = xff == null ? (ip==null ? "null" : ip.toString() ) : xff;
- String sessionMode = IpAccessMonitor.touchIpAccess( sIp ) ? " new " : " ";
- System.out.println( formattedTimestamp() + sessionMode + " ip=" + sIp + " -> " + getline );
+ boolean newSession = IpAccessMonitor.touchIpAccess( sIp );
+ String sessionInfo = " new";
+ if ( !newSession )
+ {
+ int sessionCount = IpAccessMonitor.getSessionCount();
+ sessionInfo = " " + Math.min( sessionCount, 999 );
+ sessionInfo = sessionInfo.substring( sessionInfo.length() - 4 );
+ }
+ System.out.println( formattedTimestamp() + sessionInfo + " ip=" + sIp + " -> " + getline );
String url = getline.split(" ")[1];
HashMap params = getUrlParams(url);
From be71c0d86ed4e4a9b7679d1d92ef594e646c9006 Mon Sep 17 00:00:00 2001
From: radim-asamm
Date: Thu, 22 Apr 2021 14:01:17 +0200
Subject: [PATCH 27/33] Added time and energy to response messages.
---
brouter-core/src/main/java/btools/router/MessageData.java | 4 +++-
brouter-core/src/main/java/btools/router/OsmTrack.java | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/MessageData.java b/brouter-core/src/main/java/btools/router/MessageData.java
index 10c3c8f..9e1fd0a 100644
--- a/brouter-core/src/main/java/btools/router/MessageData.java
+++ b/brouter-core/src/main/java/btools/router/MessageData.java
@@ -55,7 +55,9 @@ final class MessageData implements Cloneable
+ "\t" + linknodecost
+ "\t" + linkinitcost
+ "\t" + wayKeyValues
- + "\t" + ( nodeKeyValues == null ? "" : nodeKeyValues );
+ + "\t" + ( nodeKeyValues == null ? "" : nodeKeyValues )
+ + "\t" + time
+ + "\t" + energy;
}
void add( MessageData d )
diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java
index e2a6145..3349cad 100644
--- a/brouter-core/src/main/java/btools/router/OsmTrack.java
+++ b/brouter-core/src/main/java/btools/router/OsmTrack.java
@@ -34,7 +34,7 @@ import btools.util.StringUtils;
public final class OsmTrack
{
// csv-header-line
- private static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags";
+ private static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags\tTime\tEnergy";
public MatchedWaypoint endPoint;
public long[] nogoChecksums;
From 56b4263107296de29a851a0e7b0aff7027eb3c50 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sun, 2 May 2021 15:30:16 +0200
Subject: [PATCH 28/33] add response time and contention traces to logfile
---
.../main/java/btools/server/RouteServer.java | 45 ++++++++++++-------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java
index 4d0887e..26ccfd3 100644
--- a/brouter-server/src/main/java/btools/server/RouteServer.java
+++ b/brouter-server/src/main/java/btools/server/RouteServer.java
@@ -61,7 +61,7 @@ public class RouteServer extends Thread implements Comparable
private static DateFormat tsFormat = new SimpleDateFormat( "dd.MM.yy HH:mm", new Locale( "en", "US" ) );
- private static String formattedTimestamp()
+ private static String formattedTimeStamp( long t )
{
synchronized( tsFormat )
{
@@ -73,13 +73,17 @@ public class RouteServer extends Thread implements Comparable
{
BufferedReader br = null;
BufferedWriter bw = null;
+
+ // first line
+ String getline = null;
+ String sessionInfo = null;
+ String sIp = null;
+
try
{
br = new BufferedReader( new InputStreamReader( clientSocket.getInputStream() , "UTF-8") );
bw = new BufferedWriter( new OutputStreamWriter( clientSocket.getOutputStream(), "UTF-8" ) );
- // first line
- String getline = null;
String agent = null;
String encodings = null;
String xff = null; // X-Forwarded-For
@@ -118,6 +122,17 @@ public class RouteServer extends Thread implements Comparable
}
}
+ InetAddress ip = clientSocket.getInetAddress();
+ sIp = xff == null ? (ip==null ? "null" : ip.toString() ) : xff;
+ boolean newSession = IpAccessMonitor.touchIpAccess( sIp );
+ sessionInfo = " new";
+ if ( !newSession )
+ {
+ int sessionCount = IpAccessMonitor.getSessionCount();
+ sessionInfo = " " + Math.min( sessionCount, 999 );
+ sessionInfo = sessionInfo.substring( sessionInfo.length() - 4 );
+ }
+
String excludedAgents = System.getProperty( "excludedAgents" );
if ( agent != null && excludedAgents != null )
{
@@ -149,19 +164,6 @@ public class RouteServer extends Thread implements Comparable
return;
}
-
- InetAddress ip = clientSocket.getInetAddress();
- String sIp = xff == null ? (ip==null ? "null" : ip.toString() ) : xff;
- boolean newSession = IpAccessMonitor.touchIpAccess( sIp );
- String sessionInfo = " new";
- if ( !newSession )
- {
- int sessionCount = IpAccessMonitor.getSessionCount();
- sessionInfo = " " + Math.min( sessionCount, 999 );
- sessionInfo = sessionInfo.substring( sessionInfo.length() - 4 );
- }
- System.out.println( formattedTimestamp() + sessionInfo + " ip=" + sIp + " -> " + getline );
-
String url = getline.split(" ")[1];
HashMap params = getUrlParams(url);
@@ -296,8 +298,12 @@ public class RouteServer extends Thread implements Comparable
{
threadPoolSync.notifyAll();
}
+ long t = System.currentTimeMillis();
+ long ms = t - starttime;
+ System.out.println( formattedTimeStamp(t) + sessionInfo + " ip=" + sIp + " ms=" + ms + " -> " + getline );
}
}
+
public static void main(String[] args) throws Exception
{
@@ -371,13 +377,18 @@ public class RouteServer extends Thread implements Comparable
{
threadPoolSync.wait( maxWaitTime );
}
+ long t = System.currentTimeMillis();
+ System.out.println( formattedTimeStamp(t) + " contention! ms waited " + (t - server.starttime) );
}
cleanupThreadQueue( threadQueue );
if ( threadQueue.size() >= maxthreads )
{
if ( debug ) System.out.println( "stopping oldest thread..." );
// no way... stop the oldest thread
- threadQueue.poll().stopRouter();
+ RouteServer oldest = threadQueue.poll();
+ oldest.stopRouter();
+ long t = System.currentTimeMillis();
+ System.out.println( formattedTimeStamp(t) + " contention! ms killed " + (t - oldest.starttime) );
}
}
From 8234293e5aa3a35bb4b2cd50d13355eb1922af4f Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sun, 2 May 2021 15:31:41 +0200
Subject: [PATCH 29/33] time/energy in message data only integer precision
---
brouter-core/src/main/java/btools/router/MessageData.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/brouter-core/src/main/java/btools/router/MessageData.java b/brouter-core/src/main/java/btools/router/MessageData.java
index 9e1fd0a..3e3b6bb 100644
--- a/brouter-core/src/main/java/btools/router/MessageData.java
+++ b/brouter-core/src/main/java/btools/router/MessageData.java
@@ -56,8 +56,8 @@ final class MessageData implements Cloneable
+ "\t" + linkinitcost
+ "\t" + wayKeyValues
+ "\t" + ( nodeKeyValues == null ? "" : nodeKeyValues )
- + "\t" + time
- + "\t" + energy;
+ + "\t" + ((int)time)
+ + "\t" + ((int)energy);
}
void add( MessageData d )
From 55a159af5d005ce94679f17639e0a14eaea34924 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Sat, 22 May 2021 13:39:47 +0200
Subject: [PATCH 30/33] suspect-manager: sentinel-2 link
---
brouter-server/src/main/java/btools/server/SuspectManager.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/brouter-server/src/main/java/btools/server/SuspectManager.java b/brouter-server/src/main/java/btools/server/SuspectManager.java
index 5e8c929..f9a62f1 100644
--- a/brouter-server/src/main/java/btools/server/SuspectManager.java
+++ b/brouter-server/src/main/java/btools/server/SuspectManager.java
@@ -450,6 +450,8 @@ public class SuspectManager extends Thread
String url5 = "https://tyrasd.github.io/latest-changes/#16/" + dlat + "/" + dlon;
+ String url6 = "https://apps.sentinel-hub.com/sentinel-playground/?source=S2L2A&lat=" + dlat + "&lng=" + dlon + "&zoom=15";
+
if ( message != null )
{
bw.write( "" + message + "
\n" );
@@ -459,6 +461,7 @@ public class SuspectManager extends Thread
bw.write( "Open in JOSM (via remote control)
\n" );
bw.write( "Overpass: minus one week node context
\n" );
bw.write( "Open in Latest-Changes / last week
\n" );
+ bw.write( "Current Sentinel-2 imagary
\n" );
bw.write( "
\n" );
if ( isFixed( id, suspects.timestamp ) )
{
From cdac1cc5aaa97d3bda16c9f2682f74560ab9b244 Mon Sep 17 00:00:00 2001
From: Arndt Brenschede
Date: Wed, 26 May 2021 08:36:52 +0200
Subject: [PATCH 31/33] spam heuristics
---
.../main/java/btools/server/RouteServer.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java
index 26ccfd3..7125dc8 100644
--- a/brouter-server/src/main/java/btools/server/RouteServer.java
+++ b/brouter-server/src/main/java/btools/server/RouteServer.java
@@ -87,6 +87,7 @@ public class RouteServer extends Thread implements Comparable
String agent = null;
String encodings = null;
String xff = null; // X-Forwarded-For
+ String referer = null;
// more headers until first empty line
for(;;)
@@ -120,6 +121,14 @@ public class RouteServer extends Thread implements Comparable
{
xff = line.substring( "x-forwarded-for: ".length() );
}
+ if ( line.startsWith( "Referer: " ) )
+ {
+ referer = line.substring( "Referer: ".length() );
+ }
+ if ( line.startsWith( "Referrer: " ) )
+ {
+ referer = line.substring( "Referrer: ".length() );
+ }
}
InetAddress ip = clientSocket.getInetAddress();
@@ -149,6 +158,17 @@ public class RouteServer extends Thread implements Comparable
}
}
+ if ( referer != null && referer.indexOf( "brouter.de/brouter-web" ) >= 0 )
+ {
+ if ( getline.indexOf( "%7C" ) >= 0 && getline.indexOf( "%2C" ) >= 0 )
+ {
+ writeHttpHeader( bw, HTTP_STATUS_FORBIDDEN );
+ bw.write( "Spam? please stop" );
+ bw.flush();
+ return;
+ }
+ }
+
if ( getline.startsWith("GET /favicon.ico") )
{
writeHttpHeader( bw, HTTP_STATUS_NOT_FOUND );
From 47f1b10b9990fc19b64c670d9296823189a491e4 Mon Sep 17 00:00:00 2001
From: afischerdev
Date: Tue, 29 Jun 2021 13:02:21 +0200
Subject: [PATCH 32/33] migrate to gradle part 2
---
README.md | 16 +++--
brouter-codec/build.gradle | 1 +
brouter-core/build.gradle | 1 +
brouter-expressions/build.gradle | 1 +
.../btools/expressions/EncodeDecodeTest.java | 2 +-
brouter-map-creator/build.gradle | 16 ++++-
.../btools/mapcreator/MapcreatorTest.java | 2 +-
brouter-mapaccess/build.gradle | 1 -
brouter-routing-app/build.gradle | 58 +++++++++++++++++--
brouter-server/build.gradle | 10 +++-
.../btools/server/IntegrityCheckTest.java | 2 +-
.../test/java/btools/server/RouterTest.java | 4 +-
brouter-util/build.gradle | 2 +-
build.gradle | 8 +--
gradle/wrapper/gradle-wrapper.properties | 2 +-
15 files changed, 96 insertions(+), 30 deletions(-)
diff --git a/README.md b/README.md
index c91ea3e..40fa91e 100644
--- a/README.md
+++ b/README.md
@@ -46,21 +46,27 @@ A full documentation on how to set this up is available at
### Build and Install
-To compile BRouter (including the BRouter Android app), use
+To compile BRouter (including the BRouter Android app), add a file
+local.properties to main folder with your Android path
```
-mvn clean install -Dandroid.sdk.path=
+sdk.dir=D\:\\Android\\android-sdk
+```
+
+
+and use
+
+```
+gradlew clean build
```
If you only want to compile BRouter and the server part (skipping the Android
app), use
```
-mvn clean install -pl '!brouter-routing-app'
+gradlew clean build -x :brouter-routing-app:build
```
-You can use `-Dmaven.javadoc.skip=true` to skip the JavaDoc processing and
-`-DskipTests` to skip running the unitary tests.
### Get the required segments (data) files
diff --git a/brouter-codec/build.gradle b/brouter-codec/build.gradle
index f055667..22faffe 100644
--- a/brouter-codec/build.gradle
+++ b/brouter-codec/build.gradle
@@ -4,4 +4,5 @@ plugins {
dependencies {
implementation project(':brouter-util')
+ testImplementation 'junit:junit:4.13.1'
}
diff --git a/brouter-core/build.gradle b/brouter-core/build.gradle
index 597056a..c96982f 100644
--- a/brouter-core/build.gradle
+++ b/brouter-core/build.gradle
@@ -8,5 +8,6 @@ dependencies {
implementation project(':brouter-util')
implementation project(':brouter-expressions')
implementation project(':brouter-codec')
+ testImplementation 'junit:junit:4.13.1'
}
diff --git a/brouter-expressions/build.gradle b/brouter-expressions/build.gradle
index 839a17d..ff146d6 100644
--- a/brouter-expressions/build.gradle
+++ b/brouter-expressions/build.gradle
@@ -5,4 +5,5 @@ plugins {
dependencies {
implementation project(':brouter-util')
implementation project(':brouter-codec')
+ testImplementation 'junit:junit:4.13.1'
}
diff --git a/brouter-expressions/src/test/java/btools/expressions/EncodeDecodeTest.java b/brouter-expressions/src/test/java/btools/expressions/EncodeDecodeTest.java
index f25beb1..4e51400 100644
--- a/brouter-expressions/src/test/java/btools/expressions/EncodeDecodeTest.java
+++ b/brouter-expressions/src/test/java/btools/expressions/EncodeDecodeTest.java
@@ -14,7 +14,7 @@ public class EncodeDecodeTest
{
URL testpurl = this.getClass().getResource( "/dummy.txt" );
File workingDir = new File(testpurl.getFile()).getParentFile();
- File profileDir = new File( workingDir, "/../../../misc/profiles2" );
+ File profileDir = new File( workingDir, "/../../../../misc/profiles2" );
File lookupFile = new File( profileDir, "lookups.dat" );
// read lookup.dat + trekking.brf
diff --git a/brouter-map-creator/build.gradle b/brouter-map-creator/build.gradle
index 1bbc73f..530e277 100644
--- a/brouter-map-creator/build.gradle
+++ b/brouter-map-creator/build.gradle
@@ -2,15 +2,25 @@ plugins {
id 'application'
}
+version = '1.6.1'
+
application {
// Gradles 'application' plugin requires one main class; since we have multiple ones, just specify
// one of them, since the applications won't be run from gradle anyways.
- mainClassName = 'btools.mapcreator.PosUnifier'
+ mainClass.set('btools.mapcreator.PosUnifier')
+
+ jar {
+ manifest {
+ attributes "Main-Class": getMainClass()
+ }
+ }
+
}
dependencies {
- implementation project(':brouter-util')
implementation project(':brouter-codec')
+ implementation project(':brouter-util')
implementation project(':brouter-expressions')
- implementation('junit:junit:4.13')
+
+ testImplementation('junit:junit:4.13.1')
}
diff --git a/brouter-map-creator/src/test/java/btools/mapcreator/MapcreatorTest.java b/brouter-map-creator/src/test/java/btools/mapcreator/MapcreatorTest.java
index 2ea044f..a9e555e 100644
--- a/brouter-map-creator/src/test/java/btools/mapcreator/MapcreatorTest.java
+++ b/brouter-map-creator/src/test/java/btools/mapcreator/MapcreatorTest.java
@@ -17,7 +17,7 @@ public class MapcreatorTest
Assert.assertTrue( "test-osm-map dreieich.osm not found", mapurl != null );
File mapFile = new File(mapurl.getFile());
File workingDir = mapFile.getParentFile();
- File profileDir = new File( workingDir, "/../../../misc/profiles2" );
+ File profileDir = new File( workingDir, "/../../../../misc/profiles2" );
File tmpdir = new File( workingDir, "tmp" );
tmpdir.mkdir();
diff --git a/brouter-mapaccess/build.gradle b/brouter-mapaccess/build.gradle
index eb89b10..c920239 100644
--- a/brouter-mapaccess/build.gradle
+++ b/brouter-mapaccess/build.gradle
@@ -3,7 +3,6 @@ plugins {
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':brouter-util')
implementation project(':brouter-codec')
implementation project(':brouter-expressions')
diff --git a/brouter-routing-app/build.gradle b/brouter-routing-app/build.gradle
index 9af45ba..a54bf48 100644
--- a/brouter-routing-app/build.gradle
+++ b/brouter-routing-app/build.gradle
@@ -3,32 +3,78 @@ plugins {
}
android {
- compileSdkVersion 29
+ compileSdkVersion 30
defaultConfig {
applicationId "btools.routingapp"
- minSdkVersion 10
- targetSdkVersion 29
+ minSdkVersion 19
+ targetSdkVersion 30
versionCode 41
versionName "1.6.1"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ setProperty("archivesBaseName","BRouterApp." + defaultConfig.versionName)
+
+ //testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
+ if(project.hasProperty("RELEASE_STORE_FILE")) {
+ signingConfigs {
+ // this uses a file ~/.gradle/gradle.properties
+ // with content:
+ // RELEASE_STORE_FILE={path to your keystore}
+ // RELEASE_STORE_PASSWORD=*****
+ // RELEASE_KEY_ALIAS=*****
+ // RELEASE_KEY_PASSWORD=*****
+ //
+ release {
+ // enable signingConfig in buildTypes to get a signed apk file
+ storeFile file(RELEASE_STORE_FILE)
+ storePassword RELEASE_STORE_PASSWORD
+ keyAlias RELEASE_KEY_ALIAS
+ keyPassword RELEASE_KEY_PASSWORD
+
+ // Optional, specify signing versions used
+ v1SigningEnabled true
+ v2SigningEnabled true
+
+ }
+ }
+ }
+
buildTypes {
release {
minifyEnabled false
+ debuggable false
+ if(project.hasProperty("RELEASE_STORE_FILE")) {
+ signingConfig signingConfigs.release
+ }
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
+ debug {
+ minifyEnabled false
+ debuggable true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ lintOptions {
+ disable 'InvalidPackage'
+ checkReleaseBuilds false //added this line to the build.gradle under the /android/app/build.gradle
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
-
+
+ implementation 'androidx.appcompat:appcompat:1.3.0'
+
implementation project(':brouter-mapaccess')
implementation project(':brouter-core')
implementation project(':brouter-expressions')
implementation project(':brouter-util')
+
}
diff --git a/brouter-server/build.gradle b/brouter-server/build.gradle
index 6c4d867..868dfc4 100644
--- a/brouter-server/build.gradle
+++ b/brouter-server/build.gradle
@@ -2,19 +2,23 @@ plugins {
id 'application'
}
+version = '1.6.1'
+
application {
- mainClassName = 'btools.server.BRouter'
+ mainClass.set('btools.server.BRouter')
jar {
manifest {
- attributes "Main-Class": "$mainClassName"
+ attributes "Main-Class": getMainClass()
}
}
}
dependencies {
- implementation('junit:junit:4.13')
+ testImplementation 'junit:junit:4.13.1'
+
implementation project(':brouter-util')
implementation project(':brouter-core')
implementation project(':brouter-mapaccess')
+
}
diff --git a/brouter-server/src/test/java/btools/server/IntegrityCheckTest.java b/brouter-server/src/test/java/btools/server/IntegrityCheckTest.java
index 5637a9f..19e9237 100644
--- a/brouter-server/src/test/java/btools/server/IntegrityCheckTest.java
+++ b/brouter-server/src/test/java/btools/server/IntegrityCheckTest.java
@@ -20,7 +20,7 @@ public class IntegrityCheckTest
File resultfile = new File( resulturl.getFile() );
workingDir = resultfile.getParentFile();
- File segmentDir = new File( workingDir, "/../../../brouter-map-creator/target/test-classes/tmp/segments" );
+ File segmentDir = new File( workingDir, "/../../../../brouter-map-creator/build/resources/test/tmp/segments" );
File[] files = segmentDir.listFiles();
for ( File f : files )
diff --git a/brouter-server/src/test/java/btools/server/RouterTest.java b/brouter-server/src/test/java/btools/server/RouterTest.java
index 3b4612e..e272770 100644
--- a/brouter-server/src/test/java/btools/server/RouterTest.java
+++ b/brouter-server/src/test/java/btools/server/RouterTest.java
@@ -61,13 +61,13 @@ public class RouterTest
wplist.add( n );
RoutingContext rctx = new RoutingContext();
- rctx.localFunction = wd + "/../../../misc/profiles2/trekking.brf";
+ rctx.localFunction = wd + "/../../../../misc/profiles2/trekking.brf";
// c.setAlternativeIdx( 1 );
RoutingEngine re = new RoutingEngine(
wd + "/" + trackname,
wd + "/" + trackname,
- wd + "/../../../brouter-map-creator/target/test-classes/tmp/segments", wplist, rctx );
+ wd + "/../../../../brouter-map-creator/build/resources/test/tmp/segments", wplist, rctx );
re.doRun( 0 );
return re.getErrorMessage();
diff --git a/brouter-util/build.gradle b/brouter-util/build.gradle
index 4b22331..3dc5565 100644
--- a/brouter-util/build.gradle
+++ b/brouter-util/build.gradle
@@ -3,5 +3,5 @@ plugins {
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
+ testImplementation('junit:junit:4.13.1')
}
diff --git a/build.gradle b/build.gradle
index a88f623..5315d26 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,12 +3,11 @@
buildscript {
repositories {
+ mavenCentral()
google()
- jcenter()
-
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.3'
+ classpath 'com.android.tools.build:gradle:4.1.3'
// NOTE: Do not place your application dependencies here; they belong
@@ -18,9 +17,8 @@ buildscript {
allprojects {
repositories {
+ mavenCentral()
google()
- jcenter()
-
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 782faa3..1d288b1 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
From a331c8a0dae5fc3946879c188632e25bb5d21599 Mon Sep 17 00:00:00 2001
From: afischerdev
Date: Tue, 29 Jun 2021 13:04:47 +0200
Subject: [PATCH 33/33] migrate to gradle part 2
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 40fa91e..61843fc 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,7 @@ A full documentation on how to set this up is available at
### Build and Install
-To compile BRouter (including the BRouter Android app), add a file
-local.properties to main folder with your Android path
+To compile BRouter (including the BRouter Android app), add a file 'local.properties' to main folder with your Android path (Windows sample)
```
sdk.dir=D\:\\Android\\android-sdk