Merge branch 'master' into cleanup-fileaccess

This commit is contained in:
afischerdev 2021-07-01 11:20:30 +02:00 committed by GitHub
commit 8c5a961011
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 1637 additions and 1084 deletions

View file

@ -46,21 +46,26 @@ A full documentation on how to set this up is available at
### Build and Install ### 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 (Windows sample)
``` ```
mvn clean install -Dandroid.sdk.path=<your-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 If you only want to compile BRouter and the server part (skipping the Android
app), use 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 ### Get the required segments (data) files

View file

@ -4,4 +4,5 @@ plugins {
dependencies { dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
testImplementation 'junit:junit:4.13.1'
} }

View file

@ -8,5 +8,6 @@ dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
implementation project(':brouter-codec') implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.1'
} }

View file

@ -55,7 +55,9 @@ final class MessageData implements Cloneable
+ "\t" + linknodecost + "\t" + linknodecost
+ "\t" + linkinitcost + "\t" + linkinitcost
+ "\t" + wayKeyValues + "\t" + wayKeyValues
+ "\t" + ( nodeKeyValues == null ? "" : nodeKeyValues ); + "\t" + ( nodeKeyValues == null ? "" : nodeKeyValues )
+ "\t" + ((int)time)
+ "\t" + ((int)energy);
} }
void add( MessageData d ) void add( MessageData d )

View file

@ -139,7 +139,10 @@ abstract class OsmPath implements OsmLinkHolder
protected void addAddionalPenalty(OsmTrack refTrack, boolean detailMode, OsmPath origin, OsmLink link, RoutingContext rc ) protected void addAddionalPenalty(OsmTrack refTrack, boolean detailMode, OsmPath origin, OsmLink link, RoutingContext rc )
{ {
byte[] description = link.descriptionBitmap; 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; boolean recordTransferNodes = detailMode || rc.countTraffic;
@ -298,6 +301,16 @@ abstract class OsmPath implements OsmLinkHolder
originElement = null; // prevent duplicate point 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 );
}
}
} }
} }

View file

@ -19,8 +19,11 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import btools.mapaccess.MatchedWaypoint; import btools.mapaccess.MatchedWaypoint;
import btools.mapaccess.OsmPos; import btools.mapaccess.OsmPos;
@ -31,7 +34,7 @@ import btools.util.StringUtils;
public final class OsmTrack public final class OsmTrack
{ {
// csv-header-line // 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 MatchedWaypoint endPoint;
public long[] nogoChecksums; public long[] nogoChecksums;
@ -528,6 +531,23 @@ public final class OsmTrack
.append( "</wpt>\n" ); .append( "</wpt>\n" );
} }
} }
if ( turnInstructionMode == 6 ) // orux style
{
for( VoiceHint hint: voiceHints.list )
{
sb.append( " <wpt lat=\"" ).append( formatILat( hint.ilat ) ).append( "\" lon=\"" )
.append( formatILon( hint.ilon ) ).append( "\">" )
.append( hint.selev == Short.MIN_VALUE ? "" : "<ele>" + (hint.selev / 4.) + "</ele>" )
.append( "<extensions>\n" +
"<om:oruxmapsextensions xmlns:om=\"http://www.oruxmaps.com/oruxmapsextensions/1/0\">\n" +
"<om:ext type=\"ICON\" subtype=\"0\">" ).append("" + hint.getOruxAction() )
.append( "</om:ext>\n" +
"</om:oruxmapsextensions>\n" +
"</extensions>\n" +
"</wpt>" );
}
}
for( int i=0; i<=pois.size() - 1; i++ ) for( int i=0; i<=pois.size() - 1; i++ )
{ {
@ -691,8 +711,19 @@ public final class OsmTrack
public List<String> iternity; public List<String> iternity;
public void writeJson( String filename ) throws Exception
{
BufferedWriter bw = new BufferedWriter( new FileWriter( filename ) );
bw.write( formatAsGeoJson() );
bw.close();
}
public String formatAsGeoJson() public String formatAsGeoJson()
{ {
int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0;
StringBuilder sb = new StringBuilder( 8192 ); StringBuilder sb = new StringBuilder( 8192 );
sb.append( "{\n" ); sb.append( "{\n" );
@ -714,7 +745,20 @@ public final class OsmTrack
sb.append( " \"voicehints\": [\n" ); sb.append( " \"voicehints\": [\n" );
for( VoiceHint hint: voiceHints.list ) 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.deleteCharAt( sb.lastIndexOf( "," ) );
sb.append( " ],\n" ); sb.append( " ],\n" );
@ -729,7 +773,7 @@ public final class OsmTrack
{ {
sb.append( " [" ).append( sp.get(i) ).append( i> 0 ? "],\n" : "]\n" ); sb.append( " [" ).append( sp.get(i) ).append( i> 0 ? "],\n" : "]\n" );
} }
sb.append( " ]\n" ); sb.append( " ],\n" );
} }
} }
else // ... otherwise traditional message list else // ... otherwise traditional message list
@ -741,9 +785,24 @@ public final class OsmTrack
sb.append( " [\"" ).append( m.replaceAll( "\t", "\", \"" ) ).append( "\"],\n" ); sb.append( " [\"" ).append( m.replaceAll( "\t", "\", \"" ) ).append( "\"],\n" );
} }
sb.deleteCharAt( sb.lastIndexOf( "," ) ); 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" ); sb.append( " },\n" );
if ( iternity != null ) if ( iternity != null )
{ {
sb.append( " \"iternity\": [\n" ); sb.append( " \"iternity\": [\n" );

View file

@ -16,6 +16,7 @@ import btools.expressions.BExpressionContextNode;
import btools.expressions.BExpressionContextWay; import btools.expressions.BExpressionContextWay;
import btools.mapaccess.GeometryDecoder; import btools.mapaccess.GeometryDecoder;
import btools.mapaccess.OsmLink; import btools.mapaccess.OsmLink;
import btools.mapaccess.OsmNode;
import btools.util.CheapAngleMeter; import btools.util.CheapAngleMeter;
import btools.util.CheapRuler; import btools.util.CheapRuler;
@ -191,7 +192,9 @@ public final class RoutingContext
public List<OsmNodeNamed> poipoints; public List<OsmNodeNamed> poipoints;
public List<OsmNodeNamed> nogopoints = null; public List<OsmNodeNamed> nogopoints = null;
private List<OsmNodeNamed> nogopoints_all = null; // full list not filtered for wayoints-in-nogos
private List<OsmNodeNamed> keepnogopoints = null; private List<OsmNodeNamed> keepnogopoints = null;
private OsmNodeNamed pendingEndpoint = null;
public Integer startDirection; public Integer startDirection;
public boolean startDirectionValid; public boolean startDirectionValid;
@ -257,14 +260,29 @@ public final class RoutingContext
} }
} }
public void cleanNogolist( List<OsmNodeNamed> 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<OsmNode> waypoints )
{
nogopoints_all = nogopoints;
if ( nogopoints == null ) return; if ( nogopoints == null ) return;
List<OsmNodeNamed> nogos = new ArrayList<OsmNodeNamed>(); List<OsmNodeNamed> nogos = new ArrayList<OsmNodeNamed>();
for( OsmNodeNamed nogo : nogopoints ) for( OsmNodeNamed nogo : nogopoints )
{ {
boolean goodGuy = true; boolean goodGuy = true;
for( OsmNodeNamed wp : waypoints ) for( OsmNode wp : waypoints )
{ {
if ( wp.calcDistance( nogo ) < nogo.radius if ( wp.calcDistance( nogo ) < nogo.radius
&& (!(nogo instanceof OsmNogoPolygon) && (!(nogo instanceof OsmNogoPolygon)
@ -273,7 +291,6 @@ public final class RoutingContext
: ((OsmNogoPolygon)nogo).isOnPolyline(wp.ilon, wp.ilat)))) : ((OsmNogoPolygon)nogo).isOnPolyline(wp.ilon, wp.ilat))))
{ {
goodGuy = false; goodGuy = false;
break;
} }
} }
if ( goodGuy ) nogos.add( nogo ); if ( goodGuy ) nogos.add( nogo );
@ -281,6 +298,31 @@ public final class RoutingContext
nogopoints = nogos.isEmpty() ? null : nogos; nogopoints = nogos.isEmpty() ? null : nogos;
} }
public boolean allInOneNogo( List<OsmNode> 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() public long[] getNogoChecksums()
{ {
long[] cs = new long[3]; long[] cs = new long[3];
@ -297,17 +339,36 @@ public final class RoutingContext
} }
public void setWaypoint( OsmNodeNamed wp, boolean endpoint ) public void setWaypoint( OsmNodeNamed wp, boolean endpoint )
{
setWaypoint( wp, null, endpoint );
}
public void setWaypoint( OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint )
{ {
keepnogopoints = nogopoints; keepnogopoints = nogopoints;
nogopoints = new ArrayList<OsmNodeNamed>(); nogopoints = new ArrayList<OsmNodeNamed>();
nogopoints.add( wp ); nogopoints.add( wp );
if ( keepnogopoints != null ) nogopoints.addAll( keepnogopoints ); if ( keepnogopoints != null ) nogopoints.addAll( keepnogopoints );
isEndpoint = endpoint; 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() public void unsetWaypoint()
{ {
nogopoints = keepnogopoints; nogopoints = keepnogopoints;
pendingEndpoint = null;
isEndpoint = false; isEndpoint = false;
} }

View file

@ -151,9 +151,6 @@ public class RoutingEngine extends Thread
{ {
try try
{ {
// delete nogos with waypoints in them
routingContext.cleanNogolist( waypoints );
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
long startTime0 = startTime; long startTime0 = startTime;
this.maxRunningTime = maxRunningTime; this.maxRunningTime = maxRunningTime;
@ -459,6 +456,29 @@ public class RoutingEngine extends Thread
} }
private OsmTrack searchTrack( MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack nearbyTrack, OsmTrack refTrack ) private OsmTrack searchTrack( MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack nearbyTrack, OsmTrack refTrack )
{
// remove nogos with waypoints inside
try
{
List<OsmNode> wpts2 = new ArrayList<OsmNode>();
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; OsmTrack track = null;
double[] airDistanceCostFactors = new double[]{ routingContext.pass1coefficient, routingContext.pass2coefficient }; double[] airDistanceCostFactors = new double[]{ routingContext.pass1coefficient, routingContext.pass2coefficient };
@ -587,55 +607,27 @@ public class RoutingEngine extends Thread
private OsmPath getStartPath( OsmNode n1, OsmNode n2, MatchedWaypoint mwp, OsmNodeNamed endPos, boolean sameSegmentSearch ) 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 // special case: start+end on same segment
if ( sameSegmentSearch ) if ( p.cost >= 0 && sameSegmentSearch && endPos != null && endPos.radius < 1.5 )
{ {
OsmPath pe = getEndPath( n1, p.getLink(), endPos ); p.treedepth = 0; // hack: mark for the final-check
OsmPath pt = getEndPath( n1, p.getLink(), null );
int costdelta = pt.cost - p.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;
}
} }
return p; 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 try
{ {
routingContext.setWaypoint( wp, false ); routingContext.setWaypoint( wp, sameSegmentSearch ? endPos : null, false );
OsmPath bestPath = null; OsmPath bestPath = null;
OsmLink bestLink = null; OsmLink bestLink = null;
OsmLink startLink = new OsmLink( null, n1 ); OsmLink startLink = new OsmLink( null, n1 );
@ -650,7 +642,7 @@ public class RoutingEngine extends Thread
if ( nextNode == n1 ) continue; // ? if ( nextNode == n1 ) continue; // ?
if ( nextNode != n2 ) continue; // just that link if ( nextNode != n2 ) continue; // just that link
wp.radius = 1e9; wp.radius = 1.5;
OsmPath testPath = routingContext.createPath( startPath, link, null, guideTrack != null ); OsmPath testPath = routingContext.createPath( startPath, link, null, guideTrack != null );
testPath.airdistance = endPos == null ? 0 : nextNode.calcDistance( endPos ); testPath.airdistance = endPos == null ? 0 : nextNode.calcDistance( endPos );
if ( wp.radius < minradius ) if ( wp.radius < minradius )
@ -674,29 +666,15 @@ 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 ) private OsmTrack findTrack( String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc )
{ {
try try
{ {
List<OsmNode> wpts2 = new ArrayList<OsmNode>();
if ( startWp != null ) wpts2.add( startWp.waypoint );
if ( endWp != null ) wpts2.add( endWp.waypoint );
routingContext.cleanNogoList(wpts2);
boolean detailed = guideTrack != null; boolean detailed = guideTrack != null;
resetCache( detailed ); resetCache( detailed );
nodesCache.nodesMap.cleanupMode = detailed ? 0 : ( routingContext.considerTurnRestrictions ? 2 : 1 ); nodesCache.nodesMap.cleanupMode = detailed ? 0 : ( routingContext.considerTurnRestrictions ? 2 : 1 );
@ -704,6 +682,7 @@ public class RoutingEngine extends Thread
} }
finally finally
{ {
routingContext.restoreNogoList();
nodesCache.clean( false ); // clean only non-virgin caches nodesCache.clean( false ); // clean only non-virgin caches
} }
} }
@ -978,13 +957,16 @@ public class RoutingEngine extends Thread
((OsmPath)linkHolder).airdistance = -1; // invalidate the entry in the open set; ((OsmPath)linkHolder).airdistance = -1; // invalidate the entry in the open set;
} }
boolean isBidir = currentLink.isBidirectional(); if ( path.treedepth > 1 )
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); 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 // recheck cutoff before doing expensive stuff
@ -1116,7 +1098,8 @@ public class RoutingEngine extends Thread
OsmLinkHolder dominator = link.getFirstLinkHolder( currentNode ); OsmLinkHolder dominator = link.getFirstLinkHolder( currentNode );
while( !trafficSim && dominator != null ) while( !trafficSim && dominator != null )
{ {
if ( bestPath.definitlyWorseThan( (OsmPath)dominator, routingContext ) ) OsmPath dp = (OsmPath)dominator;
if ( dp.airdistance != -1 && bestPath.definitlyWorseThan( dp, routingContext ) )
{ {
break; break;
} }

View file

@ -158,6 +158,27 @@ public class VoiceHint
default : throw new IllegalArgumentException( "unknown command: " + cmd ); 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() public void calcCommand()
{ {

View file

@ -5,4 +5,5 @@ plugins {
dependencies { dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-codec') implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.1'
} }

View file

@ -14,7 +14,7 @@ public class EncodeDecodeTest
{ {
URL testpurl = this.getClass().getResource( "/dummy.txt" ); URL testpurl = this.getClass().getResource( "/dummy.txt" );
File workingDir = new File(testpurl.getFile()).getParentFile(); 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" ); File lookupFile = new File( profileDir, "lookups.dat" );
// read lookup.dat + trekking.brf // read lookup.dat + trekking.brf

View file

@ -2,15 +2,25 @@ plugins {
id 'application' id 'application'
} }
version = '1.6.1'
application { application {
// Gradles 'application' plugin requires one main class; since we have multiple ones, just specify // 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. // 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 { dependencies {
implementation project(':brouter-util')
implementation project(':brouter-codec') implementation project(':brouter-codec')
implementation project(':brouter-util')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
implementation('junit:junit:4.13')
testImplementation('junit:junit:4.13.1')
} }

View file

@ -17,7 +17,7 @@ public class MapcreatorTest
Assert.assertTrue( "test-osm-map dreieich.osm not found", mapurl != null ); Assert.assertTrue( "test-osm-map dreieich.osm not found", mapurl != null );
File mapFile = new File(mapurl.getFile()); File mapFile = new File(mapurl.getFile());
File workingDir = mapFile.getParentFile(); File workingDir = mapFile.getParentFile();
File profileDir = new File( workingDir, "/../../../misc/profiles2" ); File profileDir = new File( workingDir, "/../../../../misc/profiles2" );
File tmpdir = new File( workingDir, "tmp" ); File tmpdir = new File( workingDir, "tmp" );
tmpdir.mkdir(); tmpdir.mkdir();

View file

@ -3,7 +3,6 @@ plugins {
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-codec') implementation project(':brouter-codec')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')

View file

@ -1,5 +1,5 @@
/** /**
* Proof of concept for delta rd5's * Manage rd5 diff-file creation
* *
* @author ab * @author ab
*/ */
@ -56,10 +56,10 @@ final public class Rd5DiffManager
File specificNewDiffs = new File( newDiffDir, basename ); File specificNewDiffs = new File( newDiffDir, basename );
specificNewDiffs.mkdirs(); specificNewDiffs.mkdirs();
String diffFileName = md5 + ".rd5diff"; String diffFileName = md5 + ".df5";
File diffFile = new File( specificNewDiffs, diffFileName ); File diffFile = new File( specificNewDiffs, diffFileName );
String dummyDiffFileName = md5New + ".rd5diff"; String dummyDiffFileName = md5New + ".df5";
File dummyDiffFile = new File( specificNewDiffs, dummyDiffFileName ); File dummyDiffFile = new File( specificNewDiffs, dummyDiffFileName );
dummyDiffFile.createNewFile(); dummyDiffFile.createNewFile();
@ -73,7 +73,7 @@ final public class Rd5DiffManager
File[] oldDiffs = specificOldDiffs.listFiles(); File[] oldDiffs = specificOldDiffs.listFiles();
for( File od : oldDiffs ) for( File od : oldDiffs )
{ {
if ( !od.getName().endsWith( ".rd5diff" ) ) if ( !od.getName().endsWith( ".df5" ) )
{ {
continue; continue;
} }

View file

@ -1,5 +1,5 @@
/** /**
* Proof of concept for delta rd5's * Calculate, add or merge rd5 delta files
* *
* @author ab * @author ab
*/ */
@ -31,9 +31,9 @@ final public class Rd5DiffTool implements ProgressListener
return; 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] ) ); 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 dis1 = new DataInputStream( new BufferedInputStream( new FileInputStream( f1 ) ) );
DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) ); DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) );
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) ); DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
MCOutputStream mcOut = new MCOutputStream( dos, abBuf1 );
// copy header to outfile // copy header to outfile
long[] fileIndex1 = readFileIndex( dis1, null ); long[] fileIndex1 = readFileIndex( dis1, null );
@ -175,10 +176,6 @@ final public class Rd5DiffTool implements ProgressListener
byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false ); byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false );
byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, false ); byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, false );
if ( ab2 == null )
{
continue; // empty target tile
}
MicroCache mc; MicroCache mc;
if ( Arrays.equals( ab1, ab2 ) ) 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 = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
mc.calcDelta( mc1, mc2 ); 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; bytesDiff += len;
nodesDiff += mc.getSize(); nodesDiff += mc.getSize();
diffedTiles++; diffedTiles++;
@ -244,7 +234,9 @@ final public class Rd5DiffTool implements ProgressListener
*/ */
} }
} }
mcOut.finish();
} }
// write any remaining data to the output file // write any remaining data to the output file
for(;;) for(;;)
{ {
@ -324,10 +316,12 @@ final public class Rd5DiffTool implements ProgressListener
try try
{ {
DataBuffers dataBuffers = new DataBuffers(); DataBuffers dataBuffers = new DataBuffers();
MCInputStream mcIn = new MCInputStream( dis2, dataBuffers );
for ( int subFileIdx = 0; subFileIdx < 25; subFileIdx++ ) for ( int subFileIdx = 0; subFileIdx < 25; subFileIdx++ )
{ {
boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx ); boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx ); // has the basefile data
boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx ); boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx ); // has the *result* data
// boolean hasDataCmp = getTileStart( fileIndexCmp, subFileIdx ) < getTileEnd( fileIndexCmp, subFileIdx ); // 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[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, false );
byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, true ); MicroCache mc2 = mcIn.readMC();
if ( ab2 == null ) int targetSize = posIdx2 == null ? 0 : getPosIdx( posIdx2, tileIdx ) - getPosIdx( posIdx2, tileIdx-1 );
{
continue; // no target tile expected
}
/* int targetSizeCmp = getPosIdx( posIdxCmp, tileIdx ) - getPosIdx( posIdxCmp, tileIdx-1 ); /* int targetSizeCmp = getPosIdx( posIdxCmp, tileIdx ) - getPosIdx( posIdxCmp, tileIdx-1 );
if ( targetSizeCmp != targetSize ) throw new IllegalArgumentException( "target size mismatch: "+ targetSize + "," + targetSizeCmp ); 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 // no-delta shortcut: just copy base data
if ( ab2.length == 0 ) if ( mc2.getSize() == 0 )
{ {
if ( ab1 != null ) if ( ab1 != null )
{ {
dos.write( ab1 ); dos.write( ab1 );
} }
int newTargetSize = ab1 == null ? 0 : ab1.length;
if ( targetSize != newTargetSize )
{
throw new RuntimeException( "size mismatch at " + subFileIdx + "/" + tileIdx + " " + targetSize + "!=" + newTargetSize );
}
continue; continue;
} }
// this is the real delta case (using decode->delta->encode ) // this is the real delta case (using decode->delta->encode )
MicroCache mc1 = createMicroCache( ab1, dataBuffers ); MicroCache mc1 = createMicroCache( ab1, dataBuffers );
MicroCache mc2 = createMicroCache( ab2, dataBuffers );
MicroCache mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 ); MicroCache mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
mc.addDelta( mc1, mc2, false ); 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 ); int len = mc.encodeMicroCache( abBuf1 );
@ -403,8 +408,13 @@ final public class Rd5DiffTool implements ProgressListener
*/ */
dos.write( abBuf1, 0, len ); dos.write( abBuf1, 0, len );
dos.writeInt( Crc32.crc( abBuf1, 0, len ) ^ 2 ); 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 // write any remaining data to the output file
for(;;) for(;;)
@ -529,7 +539,7 @@ final public class Rd5DiffTool implements ProgressListener
DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) ); DataInputStream dis2 = new DataInputStream( new BufferedInputStream( new FileInputStream( f2 ) ) );
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) ); DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
// copy header to outfile // copy subfile-header to outfile
long[] fileIndex1 = readFileIndex( dis1, null ); long[] fileIndex1 = readFileIndex( dis1, null );
long[] fileIndex2 = readFileIndex( dis2, dos ); long[] fileIndex2 = readFileIndex( dis2, dos );
@ -538,51 +548,37 @@ final public class Rd5DiffTool implements ProgressListener
try try
{ {
DataBuffers dataBuffers = new DataBuffers(); 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++ ) for ( int subFileIdx = 0; subFileIdx < 25; subFileIdx++ )
{ {
// copy tile-header to outfile
boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx ); boolean hasData1 = getTileStart( fileIndex1, subFileIdx ) < getTileEnd( fileIndex1, subFileIdx );
boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx ); boolean hasData2 = getTileStart( fileIndex2, subFileIdx ) < getTileEnd( fileIndex2, subFileIdx );
int[] posIdx1 = hasData1 ? readPosIndex( dis1, null ) : null; int[] posIdx1 = hasData1 ? readPosIndex( dis1, null ) : null;
int[] posIdx2 = hasData2 ? readPosIndex( dis2, dos ) : null; int[] posIdx2 = hasData2 ? readPosIndex( dis2, dos ) : null;
for ( int tileIdx = 0; tileIdx < 1024; tileIdx++ ) for ( int tileIdx = 0; tileIdx < 1024; tileIdx++ )
{ {
byte[] ab1 = createMicroCache( posIdx1, tileIdx, dis1, true ); MicroCache mc1 = mcIn1.readMC();
byte[] ab2 = createMicroCache( posIdx2, tileIdx, dis2, true ); MicroCache mc2 = mcIn2.readMC();
if ( ab2 == null ) MicroCache mc;
if ( mc1.getSize() == 0 && mc2.getSize() == 0 )
{ {
continue; // no target tile expected mc = mc1;
} }
else
// no-delta shortcut: just copy base data
if ( ab2.length == 0 )
{ {
if ( ab1 == null ) mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, 0, 0, 32 );
{ mc.addDelta( mc1, mc2, true );
dos.writeInt( 0 );
}
else
{
dos.writeInt( ab1.length );
dos.write( ab1 );
}
continue;
} }
mcOut.writeMC( mc );
// 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 );
} }
mcIn1.finish();
mcIn2.finish();
mcOut.finish();
} }
// write any remaining data to the output file // write any remaining data to the output file
for(;;) 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;
}
}
} }

View file

@ -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!! *****************" );
}
}
}
}

View file

@ -3,33 +3,79 @@ plugins {
} }
android { android {
compileSdkVersion 29 compileSdkVersion 30
defaultConfig { defaultConfig {
applicationId "btools.routingapp" applicationId "btools.routingapp"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 30
versionCode 41 versionCode 41
versionName "1.6.1" 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 { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
debuggable false
if(project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.release
}
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 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 { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation project(':brouter-mapaccess') implementation project(':brouter-mapaccess')
implementation project(':brouter-core') implementation project(':brouter-core')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
implementation project(':brouter-util') implementation project(':brouter-util')
} }

View file

@ -685,8 +685,9 @@ float tx, ty;
updateProgress( "Calculating local checksum.." ); updateProgress( "Calculating local checksum.." );
// first check for a delta file // first check for a delta file
String md5 = Rd5DiffManager.getMD5( fname ); String md5 = Rd5DiffManager.getMD5( fname );
String surlDelta = surlBase + "diff/" + name.replace( ".rd5", "/" + md5 + ".rd5diff" ); String surlDelta = surlBase + "diff/" + name.replace( ".rd5", "/" + md5 + ".df5" );
URL urlDelta = new URL(surlDelta); URL urlDelta = new URL(surlDelta);

View file

@ -5,7 +5,9 @@ import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.StringTokenizer;
import android.os.Bundle; import android.os.Bundle;
import btools.router.OsmNodeNamed; import btools.router.OsmNodeNamed;
@ -16,6 +18,10 @@ import btools.router.RoutingEngine;
public class BRouterWorker 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 baseDir;
public File segmentDir; public File segmentDir;
public String profileName; public String profileName;
@ -65,6 +71,22 @@ public class BRouterWorker
{ {
rc.startDirection = Integer.valueOf( params.getInt( "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<String,String>();
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 readNogos( params ); // add interface provided nogos
RoutingContext.prepareNogoPoints( nogoList ); RoutingContext.prepareNogoPoints( nogoList );
@ -99,20 +121,33 @@ public class BRouterWorker
} }
String format = params.getString("trackFormat"); 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(); OsmTrack track = cr.getFoundTrack();
if ( track != null ) if ( track != null )
{ {
if ( pathToFileResult == null ) if ( pathToFileResult == null )
{ {
if ( writeKml ) return track.formatAsKml(); switch ( writeFromat ) {
return track.formatAsGpx(); 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 try
{ {
if ( writeKml ) track.writeKml(pathToFileResult); switch ( writeFromat ) {
else track.writeGpx(pathToFileResult); 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 ) catch( Exception e )
{ {
@ -193,3 +228,4 @@ public class BRouterWorker
} }
} }
} }

View file

@ -2,19 +2,23 @@ plugins {
id 'application' id 'application'
} }
version = '1.6.1'
application { application {
mainClassName = 'btools.server.BRouter' mainClass.set('btools.server.BRouter')
jar { jar {
manifest { manifest {
attributes "Main-Class": "$mainClassName" attributes "Main-Class": getMainClass()
} }
} }
} }
dependencies { dependencies {
implementation('junit:junit:4.13') testImplementation 'junit:junit:4.13.1'
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-core') implementation project(':brouter-core')
implementation project(':brouter-mapaccess') implementation project(':brouter-mapaccess')
} }

View file

@ -0,0 +1,52 @@
package btools.server;
import java.util.HashMap;
import java.util.Map;
public class IpAccessMonitor
{
private static Object sync = new Object();
private static HashMap<String,Long> ipAccess = new HashMap<String,Long>();
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 );
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 )
{
cleanup( t );
lastCleanup = t;
}
return ipAccess.size();
}
}
private static void cleanup( long t )
{
HashMap<String,Long> newMap = new HashMap<String,Long>(ipAccess.size());
for( Map.Entry<String,Long> e : ipAccess.entrySet() )
{
if ( t - e.getValue().longValue() <= MAX_IDLE )
{
newMap.put( e.getKey(), e.getValue() );
}
}
ipAccess = newMap;
}
}

View file

@ -61,7 +61,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
private static DateFormat tsFormat = new SimpleDateFormat( "dd.MM.yy HH:mm", new Locale( "en", "US" ) ); 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 ) synchronized( tsFormat )
{ {
@ -73,15 +73,21 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
{ {
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
// first line
String getline = null;
String sessionInfo = null;
String sIp = null;
try try
{ {
br = new BufferedReader( new InputStreamReader( clientSocket.getInputStream() , "UTF-8") ); br = new BufferedReader( new InputStreamReader( clientSocket.getInputStream() , "UTF-8") );
bw = new BufferedWriter( new OutputStreamWriter( clientSocket.getOutputStream(), "UTF-8" ) ); bw = new BufferedWriter( new OutputStreamWriter( clientSocket.getOutputStream(), "UTF-8" ) );
// first line
String getline = null;
String agent = null; String agent = null;
String encodings = null; String encodings = null;
String xff = null; // X-Forwarded-For
String referer = null;
// more headers until first empty line // more headers until first empty line
for(;;) for(;;)
@ -102,16 +108,40 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
{ {
getline = line; 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() );
}
if ( line.startsWith( "Referer: " ) )
{
referer = line.substring( "Referer: ".length() );
}
if ( line.startsWith( "Referrer: " ) )
{
referer = line.substring( "Referrer: ".length() );
} }
} }
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" ); String excludedAgents = System.getProperty( "excludedAgents" );
if ( agent != null && excludedAgents != null ) if ( agent != null && excludedAgents != null )
{ {
@ -128,6 +158,17 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
} }
} }
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") ) if ( getline.startsWith("GET /favicon.ico") )
{ {
writeHttpHeader( bw, HTTP_STATUS_NOT_FOUND ); writeHttpHeader( bw, HTTP_STATUS_NOT_FOUND );
@ -143,9 +184,6 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
return; return;
} }
InetAddress ip = clientSocket.getInetAddress();
System.out.println( formattedTimestamp() + " ip=" + (ip==null ? "null" : ip.toString() ) + " -> " + getline );
String url = getline.split(" ")[1]; String url = getline.split(" ")[1];
HashMap<String,String> params = getUrlParams(url); HashMap<String,String> params = getUrlParams(url);
@ -280,8 +318,12 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
{ {
threadPoolSync.notifyAll(); 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 public static void main(String[] args) throws Exception
{ {
@ -355,13 +397,18 @@ public class RouteServer extends Thread implements Comparable<RouteServer>
{ {
threadPoolSync.wait( maxWaitTime ); threadPoolSync.wait( maxWaitTime );
} }
long t = System.currentTimeMillis();
System.out.println( formattedTimeStamp(t) + " contention! ms waited " + (t - server.starttime) );
} }
cleanupThreadQueue( threadQueue ); cleanupThreadQueue( threadQueue );
if ( threadQueue.size() >= maxthreads ) if ( threadQueue.size() >= maxthreads )
{ {
if ( debug ) System.out.println( "stopping oldest thread..." ); if ( debug ) System.out.println( "stopping oldest thread..." );
// no way... stop the 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) );
} }
} }

View file

@ -450,6 +450,8 @@ public class SuspectManager extends Thread
String url5 = "https://tyrasd.github.io/latest-changes/#16/" + dlat + "/" + dlon; 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 ) if ( message != null )
{ {
bw.write( "<strong>" + message + "</strong><br><br>\n" ); bw.write( "<strong>" + message + "</strong><br><br>\n" );
@ -459,6 +461,7 @@ public class SuspectManager extends Thread
bw.write( "<a href=\"" + url3 + "\">Open in JOSM (via remote control)</a><br><br>\n" ); bw.write( "<a href=\"" + url3 + "\">Open in JOSM (via remote control)</a><br><br>\n" );
bw.write( "Overpass: <a href=\"" + url4a + "\">minus one week</a> &nbsp;&nbsp; <a href=\"" + url4b + "\">node context</a><br><br>\n" ); bw.write( "Overpass: <a href=\"" + url4a + "\">minus one week</a> &nbsp;&nbsp; <a href=\"" + url4b + "\">node context</a><br><br>\n" );
bw.write( "<a href=\"" + url5 + "\">Open in Latest-Changes / last week</a><br><br>\n" ); bw.write( "<a href=\"" + url5 + "\">Open in Latest-Changes / last week</a><br><br>\n" );
bw.write( "<a href=\"" + url6 + "\">Current Sentinel-2 imagary</a><br><br>\n" );
bw.write( "<br>\n" ); bw.write( "<br>\n" );
if ( isFixed( id, suspects.timestamp ) ) if ( isFixed( id, suspects.timestamp ) )
{ {

View file

@ -20,7 +20,7 @@ public class IntegrityCheckTest
File resultfile = new File( resulturl.getFile() ); File resultfile = new File( resulturl.getFile() );
workingDir = resultfile.getParentFile(); 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(); File[] files = segmentDir.listFiles();
for ( File f : files ) for ( File f : files )

View file

@ -61,13 +61,16 @@ public class RouterTest
wplist.add( n ); wplist.add( n );
RoutingContext rctx = new RoutingContext(); RoutingContext rctx = new RoutingContext();
rctx.localFunction = wd + "/../../../misc/profiles2/trekking.brf"; rctx.localFunction = wd + "/../../../../misc/profiles2/trekking.brf";
// c.setAlternativeIdx( 1 ); // c.setAlternativeIdx( 1 );
RoutingEngine re = new RoutingEngine( RoutingEngine re = new RoutingEngine(
wd + "/" + trackname, wd + "/" + trackname,
wd + "/" + trackname, wd + "/" + trackname,
new File ( wd, "/../../../brouter-map-creator/target/test-classes/tmp/segments"), wplist, rctx ); new File ( wd, "/../../../../brouter-map-creator/build/resources/test/tmp/segments"),
wplist,
rctx );
re.doRun( 0 ); re.doRun( 0 );
return re.getErrorMessage(); return re.getErrorMessage();

View file

@ -3,5 +3,5 @@ plugins {
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation('junit:junit:4.13.1')
} }

View file

@ -3,12 +3,11 @@
buildscript { buildscript {
repositories { repositories {
mavenCentral()
google() google()
jcenter()
} }
dependencies { 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 // NOTE: Do not place your application dependencies here; they belong
@ -18,9 +17,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
mavenCentral()
google() google()
jcenter()
} }
} }

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

View file

@ -27,7 +27,7 @@ assign f_recup = 400 # %f_recup% | Newton | number
assign p_standby = 250 # %p_standby% | Watt | number assign p_standby = 250 # %p_standby% | Watt | number
# Turn instructions settings # 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 # Technical parameters
assign pass1coefficient = 1.3 assign pass1coefficient = 1.3

View file

@ -16,7 +16,7 @@
---context:global # following code refers to global config ---context:global # following code refers to global config
# to generate turn instructions, adapt the mode by need # 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 # Use the following switches to change behaviour
# (1=yes, 0=no): # (1=yes, 0=no):
@ -136,15 +136,15 @@ assign onewaypenalty =
assign surfacepenalty assign surfacepenalty
switch highway=unclassified|service|track|road|path|footway|cycleway switch highway=unclassified|service|track|road|path|footway|cycleway
switch surface=asphalt 0 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 concrete=plates 1 # Betonplattenwege
switch surface=concrete|paving_stones|wood|metal 0.7 # Beton, Pflastersteine, Holz, Metall switch surface=concrete|paving_stones|wood|metal 0.7 # Beton, Pflastersteine, Holz, Metall
switch surface=cobblestone 2 # Kopfsteinpflaster switch surface=cobblestone 2 # Kopfsteinpflaster
switch concrete=lanes 3 # Betonspurplatten 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=sett|grass_paver 5 # behauene Pflastersteine, Rasengittersteine
switch surface=gravel|sand|pebblestone|unpaved 10 # Schotter, Sand, Kies, unbefestigt 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 # if "surface" is not defined, for service and road asphalt is probable
switch surface= switch surface=
switch highway=service|road 0.1 switch highway=service|road 0.1
@ -331,6 +331,8 @@ assign classifiermask
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 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 ---context:node # following code refers to node tags
@ -369,4 +371,4 @@ assign initialcost
0 0
switch footaccess switch footaccess
300 300
1000000 1000000

View file

@ -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 assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
# Turn instructions settings # 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 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 assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
@ -62,6 +62,9 @@ assign isunpaved not or surface= or ispaved or surface=fine_gravel surface=cobbl
assign turncost = if junction=roundabout then 0 assign turncost = if junction=roundabout then 0
else 90 else 90
assign initialclassifier =
if route=ferry then 1
else 0
assign initialcost switch route=ferry 10000 0 assign initialcost switch route=ferry 10000 0
@ -257,6 +260,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 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 ---context:node # following code refers to node tags

View file

@ -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 turncost switch or shortest_way is_ldhr 0 turncost_value #v1.5
assign initialclassifier =
if route=ferry then 1
else 0
assign initialcost assign initialcost
switch route=ferry 10000 switch route=ferry 10000
@ -233,7 +237,10 @@ assign costfactor
switch highway=tertiary|tertiary_link|unclassified switch ismuddy 2.0 switch iswet switch issidewalk 1.4 1.7 switch highway=tertiary|tertiary_link|unclassified switch ismuddy 2.0 switch iswet switch issidewalk 1.4 1.7
switch issidewalk 1.7 2.0 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 ---context:node # following code refers to node tags

View file

@ -27,10 +27,10 @@ highway;0000079637 tertiary_link
highway;0000070238 construction highway;0000070238 construction
highway;0000058257 bridleway highway;0000058257 bridleway
highway;0000039003 platform highway;0000039003 platform
highway;0000037192 proposed highway;0000037192 proposed planned virtual
highway;0000010307 raceway highway;0000010307 raceway
highway;0000003152 rest_area highway;0000003152 rest_area
highway;0000002942 abandoned highway;0000002942 abandoned disused razed demolished dismantled
highway;0000002631 services highway;0000002631 services
highway;0000002133 corridor highway;0000002133 corridor
highway;0000002093 crossing highway;0000002093 crossing
@ -227,7 +227,7 @@ cycleway;0000000892 left
cycleway;0000000399 street cycleway;0000000399 street
cycleway;0000000344 shoulder cycleway;0000000344 shoulder
cycleway;0000000326 designated cycleway;0000000326 designated
cycleway;0000000247 proposed cycleway;0000000247 proposed planned virtual
cycleway;0000000224 cyclestreet cycleway;0000000224 cyclestreet
cycleway;0000000172 path cycleway;0000000172 path
cycleway;0000000154 sidewalk cycleway;0000000154 sidewalk

View file

@ -16,13 +16,17 @@ assign uphillcutoff 0
assign validForBikes 1 assign validForBikes 1
assign validForCars 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 ---context:way # following code refers to way-tags
assign turncost = if junction=roundabout then 0 assign turncost = if junction=roundabout then 0
else 90 else 90
assign initialclassifier =
if route=ferry then 1
else 0
assign initialcost switch route=ferry 20000 0 assign initialcost switch route=ferry 20000 0
@ -140,6 +144,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 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 ---context:node # following code refers to node tags

View file

@ -7,7 +7,7 @@ assign downhillcutoff 1.5
assign uphillcost 0 assign uphillcost 0
assign uphillcutoff 1.5 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 assign validForFoot 1
---context:way # following code refers to way-tags ---context:way # following code refers to way-tags
@ -17,6 +17,10 @@ assign nodeaccessgranted or any_cycleroute lcn=yes
assign turncost 0 assign turncost 0
assign initialclassifier =
if route=ferry then 1
else 0
assign initialcost switch route=ferry 10000 0 assign initialcost switch route=ferry 10000 0
# #
@ -110,6 +114,9 @@ assign classifiermask add multiply isroundabout 4
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 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 ---context:node # following code refers to node tags
assign defaultaccess assign defaultaccess

View file

@ -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 assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
# Turn instructions settings # 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 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 assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set to "false" to avoid generating special turning instructions for roundabouts | boolean
@ -301,6 +301,8 @@ assign classifiermask add isbadoneway
add multiply islinktype 8 add multiply islinktype 8
multiply isgoodforcars 16 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 ---context:node # following code refers to node tags

View file

@ -1,443 +1,460 @@
# #
# Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de # Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de
---context:global ---context:global
assign totalMass = 90 #Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg assign no_steps = false # %no_steps% | keine Stufen, das Liegerad soll nicht getragen werden müssen | boolean
assign maxSpeed = 60 #Maximale Geschwindigkeit ab der der Fahrer bremst in km/h assign no_wrong_oneway = false # %no_wrong oneway% | keine Einbahnstrasse in falsche Richtung, auch nicht schiebend | boolean
assign S_C_x = 0.23 #Effektive Stirnfläche in m²
assign C_r = 0.004 #Rollwiderstand 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 bikerPower = 125 #Dauerleistung in Watt 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 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 avoid_cycleways = 3 # %avoid_cycleways% | Radwege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 3 = Standard, 10 = stark vermeiden | number
assign consider_smoothness_tags = true # mit false kann die kanne die Auswertung der smoothness tags abgeschaltet werden assign avoid_elevation = 5 # %avoid_elevation% | Hohenmeter vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
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 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 turnInstructionMode 1 #Ausgabe von Abiegehinweise 0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style assign totalMass = 90 # %totalMass% | Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg, für Fahrtzeitschätzung | number
assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert assign maxSpeed = 60 # Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert assign S_C_x = 0.23 # Effektive Stirnfläche in m²
assign C_r = 0.004 # Rollwiderstand
assign downhillcost 80 # Kosten für die Höhenmeter bergab assign bikerPower = 125 # %bikerPower% | Dauerleistung in Watt, für Fahrtzeitschätzung| number
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 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 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 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 pass1coefficient 2.5 # Berechnugskoeffizient für erste schnelle Berechnung assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
# sinnvolle Werte für den ersten Koeffizienten: assign avoidmr2 multiply 0.04 multiply avoid_main_roads avoid_main_roads
# 1 exakte Berechnung beim ersten Durchlauf assign avoidsr multiply 0.2 avoid_small_roads
# umso größer die Werte umso schneller und ungenauer die erste Berechnung assign avoidbw multiply 0.125 avoid_bad_ways
# sinnvolle Werte für den zweiten Koeffizienten: assign avoid_ele multiply avoid_elevation 0.2
# 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 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
# 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 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 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 validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
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 considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
assign lmc switch low_memory_cutoff 10000 0 assign pass1coefficient 2.5 # Berechnugskoeffizient für erste schnelle Berechnung
---context:way assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
# sinnvolle Werte für den ersten Koeffizienten:
# Parameter für die Wege # 1 exakte Berechnung beim ersten Durchlauf
#zusätzliche Kosten in Meter für jeden Streckenabschnitt # umso größer die Werte umso schneller und ungenauer die erste Berechnung
# sinnvolle Werte für den zweiten Koeffizienten:
assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes # 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
assign nodeaccessgranted or any_cycleroute lcn=yes # -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
assign cycleway # 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.
or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
assign footway assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
or highway=footway and highway=path foot=designated|yes 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 turncost ---context:way
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 # Parameter für die Wege
#zusätzliche Kosten in Meter für jeden Streckenabschnitt
assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
switch route=ferry 2 assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
switch highway=steps 3 assign nodeaccessgranted or any_cycleroute lcn=yes
switch cycleway 4
switch footway 5 assign cycleway
1 or highway=cycleway and highway=path|footway|pedestrian bicycle=designated|yes
assign initialcost assign footway
switch route=ferry 10000 # Kosten wenn eine Fähre verwendet wird or highway=footway|pedestrian and highway=path foot=designated|yes
switch highway=steps 1000 # Kosten für Stufen
switch cycleway 100 # Kosten für Radwege assign turncost
switch footway 1000 # Kosten für Fußwege switch junction=roundabout 0
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
# Kosten ab hier als Meter für jeden tatsächlichen Meter assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
switch route=ferry 2
assign oneway switch highway=steps 3
switch oneway= switch cycleway 4
junction=roundabout switch footway 5
or oneway=yes or oneway=true oneway=1 1
assign onewaypenalty assign initialcost
switch switch reversedirection=yes oneway oneway=-1 switch route=ferry 10000 # Kosten wenn eine Fähre verwendet wird
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 highway=steps switch no_steps 1000000 dismount_cost # Kosten für Stufen
switch or highway=primary highway=primary_link add lmc 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung switch cycleway multiply 11.1111112 multiply avoid_cycleways avoid_cycleways # Kosten für Radwege
switch or highway=secondary highway=secondary_link add lmc 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung switch footway dismount_cost # Kosten für Fußwege
switch or highway=tertiary highway=tertiary_link add lmc 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung 0
20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
0.0 # Kosten ab hier als Meter für jeden tatsächlichen Meter
assign defaultaccess assign oneway
switch access= switch oneway=
not motorroad=yes junction=roundabout
switch or access=private access=no or oneway=yes or oneway=true oneway=1
0
1 assign onewaypenalty
switch switch reversedirection=yes oneway oneway=-1
assign bikeaccess 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
or any_cycleroute switch no_wrong_oneway 10000
switch bicycle= switch or highway=primary highway=primary_link 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
switch bicycle_road=yes switch or highway=secondary highway=secondary_link 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
1 switch or highway=tertiary highway=tertiary_link 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
switch vehicle= 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
defaultaccess 0.0
switch or vehicle=private vehicle=no
0 assign defaultaccess
1 switch access=
not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount not motorroad=yes
switch or access=private access=no
0
assign footaccess 1
or bikeaccess
or and bicycle=dismount ignore_bicycle_no assign bikeaccess
switch foot= or any_cycleroute
defaultaccess switch bicycle=
not or foot=private foot=no switch vehicle=
defaultaccess
assign accesspenalty switch or vehicle=private vehicle=no
switch bikeaccess 0
0 1
switch footaccess not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
10 #Zusatzkosten fürs Schieben
10000 #Zusatzkosten für gesperrte oder private Wege
assign footaccess
assign maxspeed_forward or bikeaccess
switch maxspeed:forward=50 50 or and bicycle=dismount ignore_bicycle_no
switch maxspeed:forward=30 30 switch foot=
switch maxspeed:forward=10 10 defaultaccess
switch maxspeed:forward=20 20 not or foot=private foot=no
switch maxspeed:forward=40 40
switch maxspeed:forward=60 60 assign accesspenalty
switch maxspeed:forward=70 70 switch bikeaccess
switch maxspeed:forward=80 80 0
switch maxspeed:forward=90 90 switch footaccess
switch maxspeed:forward=100 100 10 #Zusatzkosten fürs Schieben
switch maxspeed:forward=110 110 10000 #Zusatzkosten für gesperrte oder private Wege
switch maxspeed:forward=120 120
switch maxspeed:forward=130 130 assign maxspeed_forward
switch maxspeed:forward=urban 50 switch maxspeed:forward=50 50
switch maxspeed:forward=rural 100 switch maxspeed:forward=30 30
0 switch maxspeed:forward=10 10
switch maxspeed:forward=20 20
assign maxspeed_backward switch maxspeed:forward=40 40
switch maxspeed:backward=50 50 switch maxspeed:forward=60 60
switch maxspeed:backward=30 30 switch maxspeed:forward=70 70
switch maxspeed:backward=10 10 switch maxspeed:forward=80 80
switch maxspeed:backward=20 20 switch maxspeed:forward=90 90
switch maxspeed:backward=40 40 switch maxspeed:forward=100 100
switch maxspeed:backward=60 60 switch maxspeed:forward=110 110
switch maxspeed:backward=70 70 switch maxspeed:forward=120 120
switch maxspeed:backward=80 80 switch maxspeed:forward=130 130
switch maxspeed:backward=90 90 switch maxspeed:forward=urban 50
switch maxspeed:backward=100 100 switch maxspeed:forward=rural 100
switch maxspeed:backward=110 110 0
switch maxspeed:backward=120 120
switch maxspeed:backward=130 130 assign maxspeed_backward
switch maxspeed:backward=urban 50 switch maxspeed:backward=50 50
switch maxspeed:backward=rural 100 switch maxspeed:backward=30 30
0 switch maxspeed:backward=10 10
switch maxspeed:backward=20 20
assign maxspeed switch maxspeed:backward=40 40
switch and reversedirection=yes maxspeed_backward maxspeed_backward switch maxspeed:backward=60 60
switch and not reversedirection=yes maxspeed_forward maxspeed_forward switch maxspeed:backward=70 70
switch maxspeed=50 50 switch maxspeed:backward=80 80
switch maxspeed=30 30 switch maxspeed:backward=90 90
switch maxspeed=10 10 switch maxspeed:backward=100 100
switch maxspeed=20 20 switch maxspeed:backward=110 110
switch maxspeed=40 40 switch maxspeed:backward=120 120
switch maxspeed=60 60 switch maxspeed:backward=130 130
switch maxspeed=70 70 switch maxspeed:backward=urban 50
switch maxspeed=80 80 switch maxspeed:backward=rural 100
switch maxspeed=90 90 0
switch maxspeed=100 100
switch maxspeed=110 110 assign maxspeed
switch maxspeed=120 120 switch and reversedirection=yes maxspeed_backward maxspeed_backward
switch maxspeed=130 130 switch and not reversedirection=yes maxspeed_forward maxspeed_forward
switch maxspeed=urban 50 switch maxspeed=50 50
switch maxspeed=rural 100 switch maxspeed=30 30
999 switch maxspeed=10 10
switch maxspeed=20 20
switch maxspeed=40 40
assign downspeedpenalty switch maxspeed=60 60
switch equal maxspeed 10 4 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle switch maxspeed=70 70
switch equal maxspeed 20 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle switch maxspeed=80 80
switch equal maxspeed 30 0.7 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle switch maxspeed=90 90
switch equal maxspeed 40 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle switch maxspeed=100 100
switch equal maxspeed 50 0.2 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle switch maxspeed=110 110
0 switch maxspeed=120 120
switch maxspeed=130 130
assign flatspeedpenalty switch maxspeed=urban 50
switch equal maxspeed 10 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene switch maxspeed=rural 100
switch equal maxspeed 20 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene 999
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 assign downspeedpenalty
0 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
assign upspeedpenalty switch equal maxspeed 30 0.7 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen switch equal maxspeed 40 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen switch equal maxspeed 50 0.2 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen 0
0
assign flatspeedpenalty
switch equal maxspeed 10 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
assign surfacepenalty switch equal maxspeed 20 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
add switch embedded_rails=tram|yes|rail 10 # Zusatzkosten bei Schienen in der Fahrbahn switch equal maxspeed 30 0.15 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
0 switch equal maxspeed 40 0.12 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h in der Ebene
switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
switch concrete=plates 1 # Zusatzkosten für Betonplattenwege 0
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 assign upspeedpenalty
switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 4 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
switch surface=gravel|sand|pebblestone add lmc 10 #Zusatzkosten für Schotter, Sand oder Kies switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
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 switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
0 0
assign smoothnesspenalty
switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen assign surfacepenalty
switch smoothness=intermediate|medium 0.2 #Zusatzkosten für mittelmäßige Oberflächen add switch embedded_rails=tram|yes|rail 10 # Zusatzkosten bei Schienen in der Fahrbahn
switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen 0
switch smoothness=robust_wheels|bad add lmc 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen multiply avoidbw
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 switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
0 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
assign costfactor 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
# dieser Abschnitt ist für die Kosten in der Ebene 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
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 assign smoothnesspenalty
multiply avoidbw
min 9999 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
add onewaypenalty switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
add accesspenalty switch smoothness=robust_wheels|bad 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
add surfacepenalty 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
add switch consider_smoothness_tags smoothnesspenalty 0 0
add flatspeedpenalty
switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen assign costfactor
switch route=ferry 10.67 # Kosten für Fähren
switch highway=trunk|trunk_link 5 # Kosten für eine autobahnänliche Straße # dieser Abschnitt ist für die Kosten in der Ebene
switch highway=primary|primary_link 2 # Kosten für Bundesstraßen
switch highway=secondary|secondary_link 1 # Kosten für Landstraßen switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
switch highway=tertiary|tertiary_link 1 # Kosten für Kreisstraßen switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
switch highway=unclassified 1 # Kosten für Verbindungsstraßen
switch highway=residential|service 1.2 # Kosten für Wohn- und Zufahrtsstraßen min 9999
switch highway=track max 1
switch tracktype=grade1 1.2 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
switch tracktype=grade2 7 # Kosten für geschotterte Feldwege add onewaypenalty
switch tracktype=grade3 add lmc 40 # Kosten für Feldwege mit weichem Untergrund add accesspenalty
switch tracktype=grade4 add lmc 50 # Kosten für unbefestigte Feldwege add max surfacepenalty smoothnesspenalty
switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege add flatspeedpenalty
add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
switch cycleway 1.3 # Kosten für Fahrradwege max 1
switch ( or highway=living_street living_street=yes ) 4 # Kosten für Spielstraßen switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
switch highway=road 7 # Kosten für noch nicht genauer beschriebene Straße switch route=ferry 10.67 # Kosten für Fähren
switch footway 15 # Kosten für Fußwege switch highway=trunk|trunk_link add 1 multiply avoidmr2 4 # Kosten für eine autobahnänliche Straße
switch highway=pedestrian 20 # Kosten für Gehwege switch highway=primary|primary_link add 0.7 multiply avoidmr2 1.3 # Kosten für Bundesstraßen
switch highway=steps 30 # Kosten für Stufen switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
switch highway=path switch highway=tertiary|tertiary_link add 0.7 multiply avoidsr 0.3 # Kosten für Kreisstraßen
switch surface= add lmc 40 # Kosten für Pfade ohne Oberflächenangabe switch highway=unclassified add 0.7 multiply avoidsr 0.3 # Kosten für Verbindungsstraßen
1.3 # Kosten für Pfade mit Oberflächenangabe switch highway=residential|service add 0.7 multiply avoidsr 0.5 # Kosten für Wohn- und Zufahrtsstraßen
switch highway=bridleway add lmc 80 # Kosten für Reitwege switch highway=track
add lmc 20 # Kosten für sonstige Wege 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
assign uphillcostfactor switch tracktype=grade3 multiply avoidbw 40 # Kosten für Feldwege mit weichem Untergrund
switch tracktype=grade4 multiply avoidbw 50 # Kosten für unbefestigte Feldwege
# dieser Abschnitt ist für die Kosten bei Anstiegen switch tracktype=grade5 multiply avoidbw 50 # Kosten für kaum erkennbare Feldwege
# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen 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 and highway= not route=ferry 10000 switch cycleway add 0.58 multiply avoid_cycleways 0.24 # Kosten für Fahrradwege
switch or highway=proposed highway=abandoned 10000 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
min 9999 switch footway 20 # Kosten für Fußwege
switch highway=steps 30 # Kosten für Stufen
add upspeedpenalty switch highway=path
add onewaypenalty switch surface= multiply avoidbw 40 # Kosten für Pfade ohne Oberflächenangabe
add accesspenalty multiply avoidsr add 0.58 multiply avoid_cycleways 0.24 # Kosten für Pfade mit Oberflächenangabe
add switch consider_smoothness_tags smoothnesspenalty 0 switch highway=bridleway multiply avoidbw 80 # Kosten für Reitwege
add surfacepenalty 20 # Kosten für sonstige Wege
switch highway=motorway|motorway_link 10000 assign uphillcostfactor
switch route=ferry 10.67
switch highway=trunk|trunk_link 7 # dieser Abschnitt ist für die Kosten bei Anstiegen
switch highway=primary|primary_link 3 # da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
switch highway=secondary|secondary_link 1.2
switch highway=tertiary|tertiary_link 1 switch and highway= not route=ferry 10000
switch highway=unclassified 1 switch or highway=proposed highway=abandoned 10000
switch highway=residential|service 1
switch highway=track min 9999
switch tracktype=grade1 1 max 1
switch tracktype=grade2 3
switch tracktype=grade3 add lmc 40 add onewaypenalty
switch tracktype=grade4 add lmc 50 add accesspenalty
switch tracktype=grade5 add lmc 50 add max surfacepenalty smoothnesspenalty
add lmc 20 add upspeedpenalty
switch cycleway 1 max 1
switch ( or highway=living_street living_street=yes ) 2.5 switch highway=motorway|motorway_link 10000
switch highway=road 5 switch route=ferry 10.67
switch footway 15 switch highway=trunk|trunk_link add 1 multiply avoidmr2 6
switch highway=pedestrian 20 switch highway=primary|primary_link add 0.7 multiply avoidmr2 2.3
switch highway=steps 30 switch highway=secondary|secondary_link add 0.7 multiply avoidmr2 0.5
switch highway=path switch highway=tertiary|tertiary_link 1
switch surface= add lmc 30 switch highway=unclassified 1
1 switch highway=residential|service add 0.7 multiply avoidsr 0.3
switch highway=bridleway add lmc 80 switch highway=track
add lmc 20 switch tracktype=grade1 add 0.7 multiply avoidsr 0.3
switch tracktype=grade2 multiply avoidbw add 1 multiply avoidsr 2
assign downhillcostfactor switch tracktype=grade3 multiply avoidbw 40
switch tracktype=grade4 multiply avoidbw 50
# dieser Abschnitt ist für die Kosten bei Gefälle switch tracktype=grade5 multiply avoidbw 50
# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen switch surface= multiply avoidbw 20
add 0.7 multiply avoidsr 0.3
switch and highway= not route=ferry 10000 switch cycleway add 0.28 multiply avoid_cycleways 0.24
switch or highway=proposed highway=abandoned 10000 switch highway=living_street add 1 multiply avoidsr 1.5
switch highway=road add 4 multiply avoidsr 6
min 9999 switch footway 30
switch highway=steps 40
add downspeedpenalty switch highway=path
add onewaypenalty switch surface= multiply avoidbw 40
add accesspenalty multiply avoidsr add 0.28 multiply avoid_cycleways 0.24
add switch consider_smoothness_tags smoothnesspenalty 0 switch highway=bridleway multiply avoidbw 80
add surfacepenalty 20
switch highway=motorway|motorway_link 10000 assign downhillcostfactor
switch route=ferry 10.67
switch highway=trunk|trunk_link 3 # dieser Abschnitt ist für die Kosten bei Gefälle
switch highway=primary|primary_link 2 # da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
switch highway=secondary|secondary_link 1
switch highway=tertiary|tertiary_link 1 switch and highway= not route=ferry 10000
switch highway=unclassified 1.2 switch or highway=proposed highway=abandoned 10000
switch highway=residential|service 2
switch highway=track min 9999
switch tracktype=grade1 2 max 1
switch tracktype=grade2 8
switch tracktype=grade3 add lmc 40 add downspeedpenalty
switch tracktype=grade4 add lmc 50 add onewaypenalty
switch tracktype=grade5 add lmc 50 add accesspenalty
add lmc 20 add max smoothnesspenalty surfacepenalty
switch cycleway 2 max 1
switch ( or highway=living_street living_street=yes ) 8 switch highway=motorway|motorway_link 10000
switch highway=road 10 switch route=ferry 10.67
switch footway 20 switch highway=trunk|trunk_link add 1 multiply avoidmr2 2
switch highway=pedestrian 30 switch highway=primary|primary_link add 0.7 multiply avoidmr2 1.3
switch highway=steps 40 switch highway=secondary|secondary_link 1
switch highway=path switch highway=tertiary|tertiary_link add 0.5 multiply avoidsr 0.5
switch surface= add lmc 40 switch highway=unclassified add 0.6 multiply avoidsr 0.6
2 switch highway=residential|service add 1 multiply avoidsr 1
switch highway=bridleway add lmc 80 switch highway=track
add lmc 20 switch tracktype=grade1 add 1 multiply avoidsr 1
switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 4
switch tracktype=grade3 multiply avoidbw 40
# hier kommen Variablen die zur Generierung der Abiegehinweise benötigt werden switch tracktype=grade4 multiply avoidbw 50
switch tracktype=grade5 multiply avoidbw 50
assign priorityclassifier = switch surface= multiply avoidbw 20
add 1 multiply avoidsr 1
if ( highway=motorway ) then 30 switch cycleway add 0.5 multiply avoid_cycleways 0.5
else if ( highway=motorway_link ) then 29 switch highway=living_street add 2 multiply avoidsr 6
else if ( highway=trunk ) then 28 switch highway=road add 4 multiply avoidsr 6
else if ( highway=trunk_link ) then 27 switch footway 30
else if ( highway=primary ) then 26 switch highway=steps 40
else if ( highway=primary_link ) then 25 switch highway=path
else if ( highway=secondary ) then 24 switch surface= multiply avoidbw 40
else if ( highway=secondary_link ) then 23 multiply avoidsr add 0.5 multiply avoid_cycleways 0.5
else if ( highway=tertiary ) then 22 switch highway=bridleway multiply avoidbw 80
else if ( highway=tertiary_link ) then 21 20
else if ( highway=unclassified ) then 20
else if ( or highway=residential|living_street living_street=yes ) then 6
else if ( highway=service ) then 6 # hier kommen Variablen die zur Generierung der Abbiegehinweise benötigt werden
else if ( highway=cycleway ) then 6
else if ( or bicycle=designated bicycle_road=yes ) then 6 assign priorityclassifier =
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
else if ( highway=bridleway|road|path|footway ) then 4 if ( highway=motorway ) then 30
else if ( highway=steps ) then 2 else if ( highway=motorway_link ) then 29
else if ( highway=pedestrian ) then 2 else if ( highway=trunk ) then 28
else 0 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
assign isbadoneway = not equal onewaypenalty 0 else if ( highway=secondary_link ) then 23
assign isgoodoneway = if reversedirection=yes then oneway=-1 else if ( highway=tertiary ) then 22
else if oneway= then junction=roundabout else oneway=yes|true|1 else if ( highway=tertiary_link ) then 21
assign isroundabout = junction=roundabout else if ( highway=unclassified ) then 20
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link else if ( highway=residential|living_street ) then 6
assign isgoodforcars = if greater priorityclassifier 6 then true else if ( highway=service ) then 6
else if ( or highway=residential|living_street|service living_street=yes ) then true else if ( highway=cycleway ) then 6
else if ( and highway=track tracktype=grade1 ) then true else if ( bicycle=designated ) then 6
else false else if ( highway=track ) then if tracktype=grade1 then 6 else 4
else if ( highway=bridleway|road|path|footway ) then 4
assign classifiermask add isbadoneway else if ( highway=steps ) then 2
add multiply isgoodoneway 2 else if ( highway=pedestrian ) then 2
add multiply isroundabout 4 else 0
add multiply islinktype 8
multiply isgoodforcars 16
assign isbadoneway = not equal onewaypenalty 0
assign isgoodoneway = if reversedirection=yes then oneway=-1
---context:node # following code refers to node tags else if oneway= then junction=roundabout else oneway=yes|true|1
assign isroundabout = junction=roundabout
# Parameter für Knotenpunkte assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
# Kosten an Knotenpunkten in Meter 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
assign defaultaccess else false
switch access=
1 # add default barrier restrictions here! assign classifiermask add isbadoneway
switch or access=private access=no add multiply isgoodoneway 2
0 add multiply isroundabout 4
1 add multiply islinktype 8
multiply isgoodforcars 16
assign bikeaccess
or nodeaccessgranted=yes
switch bicycle=
switch vehicle= ---context:node # following code refers to node tags
defaultaccess
switch or vehicle=private vehicle=no # Parameter für Knotenpunkte
0 # Kosten an Knotenpunkten in Meter
1
switch or bicycle=private or and not or highway=crossing ignore_bicycle_no bicycle=no bicycle=dismount
0 assign defaultaccess
1 switch access=
1 # add default barrier restrictions here!
assign footaccess switch or access=private access=no
or bicycle=dismount 0
switch foot= 1
defaultaccess
switch or foot=private foot=no assign bikeaccess
0 or nodeaccessgranted=yes
1 switch bicycle=
switch vehicle=
assign initialcost defaultaccess
add switch highway=traffic_signals 200 # Kosten für Ampel switch or vehicle=private vehicle=no
switch highway=stop 150 # Kosten für Stoppschild 0
switch railway=crossing|level_crossing 200 # Kosten für Bahnübergang 1
0 switch or bicycle=private and not or highway=crossing ignore_bicycle_no or bicycle=no bicycle=dismount
switch bikeaccess 0
0 1
switch footaccess
10000 # Kosten fürs Absteigen assign footaccess
1000000 #Kosten für verbotene oder private Wege 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

View file

@ -1,443 +1,460 @@
# #
# Profile for fast recumbent bikes, contributed by http://www.velomobilforum.de # Profile for fast velomobiles, contributed by http://www.velomobilforum.de
---context:global ---context:global
assign totalMass = 110 #Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg assign no_steps = true # %no_steps% | keine Stufen, das Velomobil soll nicht getragen werden müssen | boolean
assign maxSpeed = 60 #Maximale Geschwindigkeit ab der der Fahrer bremst in km/h assign no_wrong_oneway = false # %no_wrong oneway% | keine Einbahnstrasse in falsche Richtung, auch nicht schiebend | boolean
assign S_C_x = 0.05 #Effektive Stirnfläche in m²
assign C_r = 0.005 #Rollwiderstand 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 bikerPower = 125 #Dauerleistung in Watt 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 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 avoid_cycleways = 8 # %avoid_cycleways% | Radwege vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 8 = Standard, 10 = stark vermeiden | number
assign consider_smoothness_tags = true # mit false kann die kanne die Auswertung der smoothness tags abgeschaltet werden assign avoid_elevation = 5 # %avoid_elevation% | Hohenmeter vermeiden(0-10): 0 = nicht vermeiden, 1 = leicht vermeiden, 5 = Standard, 10 = stark vermeiden | number
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 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 turnInstructionMode 1 #Ausgabe von Abiegehinweise 0=keine, 1=automatische Wahl, 2=locus-Style, 3=osmand-Style assign totalMass = 110 # %totalMass% | Gesamtmasse des Fahrzeugs (Fahrzeug, Fahrer, Gepäck...) in kg, für Fahrtzeitschätzung | number
assign turnInstructionCatchingRange 20 # innerhalb dieser Strecke werden mehrere Abiegehinweise zu einem zusammengefasst und die Abiegewinkel werden besser an die generelle Richtung angenähert assign maxSpeed = 60 # Maximale Geschwindigkeit ab der der Fahrer bremst in km/h
assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert assign S_C_x = 0.05 # Effektive Stirnfläche in m²
assign C_r = 0.005 # Rollwiderstand
assign downhillcost 80 # Kosten für die Höhenmeter bergab assign bikerPower = 125 # %bikerPower% | Dauerleistung in Watt, für Fahrtzeitschätzung| number
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 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 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 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 pass1coefficient 3 # Berechnugskoeffizient für erste schnelle Berechnung assign turnInstructionRoundabouts true # mit "false" werden keine speziellen Abiegehinweise für den Kreisverkehr generiert
assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
# sinnvolle Werte für den ersten Koeffizienten: assign avoidmr2 multiply 0.11111111 multiply avoid_main_roads avoid_main_roads
# 1 exakte Berechnung beim ersten Durchlauf assign avoidsr multiply 0.2 avoid_small_roads
# umso größer die Werte umso schneller und ungenauer die erste Berechnung assign avoidbw multiply 0.125 avoid_bad_ways
# sinnvolle Werte für den zweiten Koeffizienten: assign avoid_ele multiply avoid_elevation 0.2
# 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 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
# 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 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 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 validForBikes true # bei true werden die Außnahmen bei den Abbiegebeschränkungen für Fahrräder aktiviert
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 considerTurnRestrictions true # bei false werden die Abbiegebeschränkungen ignoriert
assign lmc switch low_memory_cutoff 10000 0 assign pass1coefficient 3 # Berechnugskoeffizient für erste schnelle Berechnung
---context:way assign pass2coefficient 0 # Berechnugskoeffizient für zweite exakte Berechnung
# sinnvolle Werte für den ersten Koeffizienten:
# Parameter für die Wege # 1 exakte Berechnung beim ersten Durchlauf
#zusätzliche Kosten in Meter für jeden Streckenabschnitt # umso größer die Werte umso schneller und ungenauer die erste Berechnung
# sinnvolle Werte für den zweiten Koeffizienten:
assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes # 0 exakte Berechnung mit Beschränkung des Suchgebiets über die Kosten der ersten Berechnung
assign nodeaccessgranted or any_cycleroute lcn=yes # -1 keine zweite Berechnung, nur sinnvoll bei 1 im ersten Durchlauf
assign cycleway # 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.
or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
assign elevationpenaltybuffer 7 # Höhenpuffer (in Meter) ab dem die Höhenstrafen beginnen und das Segment als Anstieg und Gefälle gewertet wird
assign footway assign elevationmaxbuffer 13 # Maximale Puffergröße (in Meter), alles darüberhinausgehende wird voll bestraft
or highway=footway and highway=path foot=designated|yes 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 turncost ---context:way
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 # Parameter für die Wege
#zusätzliche Kosten in Meter für jeden Streckenabschnitt
assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
switch route=ferry 2 assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route_bicycle_rcn=yes route_bicycle_lcn=yes
switch highway=steps 3 assign nodeaccessgranted or any_cycleroute lcn=yes
switch cycleway 4
switch footway 5 assign cycleway
1 or highway=cycleway and highway=path|footway|pedestrian bicycle=designated|yes
assign initialcost assign footway
switch route=ferry 15000 # Kosten wenn eine Fähre verwendet wird or highway=footway|pedestrian and highway=path foot=designated|yes
switch highway=steps 1000 # Kosten für Stufen
switch cycleway 800 # Kosten für Radwege assign turncost
switch footway 1000 # Kosten für Fußwege switch junction=roundabout 0
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
# Kosten ab hier als Meter für jeden tatsächlichen Meter assign initialclassifier # hier wird bestimmten Wegen ein Wert zugeordnet und wenn er sich vom vorherigen unterscheidet die initalcost hinzugerechnet
switch route=ferry 2
assign oneway switch highway=steps 3
switch oneway= switch cycleway 4
junction=roundabout switch footway 5
or oneway=yes or oneway=true oneway=1 1
assign onewaypenalty assign initialcost
switch switch reversedirection=yes oneway oneway=-1 switch route=ferry 15000 # Kosten wenn eine Fähre verwendet wird
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 highway=steps switch no_steps 1000000 dismount_cost # Kosten für Stufen
switch or highway=primary highway=primary_link add lmc 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung switch cycleway multiply 12.5 multiply avoid_cycleways avoid_cycleways # Kosten für Radwege
switch or highway=secondary highway=secondary_link add lmc 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung switch footway dismount_cost # Kosten für Fußwege
switch or highway=tertiary highway=tertiary_link add lmc 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung 0
20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
0.0 # Kosten ab hier als Meter für jeden tatsächlichen Meter
assign defaultaccess assign oneway
switch access= switch oneway=
not motorroad=yes junction=roundabout
switch or access=private access=no or oneway=yes or oneway=true oneway=1
0
1 assign onewaypenalty
switch switch reversedirection=yes oneway oneway=-1
assign bikeaccess 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
or any_cycleroute switch no_wrong_oneway 10000
switch bicycle= switch or highway=primary highway=primary_link 50 #zusätzliche Kosten für Bundesstraßen Einbahnstraßen in Gegenrichtung
switch bicycle_road=yes switch or highway=secondary highway=secondary_link 30 #zusätzliche Kosten für Landstraßen Einbahnstraßen in Gegenrichtung
1 switch or highway=tertiary highway=tertiary_link 25 #zusätzliche Kosten für Kreisstraßen Einbahnstraßen in Gegenrichtung
switch vehicle= 20.0 #zusätzliche Kosten für sonstige Einbahnstraßen in Gegenrichtung
defaultaccess 0.0
switch or vehicle=private vehicle=no
0 assign defaultaccess
1 switch access=
not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount not motorroad=yes
switch or access=private access=no
0
assign footaccess 1
or bikeaccess
or and bicycle=dismount ignore_bicycle_no assign bikeaccess
switch foot= or any_cycleroute
defaultaccess switch bicycle=
not or foot=private foot=no switch vehicle=
defaultaccess
assign accesspenalty switch or vehicle=private vehicle=no
switch bikeaccess 0
0 1
switch footaccess not or bicycle=private or and not ignore_bicycle_no bicycle=no bicycle=dismount
15 #Zusatzkosten fürs Schieben
10000 #Zusatzkosten für gesperrte oder private Wege
assign footaccess
assign maxspeed_forward or bikeaccess
switch maxspeed:forward=50 50 or and bicycle=dismount ignore_bicycle_no
switch maxspeed:forward=30 30 switch foot=
switch maxspeed:forward=10 10 defaultaccess
switch maxspeed:forward=20 20 not or foot=private foot=no
switch maxspeed:forward=40 40
switch maxspeed:forward=60 60 assign accesspenalty
switch maxspeed:forward=70 70 switch bikeaccess
switch maxspeed:forward=80 80 0
switch maxspeed:forward=90 90 switch footaccess
switch maxspeed:forward=100 100 15 #Zusatzkosten fürs Schieben
switch maxspeed:forward=110 110 10000 #Zusatzkosten für gesperrte oder private Wege
switch maxspeed:forward=120 120
switch maxspeed:forward=130 130 assign maxspeed_forward
switch maxspeed:forward=urban 50 switch maxspeed:forward=50 50
switch maxspeed:forward=rural 100 switch maxspeed:forward=30 30
0 switch maxspeed:forward=10 10
switch maxspeed:forward=20 20
assign maxspeed_backward switch maxspeed:forward=40 40
switch maxspeed:backward=50 50 switch maxspeed:forward=60 60
switch maxspeed:backward=30 30 switch maxspeed:forward=70 70
switch maxspeed:backward=10 10 switch maxspeed:forward=80 80
switch maxspeed:backward=20 20 switch maxspeed:forward=90 90
switch maxspeed:backward=40 40 switch maxspeed:forward=100 100
switch maxspeed:backward=60 60 switch maxspeed:forward=110 110
switch maxspeed:backward=70 70 switch maxspeed:forward=120 120
switch maxspeed:backward=80 80 switch maxspeed:forward=130 130
switch maxspeed:backward=90 90 switch maxspeed:forward=urban 50
switch maxspeed:backward=100 100 switch maxspeed:forward=rural 100
switch maxspeed:backward=110 110 0
switch maxspeed:backward=120 120
switch maxspeed:backward=130 130 assign maxspeed_backward
switch maxspeed:backward=urban 50 switch maxspeed:backward=50 50
switch maxspeed:backward=rural 100 switch maxspeed:backward=30 30
0 switch maxspeed:backward=10 10
switch maxspeed:backward=20 20
assign maxspeed switch maxspeed:backward=40 40
switch and reversedirection=yes maxspeed_backward maxspeed_backward switch maxspeed:backward=60 60
switch and not reversedirection=yes maxspeed_forward maxspeed_forward switch maxspeed:backward=70 70
switch maxspeed=50 50 switch maxspeed:backward=80 80
switch maxspeed=30 30 switch maxspeed:backward=90 90
switch maxspeed=10 10 switch maxspeed:backward=100 100
switch maxspeed=20 20 switch maxspeed:backward=110 110
switch maxspeed=40 40 switch maxspeed:backward=120 120
switch maxspeed=60 60 switch maxspeed:backward=130 130
switch maxspeed=70 70 switch maxspeed:backward=urban 50
switch maxspeed=80 80 switch maxspeed:backward=rural 100
switch maxspeed=90 90 0
switch maxspeed=100 100
switch maxspeed=110 110 assign maxspeed
switch maxspeed=120 120 switch and reversedirection=yes maxspeed_backward maxspeed_backward
switch maxspeed=130 130 switch and not reversedirection=yes maxspeed_forward maxspeed_forward
switch maxspeed=urban 50 switch maxspeed=50 50
switch maxspeed=rural 100 switch maxspeed=30 30
999 switch maxspeed=10 10
switch maxspeed=20 20
switch maxspeed=40 40
assign downspeedpenalty switch maxspeed=60 60
switch equal maxspeed 10 5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Gefälle switch maxspeed=70 70
switch equal maxspeed 20 2 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Gefälle switch maxspeed=80 80
switch equal maxspeed 30 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle switch maxspeed=90 90
switch equal maxspeed 40 0.8 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle switch maxspeed=100 100
switch equal maxspeed 50 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle switch maxspeed=110 110
0 switch maxspeed=120 120
switch maxspeed=130 130
assign flatspeedpenalty switch maxspeed=urban 50
switch equal maxspeed 10 3 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene switch maxspeed=rural 100
switch equal maxspeed 20 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene 999
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 assign downspeedpenalty
0 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
assign upspeedpenalty switch equal maxspeed 30 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Gefälle
switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen switch equal maxspeed 40 0.8 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h bei Gefälle
switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen switch equal maxspeed 50 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h bei Gefälle
switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen 0
0
assign flatspeedpenalty
switch equal maxspeed 10 3 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h in der Ebene
assign surfacepenalty switch equal maxspeed 20 1 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h in der Ebene
add switch embedded_rails=tram|yes|rail 20 # Zusatzkosten bei Schienen in der Fahrbahn switch equal maxspeed 30 0.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h in der Ebene
0 switch equal maxspeed 40 0.3 # Zusatzkosten für Geschwindigkeitsbegrenzung 40 km/h in der Ebene
switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen switch equal maxspeed 50 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 50 km/h in der Ebene
switch concrete=plates 1 # Zusatzkosten für Betonplattenwege 0
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 assign upspeedpenalty
switch surface=cobblestone|fine_gravel|compacted|sett|grass_paver 5 #Zusatzkosten für Kopfsteinpflaster, Splitt, verdichtete Deckschicht, behauene Pflastersteine oder Rasengittersteine switch equal maxspeed 10 1.5 # Zusatzkosten für Geschwindigkeitsbegrenzung 10 km/h bei Anstiegen
switch surface=gravel|sand|pebblestone add lmc 10 #Zusatzkosten für Schotter, Sand oder Kies switch equal maxspeed 20 0.4 # Zusatzkosten für Geschwindigkeitsbegrenzung 20 km/h bei Anstiegen
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 switch equal maxspeed 30 0.1 # Zusatzkosten für Geschwindigkeitsbegrenzung 30 km/h bei Anstiegen
0 0
assign smoothnesspenalty
switch smoothness=excellent|good|very_good 0 #Zusatzkosten für excellente, gute, oder sehr gute Oberflächen assign surfacepenalty
switch smoothness=intermediate|medium 0.2 #Zusatzkosten für mittelmäßige Oberflächen add switch embedded_rails=tram|yes|rail 20 # Zusatzkosten bei Schienen in der Fahrbahn
switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen 0
switch smoothness=robust_wheels|bad add lmc 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen multiply avoidbw
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 switch surface=asphalt|paved 0 #Zusatzkosten für Teer oder versiegelte Flächen
0 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
assign costfactor 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
# dieser Abschnitt ist für die Kosten in der Ebene 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
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 assign smoothnesspenalty
multiply avoidbw
min 9999 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
add onewaypenalty switch smoothness=rough|poor 2 #Zusatzkosten für raue oder schlechte Oberflächen
add accesspenalty switch smoothness=robust_wheels|bad 10 #Zusatzkosten für Oberflächen die robuste Reifen benötigen oder schlechte Oberflächen
add surfacepenalty 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
add switch consider_smoothness_tags smoothnesspenalty 0 0
add flatspeedpenalty
switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen assign costfactor
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 # dieser Abschnitt ist für die Kosten in der Ebene
switch highway=primary|primary_link 1.2 # Kosten für Bundesstraßen
switch highway=secondary|secondary_link 1 # Kosten für Landstraßen switch and highway= not route=ferry 10000 # Kosten für alles ohne higway tag außer Fähren
switch highway=tertiary|tertiary_link 1.1 # Kosten für Kreisstraßen switch or highway=proposed highway=abandoned 10000 # Kosten für geplante oder Wege im Bau
switch highway=unclassified 1.2 # Kosten für Verbindungsstraßen
switch highway=residential|service 1.7 # Kosten für Wohn- und Zufahrtsstraßen min 9999
switch highway=track max 1
switch tracktype=grade1 2.5 # Kosten für geteerte, betonierte oder gepflasterte Feldwege
switch tracktype=grade2 10 # Kosten für geschotterte Feldwege add onewaypenalty
switch tracktype=grade3 add lmc 40 # Kosten für Feldwege mit weichem Untergrund add accesspenalty
switch tracktype=grade4 add lmc 50 # Kosten für unbefestigte Feldwege add max surfacepenalty smoothnesspenalty
switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege add flatspeedpenalty
add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
switch cycleway 2.5 # Kosten für Fahrradwege max 1
switch ( or highway=living_street living_street=yes ) 5 # Kosten für Spielstraßen switch highway=motorway|motorway_link 10000 # Kosten für Autobahnen
switch highway=road 10 # Kosten für noch nicht genauer beschriebene Straße switch route=ferry 10.67 # Kosten für Fähren
switch footway 30 # Kosten für Fußwege switch highway=trunk|trunk_link add 1 multiply avoidmr2 1.5 # Kosten für eine autobahnänliche Straße
switch highway=pedestrian 30 # Kosten für Gehwege switch highway=primary|primary_link add 0.5 multiply avoidmr2 0.7 # Kosten für Bundesstraßen
switch highway=steps 40 # Kosten für Stufen switch highway=secondary|secondary_link 1 # Kosten für Landstraßen
switch highway=path switch highway=tertiary|tertiary_link add 0.5 multiply avoidsr 0.6 # Kosten für Kreisstraßen
switch surface= add lmc 40 # Kosten für Pfade ohne Oberflächenangabe switch highway=unclassified add 0.5 multiply avoidsr 0.7 # Kosten für Verbindungsstraßen
10 # Kosten für Pfade mit Oberflächenangabe switch highway=residential|service add 0.7 multiply avoidsr 1 # Kosten für Wohn- und Zufahrtsstraßen
switch highway=bridleway add lmc 80 # Kosten für Reitwege switch highway=track
add lmc 20 # Kosten für sonstige Wege 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
assign uphillcostfactor switch tracktype=grade3 multiply avoidbw 40 # Kosten für Feldwege mit weichem Untergrund
switch tracktype=grade4 multiply avoidbw 50 # Kosten für unbefestigte Feldwege
# dieser Abschnitt ist für die Kosten bei Anstiegen switch tracktype=grade5 multiply avoidbw 50 # Kosten für kaum erkennbare Feldwege
# da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen 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 and highway= not route=ferry 10000 switch cycleway add 0.58 multiply avoid_cycleways 0.24 # Kosten für Fahrradwege
switch or highway=proposed highway=abandoned 10000 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
min 9999 switch footway 30 # Kosten für Fußwege
switch highway=steps 40 # Kosten für Stufen
add upspeedpenalty switch highway=path
add onewaypenalty switch surface= multiply avoidbw 40 # Kosten für Pfade ohne Oberflächenangabe
add accesspenalty add 4 multiply avoidsr 6 # Kosten für Pfade mit Oberflächenangabe
add switch consider_smoothness_tags smoothnesspenalty 0 switch highway=bridleway multiply avoidbw 80 # Kosten für Reitwege
add surfacepenalty 20 # Kosten für sonstige Wege
switch highway=motorway|motorway_link 10000 assign uphillcostfactor
switch route=ferry 10.67
switch highway=trunk|trunk_link 6.5 # dieser Abschnitt ist für die Kosten bei Anstiegen
switch highway=primary|primary_link 3 # da er von der Struktur identisch wie der vorherige Abschnitt werde ich die Beschreibung hier nicht wiederholen
switch highway=secondary|secondary_link 1.2
switch highway=tertiary|tertiary_link 1 switch and highway= not route=ferry 10000
switch highway=unclassified 1 switch or highway=proposed highway=abandoned 10000
switch highway=residential|service 1.5
switch highway=track min 9999
switch tracktype=grade1 2 max 1
switch tracktype=grade2 10
switch tracktype=grade3 add lmc 40 add onewaypenalty
switch tracktype=grade4 add lmc 50 add accesspenalty
switch tracktype=grade5 add lmc 50 add max surfacepenalty smoothnesspenalty
add lmc 20 add upspeedpenalty
switch cycleway 2 max 1
switch ( or highway=living_street living_street=yes ) 5 switch highway=motorway|motorway_link 10000
switch highway=road 10 switch route=ferry 10.67
switch footway 30 switch highway=trunk|trunk_link add 1 multiply avoidmr2 5.5
switch highway=pedestrian 30 switch highway=primary|primary_link add 0.5 multiply avoidmr2 2.5
switch highway=steps 40 switch highway=secondary|secondary_link add 0.5 multiply avoidmr2 0.7
switch highway=path switch highway=tertiary|tertiary_link 1
switch surface= add lmc 40 switch highway=unclassified 1
10 switch highway=residential|service add 0.6 multiply avoidsr 0.9
switch highway=bridleway add lmc 80 switch highway=track
add lmc 20 switch tracktype=grade1 add 0.8 multiply avoidsr 1.2
switch tracktype=grade2 multiply avoidbw add 4 multiply avoidsr 6
assign downhillcostfactor switch tracktype=grade3 multiply avoidbw 40
switch tracktype=grade4 multiply avoidbw 50
# dieser Abschnitt ist für die Kosten bei Gefälle switch tracktype=grade5 multiply avoidbw 50
# da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen switch surface= multiply avoidbw 20
add 1 multiply avoidsr 1.5
switch and highway= not route=ferry 10000 switch cycleway add 0.24 multiply avoid_cycleways 0.22
switch or highway=proposed highway=abandoned 10000 switch highway=living_street add 2 multiply avoidsr 3
switch highway=road add 4 multiply avoidsr 6
min 9999 switch footway 30
switch highway=steps 40
add downspeedpenalty switch highway=path
add onewaypenalty switch surface= multiply avoidbw 40
add accesspenalty add 4 multiply avoidsr 6
add switch consider_smoothness_tags smoothnesspenalty 0 switch highway=bridleway multiply avoidbw 80
add surfacepenalty 20
switch highway=motorway|motorway_link 10000 assign downhillcostfactor
switch route=ferry 10.67
switch highway=trunk|trunk_link 1.5 # dieser Abschnitt ist für die Kosten bei Gefälle
switch highway=primary|primary_link 1 # da er von der Struktur identisch wie der vorvorherige Abschnitt werde ich die Beschreibung hier auch nicht wiederholen
switch highway=secondary|secondary_link 1
switch highway=tertiary|tertiary_link 1.5 switch and highway= not route=ferry 10000
switch highway=unclassified 1.7 switch or highway=proposed highway=abandoned 10000
switch highway=residential|service 2.5
switch highway=track min 9999
switch tracktype=grade1 4 max 1
switch tracktype=grade2 10
switch tracktype=grade3 add lmc 40 add downspeedpenalty
switch tracktype=grade4 add lmc 50 add onewaypenalty
switch tracktype=grade5 add lmc 50 add accesspenalty
add lmc 20 add max smoothnesspenalty surfacepenalty
switch cycleway 5 max 1
switch ( or highway=living_street living_street=yes ) 8 switch highway=motorway|motorway_link 10000
switch highway=road 10 switch route=ferry 10.67
switch footway 30 switch highway=trunk|trunk_link add 0.5 multiply avoidmr2 1
switch highway=pedestrian 30 switch highway=primary|primary_link add 0.5 multiply avoidmr2 0.5
switch highway=steps 40 switch highway=secondary|secondary_link 1
switch highway=path switch highway=tertiary|tertiary_link add 0.6 multiply avoidsr 0.9
switch surface= add lmc 40 switch highway=unclassified add 0.6 multiply avoidsr 1.1
10 switch highway=residential|service add 1 multiply avoidsr 1.5
switch highway=bridleway add lmc 80 switch highway=track
add lmc 20 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
# hier kommen Variablen die zur Generierung der Abiegehinweise benötigt werden switch tracktype=grade4 multiply avoidbw 50
switch tracktype=grade5 multiply avoidbw 50
assign priorityclassifier = switch surface= multiply avoidbw 20
add 1.8 multiply avoidsr 1.2
if ( highway=motorway ) then 30 switch cycleway add 0.2 multiply avoid_cycleways 0.6
else if ( highway=motorway_link ) then 29 switch highway=living_street add 2 multiply avoidsr 6
else if ( highway=trunk ) then 28 switch highway=road add 4 multiply avoidsr 6
else if ( highway=trunk_link ) then 27 switch footway 30
else if ( highway=primary ) then 26 switch highway=steps 40
else if ( highway=primary_link ) then 25 switch highway=path
else if ( highway=secondary ) then 24 switch surface= multiply avoidbw 40
else if ( highway=secondary_link ) then 23 add 4 multiply avoidsr 6
else if ( highway=tertiary ) then 22 switch highway=bridleway multiply avoidbw 80
else if ( highway=tertiary_link ) then 21 20
else if ( highway=unclassified ) then 20
else if ( or highway=residential|living_street living_street=yes ) then 6
else if ( highway=service ) then 6 # hier kommen Variablen die zur Generierung der Abbiegehinweise benötigt werden
else if ( highway=cycleway ) then 6
else if ( or bicycle=designated bicycle_road=yes ) then 6 assign priorityclassifier =
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
else if ( highway=bridleway|road|path|footway ) then 4 if ( highway=motorway ) then 30
else if ( highway=steps ) then 2 else if ( highway=motorway_link ) then 29
else if ( highway=pedestrian ) then 2 else if ( highway=trunk ) then 28
else 0 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
assign isbadoneway = not equal onewaypenalty 0 else if ( highway=secondary_link ) then 23
assign isgoodoneway = if reversedirection=yes then oneway=-1 else if ( highway=tertiary ) then 22
else if oneway= then junction=roundabout else oneway=yes|true|1 else if ( highway=tertiary_link ) then 21
assign isroundabout = junction=roundabout else if ( highway=unclassified ) then 20
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link else if ( highway=residential|living_street ) then 6
assign isgoodforcars = if greater priorityclassifier 6 then true else if ( highway=service ) then 6
else if ( or highway=residential|living_street|service living_street=yes ) then true else if ( highway=cycleway ) then 6
else if ( and highway=track tracktype=grade1 ) then true else if ( bicycle=designated ) then 6
else false else if ( highway=track ) then if tracktype=grade1 then 6 else 4
else if ( highway=bridleway|road|path|footway ) then 4
assign classifiermask add isbadoneway else if ( highway=steps ) then 2
add multiply isgoodoneway 2 else if ( highway=pedestrian ) then 2
add multiply isroundabout 4 else 0
add multiply islinktype 8
multiply isgoodforcars 16
assign isbadoneway = not equal onewaypenalty 0
assign isgoodoneway = if reversedirection=yes then oneway=-1
---context:node # following code refers to node tags else if oneway= then junction=roundabout else oneway=yes|true|1
assign isroundabout = junction=roundabout
# Parameter für Knotenpunkte assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
# Kosten an Knotenpunkten in Meter 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
assign defaultaccess else false
switch access=
1 # add default barrier restrictions here! assign classifiermask add isbadoneway
switch or access=private access=no add multiply isgoodoneway 2
0 add multiply isroundabout 4
1 add multiply islinktype 8
multiply isgoodforcars 16
assign bikeaccess
or nodeaccessgranted=yes
switch bicycle=
switch vehicle= ---context:node # following code refers to node tags
defaultaccess
switch or vehicle=private vehicle=no # Parameter für Knotenpunkte
0 # Kosten an Knotenpunkten in Meter
1
switch or bicycle=private or and not or highway=crossing ignore_bicycle_no bicycle=no bicycle=dismount
0 assign defaultaccess
1 switch access=
1 # add default barrier restrictions here!
assign footaccess switch or access=private access=no
or bicycle=dismount 0
switch foot= 1
defaultaccess
switch or foot=private foot=no assign bikeaccess
0 or nodeaccessgranted=yes
1 switch bicycle=
switch vehicle=
assign initialcost defaultaccess
add switch highway=traffic_signals 250 # Kosten für Ampel switch or vehicle=private vehicle=no
switch highway=stop 250 # Kosten für Stoppschild 0
switch railway=crossing|level_crossing 350 # Kosten für Bahnübergang 1
0 switch or bicycle=private and not or highway=crossing ignore_bicycle_no or bicycle=no bicycle=dismount
switch bikeaccess 0
0 1
switch footaccess
10000 # Kosten fürs Absteigen assign footaccess
1000000 #Kosten für verbotene oder private Wege 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