Merge remote-tracking branch 'abrensch/master'
This commit is contained in:
commit
2a4bc8a9a5
26 changed files with 769 additions and 261 deletions
139
README.md
139
README.md
|
@ -1,40 +1,129 @@
|
|||
BRouter
|
||||
=======
|
||||
|
||||
BRouter is a configurable OSM offline router with elevation awareness, Java + Android. Designed to be multi-modal with a particular emphasis on bicycle routing.
|
||||
BRouter is a configurable OSM offline router with elevation awareness, Java +
|
||||
Android. Designed to be multi-modal with a particular emphasis on bicycle
|
||||
and energy-based car routing.
|
||||
|
||||
For more infos see http://brouter.de/brouter
|
||||
For more infos see [http://brouter.de/brouter](http://brouter.de/brouter).
|
||||
|
||||
|
||||
## BRouter on Android
|
||||
|
||||
You can install the BRouter app on your Android device from
|
||||
[F-Droid](https://f-droid.org/packages/btools.routingapp) or [Google Play
|
||||
Store](https://play.google.com/store/apps/details?id=btools.routingapp). You
|
||||
can also [build BRouter](#build-and-install) yourself. You can find detailed
|
||||
documentation of the BRouter Android app in
|
||||
[`misc/readmes/readme.txt`](misc/readmes/readme.txt).
|
||||
|
||||
<a href="https://f-droid.org/packages/btools.routingapp" target="_blank">
|
||||
<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" height="90"/></a>
|
||||
<a href="https://play.google.com/store/apps/details?id=btools.routingapp" target="_blank">
|
||||
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" alt="Get it on Google Play" height="90"/></a>
|
||||
|
||||
### Android with Locus
|
||||
|
||||
## Build and Install
|
||||
You can use BRouter as the offline routing engine for [Locus
|
||||
Map](https://www.locusmap.eu/) on your Android device. This is currently the
|
||||
most featureful and maintained solutions for using BRouter on your Android
|
||||
device.
|
||||
|
||||
Compile with (Java 6!):
|
||||
|
||||
> mvn clean install -Dandroid.sdk.path=<your-sdk-path>
|
||||
|
||||
To skip building for Android, add ``-pl '!brouter-routing-app'``.
|
||||
|
||||
Next, download one or more [data file(s)](http://brouter.de/brouter/segments4/) (rd5) into the ``misc/segments4`` directory.
|
||||
|
||||
## Run
|
||||
|
||||
On Linux:
|
||||
> ./misc/scripts/standalone/server.sh
|
||||
|
||||
On Windows (using Bash):
|
||||
> ./misc/scripts/standalone/server.sh
|
||||
|
||||
On Windows (using CMD):
|
||||
> misc\scripts\standalone\server.cmd
|
||||
A full documentation on how to set this up is available at
|
||||
[https://www.locusmap.eu/locus-map-can-navigate-offline/](https://www.locusmap.eu/locus-map-can-navigate-offline/).
|
||||
|
||||
|
||||
Related Projects
|
||||
================
|
||||
### Android with OSMAnd
|
||||
|
||||
* https://github.com/nrenner/brouter-web
|
||||
* https://github.com/poutnikl/Brouter-profiles/wiki
|
||||
Alternatively, you can also use BRouter as the offline routing engine for
|
||||
[OSMAnd](https://osmand.net/) on your Android device.
|
||||
|
||||
A full documentation on how to set this up is available at
|
||||
[`misc/readmes/osmand/README.md`](misc/readmes/osmand/README.md).
|
||||
|
||||
|
||||
## BRouter on Windows/Linux/Mac OS
|
||||
|
||||
### Build and Install
|
||||
|
||||
To compile BRouter (including the BRouter Android app), use
|
||||
|
||||
```
|
||||
mvn clean install -Dandroid.sdk.path=<your-sdk-path>
|
||||
```
|
||||
|
||||
If you only want to compile BRouter and the server part (skipping the Android
|
||||
app), use
|
||||
|
||||
```
|
||||
mvn clean install -pl '!brouter-routing-app'
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
Routing data files are organised as 5*5 degree files,
|
||||
with the filename containing the south-west corner
|
||||
of the square, which means:
|
||||
|
||||
- You want to route near West48/North37 -> you need `W50_N35.rd5`
|
||||
- You want to route near East7/North47 -> you need `E5_N45.rd5`
|
||||
|
||||
These data files, called "segments" across BRouter, are generated from
|
||||
[OpenStreetMap](https://www.openstreetmap.org/) data and stored in a custom
|
||||
binary format (rd5) for improved efficiency of BRouter routing.
|
||||
|
||||
|
||||
#### Download them from brouter.de
|
||||
|
||||
Segments files from the whole planet are generated weekly at
|
||||
[http://brouter.de/brouter/segments4/](http://brouter.de/brouter/segments4/).
|
||||
|
||||
You can download one or more segments files, covering the area of the planet
|
||||
your want to route, into the `misc/segments4` directory.
|
||||
|
||||
#### Generate your own segments files
|
||||
|
||||
You can also generate the segments files you need directly from a planet dump
|
||||
of OpenStreetMap data (or a [GeoFabrik extract](https://download.geofabrik.de/)).
|
||||
|
||||
More documentation of this is available in the
|
||||
[`misc/readmes/mapcreation.md`](misc/readmes/mapcreation.md) file.
|
||||
|
||||
|
||||
### Run the BRouter HTTP server
|
||||
|
||||
Helpers scripts are provided in `misc/scripts/standalone` to quickly spawn a
|
||||
BRouter HTTP server for various platforms.
|
||||
|
||||
* Linux/Mac OS: `./misc/scripts/standalone/server.sh`
|
||||
* Windows (using Bash): `./misc/scripts/standalone/server.sh`
|
||||
* Windows (using CMD): `misc\scripts\standalone\server.cmd`
|
||||
|
||||
The API endpoints exposed by this HTTP server are documented in the
|
||||
[`brouter-server/src/main/java/btools/server/request/ServerHandler.java`](brouter-server/src/main/java/btools/server/request/ServerHandler.java)
|
||||
file.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
More documentation is available in the [`misc/readmes`](misc/readmes) folder.
|
||||
|
||||
|
||||
## Related Projects
|
||||
|
||||
* [nrenner/BRouter-web](https://github.com/nrenner/brouter-web), a web interface on
|
||||
top of the BRouter HTTP server. An online instance is available at
|
||||
[http://brouter.de/brouter-web/](http://brouter.de/brouter-web/).
|
||||
* [poutnikl/Brouter-profiles](https://github.com/poutnikl/Brouter-profiles/wiki),
|
||||
a collection of BRouter profiles.
|
||||
* [Phyks/BRouterTesting](https://github.com/Phyks/BrouterTesting), a
|
||||
collection of test cases for helping develop new BRouter profiles.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
BRouter is released under an [MIT License](LICENSE).
|
||||
|
|
|
@ -314,4 +314,56 @@ public class MicroCache extends ByteDataWriter
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void calcDelta( MicroCache mc1, MicroCache mc2 )
|
||||
{
|
||||
int idx1 = 0;
|
||||
int idx2 = 0;
|
||||
|
||||
while( idx1 < mc1.size || idx2 < mc2.size )
|
||||
{
|
||||
int id1 = idx1 < mc1.size ? mc1.faid[idx1] : Integer.MAX_VALUE;
|
||||
int id2 = idx2 < mc2.size ? mc2.faid[idx2] : Integer.MAX_VALUE;
|
||||
int id;
|
||||
if ( id1 >= id2 )
|
||||
{
|
||||
id = id2;
|
||||
int start2 = idx2 > 0 ? mc2.fapos[idx2 - 1] : 0;
|
||||
int len2 = mc2.fapos[idx2++] - start2;
|
||||
|
||||
if ( id1 == id2 )
|
||||
{
|
||||
// id exists in both caches, compare data
|
||||
int start1 = idx1 > 0 ? mc1.fapos[idx1 - 1] : 0;
|
||||
int len1 = mc1.fapos[idx1++] - start1;
|
||||
if ( len1 == len2 )
|
||||
{
|
||||
int i = 0;
|
||||
while( i<len1 )
|
||||
{
|
||||
if ( mc1.ab[start1+i] != mc2.ab[start2+i] )
|
||||
{
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if ( i == len1 )
|
||||
{
|
||||
continue; // same data -> do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
write( mc2.ab, start2, len2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
idx1++;
|
||||
id = id1; // deleted node
|
||||
}
|
||||
fapos[size] = aboffset;
|
||||
faid[size] = id;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,10 +87,15 @@ public final class MicroCache2 extends MicroCache
|
|||
|
||||
// future escapes (turn restrictions?)
|
||||
short trExceptions = 0;
|
||||
for(;;)
|
||||
{
|
||||
int featureId = bc.decodeVarBits();
|
||||
if ( featureId == 0 ) break;
|
||||
if ( featureId == 13 )
|
||||
{
|
||||
fapos[n] = aboffset;
|
||||
validBits[ n >> 5 ] |= 1 << n; // mark dummy-node valid
|
||||
continue; // empty node escape (delta files only)
|
||||
}
|
||||
while( featureId != 0 )
|
||||
{
|
||||
int bitsize = bc.decodeNoisyNumber( 5 );
|
||||
|
||||
if ( featureId == 2 ) // exceptions to turn-restriction
|
||||
|
@ -113,6 +118,7 @@ public final class MicroCache2 extends MicroCache
|
|||
{
|
||||
for( int i=0; i< bitsize; i++ ) bc.decodeBit(); // unknown feature, just skip
|
||||
}
|
||||
featureId = bc.decodeVarBits();
|
||||
}
|
||||
writeBoolean( false );
|
||||
|
||||
|
@ -147,7 +153,8 @@ public final class MicroCache2 extends MicroCache
|
|||
|
||||
TagValueWrapper wayTags = wayTagCoder.decodeTagValueSet();
|
||||
|
||||
if ( wayTags != null )
|
||||
boolean linkValid = wayTags != null || wayValidator == null;
|
||||
if ( linkValid )
|
||||
{
|
||||
int startPointer = aboffset;
|
||||
sizeoffset = writeSizePlaceHolder();
|
||||
|
@ -162,7 +169,7 @@ public final class MicroCache2 extends MicroCache
|
|||
finaldatasize += 1 + aboffset-startPointer; // reserve place for reverse
|
||||
validBits[ nodeIdx >> 5 ] |= 1 << nodeIdx; // mark target-node valid
|
||||
}
|
||||
writeModeAndDesc( isReverse, wayTags.data );
|
||||
writeModeAndDesc( isReverse, wayTags == null ? null : wayTags.data );
|
||||
}
|
||||
|
||||
if ( !isReverse ) // write geometry for forward links only
|
||||
|
@ -200,7 +207,7 @@ public final class MicroCache2 extends MicroCache
|
|||
}
|
||||
if ( matcher != null ) matcher.end();
|
||||
}
|
||||
if ( wayTags != null )
|
||||
if ( linkValid )
|
||||
{
|
||||
injectSize( sizeoffset );
|
||||
}
|
||||
|
@ -375,6 +382,12 @@ public final class MicroCache2 extends MicroCache
|
|||
int ilon = (int)(id64 >> 32);
|
||||
int ilat = (int)(id64 & 0xffffffff);
|
||||
|
||||
if ( aboffset == aboffsetEnd )
|
||||
{
|
||||
bc.encodeVarBits( 13 ); // empty node escape (delta files only)
|
||||
continue;
|
||||
}
|
||||
|
||||
// write turn restrictions
|
||||
while( readBoolean() )
|
||||
{
|
||||
|
@ -430,7 +443,10 @@ public final class MicroCache2 extends MicroCache
|
|||
readFully( description );
|
||||
}
|
||||
|
||||
boolean isInternal = isInternal( ilonlink, ilatlink );
|
||||
long link64 = ((long)ilonlink)<<32 | ilatlink;
|
||||
Integer idx = idMap.get( Long.valueOf( link64 ) );
|
||||
boolean isInternal = idx != null;
|
||||
|
||||
if ( isReverse && isInternal )
|
||||
{
|
||||
if ( dodebug ) System.out.println( "*** NOT encoding link reverse=" + isReverse + " internal=" + isInternal );
|
||||
|
@ -442,9 +458,6 @@ public final class MicroCache2 extends MicroCache
|
|||
|
||||
if ( isInternal )
|
||||
{
|
||||
long link64 = ((long)ilonlink)<<32 | ilatlink;
|
||||
Integer idx = idMap.get( Long.valueOf( link64 ) );
|
||||
if ( idx == null ) throw new RuntimeException( "ups: internal not found?" );
|
||||
int nodeIdx = idx.intValue();
|
||||
if ( dodebug ) System.out.println( "*** target nodeIdx=" + nodeIdx );
|
||||
if ( nodeIdx == n ) throw new RuntimeException( "ups: self ref?" );
|
||||
|
|
|
@ -62,6 +62,11 @@ public final class TagValueCoder
|
|||
{
|
||||
if ( ++pass == 3 )
|
||||
{
|
||||
if ( identityMap.size() == 0 )
|
||||
{
|
||||
TagValueSet dummy = new TagValueSet();
|
||||
identityMap.put( dummy, dummy );
|
||||
}
|
||||
PriorityQueue<TagValueSet> queue = new PriorityQueue<TagValueSet>(2*identityMap.size(), new TagValueSet.FrequencyComparator());
|
||||
queue.addAll(identityMap.values());
|
||||
while (queue.size() > 1)
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* Proof of concept for delta rd5's
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
package btools.mapaccess;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import btools.codec.DataBuffers;
|
||||
import btools.codec.MicroCache;
|
||||
import btools.codec.MicroCache2;
|
||||
import btools.codec.StatCoderContext;
|
||||
|
||||
final public class Rd5DiffTool
|
||||
{
|
||||
public static void main( String[] args ) throws Exception
|
||||
{
|
||||
diff2files( new File( args[0] ),new File( args[1] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the delta between 2 RD5 files and
|
||||
* show statistics on the expected size of the delta file
|
||||
*/
|
||||
public static void diff2files( File f1, File f2 ) throws Exception
|
||||
{
|
||||
byte[] abBuf1 = new byte[10 * 1024 * 1024];
|
||||
byte[] abBuf2 = new byte[10 * 1024 * 1024];
|
||||
|
||||
int nodesTotal = 0;
|
||||
int nodesDiff = 0;
|
||||
int diffedTiles = 0;
|
||||
|
||||
long bytesDiff = 0L;
|
||||
long diffedTileSize = 0L;
|
||||
|
||||
PhysicalFile pf1 = null;
|
||||
PhysicalFile pf2 = null;
|
||||
try
|
||||
{
|
||||
DataBuffers dataBuffers = new DataBuffers();
|
||||
pf1 = new PhysicalFile( f1, dataBuffers, -1, -1 );
|
||||
pf2 = new PhysicalFile( f2, dataBuffers, -1, -1 );
|
||||
int div = pf1.divisor;
|
||||
for ( int lonDegree = 0; lonDegree < 5; lonDegree++ ) // does'nt really matter..
|
||||
{
|
||||
for ( int latDegree = 0; latDegree < 5; latDegree++ ) // ..where on earth we are
|
||||
{
|
||||
OsmFile osmf1 = new OsmFile( pf1, lonDegree, latDegree, dataBuffers );
|
||||
OsmFile osmf2 = new OsmFile( pf2, lonDegree, latDegree, dataBuffers );
|
||||
for ( int lonIdx = 0; lonIdx < div; lonIdx++ )
|
||||
{
|
||||
for ( int latIdx = 0; latIdx < div; latIdx++ )
|
||||
{
|
||||
int lonIdxDiv = lonDegree * div + lonIdx;
|
||||
int latIdxDiv = latDegree * div + latIdx;
|
||||
|
||||
|
||||
MicroCache mc1 = osmf1.hasData() ?
|
||||
osmf1.createMicroCache( lonIdxDiv, latIdxDiv, dataBuffers, null, null, true, null )
|
||||
: MicroCache.emptyCache();
|
||||
MicroCache mc2 = osmf2.hasData() ?
|
||||
osmf2.createMicroCache( lonIdxDiv, latIdxDiv, dataBuffers, null, null, true, null )
|
||||
: MicroCache.emptyCache();
|
||||
|
||||
MicroCache mc = new MicroCache2( mc1.getSize() + mc2.getSize(), abBuf2, lonIdxDiv, latIdxDiv, div );
|
||||
mc.calcDelta( mc1, mc2 );
|
||||
|
||||
nodesTotal += mc2.getSize();
|
||||
|
||||
if ( mc.getSize() > 0 )
|
||||
{
|
||||
int len = mc.encodeMicroCache( abBuf1 );
|
||||
byte[] bytes = new byte[len];
|
||||
System.arraycopy( abBuf1, 0, bytes, 0, len );
|
||||
|
||||
bytesDiff += len;
|
||||
nodesDiff += mc.getSize();
|
||||
diffedTiles++;
|
||||
diffedTileSize += mc2.size();
|
||||
|
||||
// cross-check the encoding: decode again
|
||||
MicroCache mcCheck = new MicroCache2( new StatCoderContext( bytes ), new DataBuffers( null ), lonIdxDiv, latIdxDiv, div, null, null );
|
||||
|
||||
// due to link-order ambiguity, for decoded we can only compare node-count and datasize
|
||||
if ( mc.size() != mcCheck.size() )
|
||||
{
|
||||
throw new IllegalArgumentException( "re-decoded data-size mismatch!" );
|
||||
}
|
||||
if ( mc.getSize() != mcCheck.getSize() )
|
||||
{
|
||||
throw new IllegalArgumentException( "re-decoded node-count mismatch!" );
|
||||
}
|
||||
|
||||
// .... so re-encode again
|
||||
int len2 = mcCheck.encodeMicroCache( abBuf1 );
|
||||
byte[] bytes2 = new byte[len2];
|
||||
System.arraycopy( abBuf1, 0, bytes2, 0, len2 );
|
||||
|
||||
// and here we can compare byte-by-byte
|
||||
if ( len != len2 )
|
||||
{
|
||||
throw new IllegalArgumentException( "decoded size mismatch!" );
|
||||
}
|
||||
for( int i=0; i<len; i++ )
|
||||
{
|
||||
if ( bytes[i] != bytes2[i] )
|
||||
{
|
||||
throw new IllegalArgumentException( "decoded data mismatch at i=" + i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println( "nodesTotal=" + nodesTotal + " nodesDiff=" + nodesDiff + " bytesDiff=" + bytesDiff + " diffedTiles=" + diffedTiles + " diffedTileSize=" + diffedTileSize );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( pf1 != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
pf1.ra.close();
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
}
|
||||
}
|
||||
if ( pf2 != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
pf2.ra.close();
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,8 @@ assign initialcost switch route=ferry 20000 0
|
|||
#
|
||||
# calculate logical car access
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign caraccess
|
||||
switch motorcar=
|
||||
switch motor_vehicle=
|
||||
|
@ -44,7 +46,7 @@ assign caraccess
|
|||
switch highway=tertiary|tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch route=ferry 1
|
||||
switch highway=residential|living_street 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
0
|
||||
access=yes|permissive|designated|destination
|
||||
|
@ -104,7 +106,7 @@ assign maxspeed_implicit =
|
|||
switch highway=unclassified 50
|
||||
switch route=ferry 10
|
||||
switch highway=bridleway 10
|
||||
switch highway=residential|living_street 30
|
||||
switch isresidentialorliving 30
|
||||
switch highway=service 30
|
||||
switch highway=track|road|path switch tracktype=grade1 30 5
|
||||
0
|
||||
|
@ -148,7 +150,7 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 4 else 2
|
||||
else if ( highway=bridleway|road ) then 2
|
||||
|
@ -165,7 +167,7 @@ assign costfactor = if equal maxspeed 0
|
|||
assign isgoodoneway = if reversedirection=yes then oneway=-1
|
||||
else if oneway= then implicitoneway else oneway=yes|true|1
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if or isresidentialorliving highway=service then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
@ -176,7 +178,7 @@ assign classifiermask add isbadoneway
|
|||
add multiply isroundabout 4
|
||||
add multiply islinktype 8
|
||||
add multiply isgoodforcars 16
|
||||
multiply highway=residential|living_street 32
|
||||
multiply isresidentialorliving 32
|
||||
|
||||
|
||||
---context:node # following code refers to node tags
|
||||
|
|
|
@ -36,6 +36,8 @@ assign classifier_ferry = 2
|
|||
#
|
||||
# calculate logical car access
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign caraccess
|
||||
switch motorcar=
|
||||
switch motor_vehicle=
|
||||
|
@ -48,7 +50,7 @@ assign caraccess
|
|||
switch highway=tertiary|tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch route=ferry 1
|
||||
switch highway=residential|living_street 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
0
|
||||
access=yes|permissive|designated|destination
|
||||
|
@ -111,7 +113,7 @@ assign maxspeed_implicit =
|
|||
switch highway=unclassified 50
|
||||
switch route=ferry 10
|
||||
switch highway=bridleway 10
|
||||
switch highway=residential|living_street 30
|
||||
switch isresidentialorliving 30
|
||||
switch highway=service 30
|
||||
switch highway=track|road|path switch tracktype=grade1 30 5
|
||||
0
|
||||
|
@ -197,7 +199,7 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 4 else 2
|
||||
else if ( highway=bridleway|road ) then 2
|
||||
|
@ -209,7 +211,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
else if oneway= then junction=roundabout else oneway=yes|true|1
|
||||
assign isroundabout = junction=roundabout
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if or isresidentialorliving highway=service then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
@ -220,7 +222,7 @@ assign classifiermask add isbadoneway
|
|||
add multiply isroundabout 4
|
||||
add multiply islinktype 8
|
||||
add multiply isgoodforcars 16
|
||||
add multiply highway=residential|living_street 32
|
||||
add multiply isresidentialorliving 32
|
||||
multiply caraccess_destination 64
|
||||
|
||||
---context:node # following code refers to node tags
|
||||
|
|
|
@ -30,6 +30,8 @@ assign initialcost switch route=ferry 20000 0
|
|||
#
|
||||
# calculate logical car access
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign caraccess
|
||||
switch motorcar=
|
||||
switch motor_vehicle=
|
||||
|
@ -42,7 +44,7 @@ assign caraccess
|
|||
switch or highway=tertiary highway=tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch route=ferry 1
|
||||
switch or highway=residential highway=living_street 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
0
|
||||
or access=yes or access=permissive or access=designated access=destination
|
||||
|
@ -82,7 +84,7 @@ assign costfactor
|
|||
switch highway=unclassified 2.5
|
||||
switch route=ferry 5.67
|
||||
switch highway=bridleway 5
|
||||
switch or highway=residential highway=living_street 3.5
|
||||
switch isresidentialorliving 3.5
|
||||
switch highway=service 3.5
|
||||
switch or highway=track or highway=road highway=path
|
||||
switch tracktype=grade1 5
|
||||
|
@ -91,7 +93,7 @@ assign costfactor
|
|||
10000
|
||||
|
||||
assign trafficsourcedensity =
|
||||
if highway=residential|living_street then 1
|
||||
if isresidentialorliving then 1
|
||||
else if and maxspeed=30|50 highway=tertiary|secondary|primary then 1
|
||||
else 0
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ assign classifier_ferry = 2
|
|||
#
|
||||
# calculate logical car access
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign caraccess
|
||||
switch motorcar=
|
||||
switch motor_vehicle=
|
||||
|
@ -48,7 +50,7 @@ assign caraccess
|
|||
switch highway=tertiary|tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch route=ferry 1
|
||||
switch highway=residential|living_street 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
0
|
||||
access=yes|permissive|designated|destination
|
||||
|
@ -111,7 +113,7 @@ assign maxspeed_implicit =
|
|||
switch highway=unclassified 50
|
||||
switch route=ferry 10
|
||||
switch highway=bridleway 10
|
||||
switch highway=residential|living_street 30
|
||||
switch isresidentialorliving 30
|
||||
switch highway=service 30
|
||||
switch highway=track|road|path switch tracktype=grade1 30 5
|
||||
0
|
||||
|
@ -197,7 +199,7 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 4 else 2
|
||||
else if ( highway=bridleway|road ) then 2
|
||||
|
@ -209,7 +211,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
else if oneway= then junction=roundabout else oneway=yes|true|1
|
||||
assign isroundabout = junction=roundabout
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
@ -220,7 +222,7 @@ assign classifiermask add isbadoneway
|
|||
add multiply isroundabout 4
|
||||
add multiply islinktype 8
|
||||
add multiply isgoodforcars 16
|
||||
add multiply highway=residential|living_street 32
|
||||
add multiply isresidentialorliving 32
|
||||
multiply caraccess_destination 64
|
||||
|
||||
---context:node # following code refers to node tags
|
||||
|
|
|
@ -63,6 +63,8 @@ assign defaultaccess =
|
|||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
1
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
|
@ -116,6 +118,8 @@ assign onewaypenalty =
|
|||
)
|
||||
else 0.0
|
||||
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign costfactor
|
||||
|
||||
switch and highway= not route=ferry 10000
|
||||
|
@ -135,7 +139,7 @@ assign costfactor
|
|||
switch route=ferry 5.67
|
||||
switch highway=bridleway 5
|
||||
switch highway=cycleway 1.3
|
||||
switch or highway=residential highway=living_street switch isunpaved 10 1.2
|
||||
switch isresidentialorliving switch isunpaved 10 1.2
|
||||
switch highway=service switch isunpaved 10 1.2
|
||||
switch or highway=track or highway=road or highway=path highway=footway
|
||||
switch tracktype=grade1 switch isunpaved 3 1.2
|
||||
|
@ -143,7 +147,7 @@ assign costfactor
|
|||
switch tracktype=grade3 10.0
|
||||
switch tracktype=grade4 20.0
|
||||
switch tracktype=grade5 30.0
|
||||
switch bicycle=designated 2.0
|
||||
switch or bicycle=designated bicycle_road=yes 2.0
|
||||
switch ispaved 2.0 100.0
|
||||
10.0
|
||||
|
||||
|
@ -162,10 +166,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -181,7 +185,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ assign bikeaccess =
|
|||
if any_cycleroute then true
|
||||
else if bicycle= then
|
||||
(
|
||||
if vehicle= then
|
||||
if bicycle_road=yes then true
|
||||
else if vehicle= then
|
||||
(
|
||||
if access= then not or motorroad=yes highway=footway
|
||||
else if access=private|no then false
|
||||
|
@ -139,6 +140,8 @@ assign trafficpenalty =
|
|||
if hascycleway then min 0.3 trafficpenalty0
|
||||
else trafficpenalty0
|
||||
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign costfactor
|
||||
|
||||
switch and highway= not route=ferry 10000
|
||||
|
@ -159,7 +162,7 @@ assign costfactor
|
|||
switch route=ferry 5.67
|
||||
switch highway=bridleway 5
|
||||
switch highway=cycleway|footway 1.3
|
||||
switch or highway=residential highway=living_street switch isunpaved 10 1.2
|
||||
switch isresidentialorliving switch isunpaved 10 1.2
|
||||
switch highway=service switch isunpaved 10 1.2
|
||||
switch or highway=track or highway=road or highway=path highway=footway
|
||||
switch tracktype=grade1 switch isunpaved 3 1.2
|
||||
|
@ -167,7 +170,7 @@ assign costfactor
|
|||
switch tracktype=grade3 10.0
|
||||
switch tracktype=grade4 20.0
|
||||
switch tracktype=grade5 30.0
|
||||
switch bicycle=designated 1.3
|
||||
switch or bicycle=designated bicycle_road=yes 1.3
|
||||
switch ispaved 2.0 100.0
|
||||
10.0
|
||||
|
||||
|
@ -186,10 +189,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -205,7 +208,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ assign defaultaccess
|
|||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
1
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
|
@ -111,6 +113,8 @@ assign onewaypenalty =
|
|||
)
|
||||
else 0.0
|
||||
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign costfactor
|
||||
|
||||
switch and highway= not route=ferry 10000
|
||||
|
@ -130,7 +134,7 @@ assign costfactor
|
|||
switch route=ferry 5.67
|
||||
switch highway=bridleway 5
|
||||
switch highway=cycleway 1.3
|
||||
switch or highway=residential highway=living_street switch isunpaved 10 1.2
|
||||
switch isresidentialorliving switch isunpaved 10 1.2
|
||||
switch highway=service switch isunpaved 10 1.2
|
||||
switch or highway=track or highway=road or highway=path highway=footway
|
||||
switch tracktype=grade1 switch isunpaved 3 1.2
|
||||
|
@ -138,7 +142,7 @@ assign costfactor
|
|||
switch tracktype=grade3 10.0
|
||||
switch tracktype=grade4 20.0
|
||||
switch tracktype=grade5 30.0
|
||||
switch bicycle=designated 2.0
|
||||
switch or bicycle=designated bicycle_road=yes 2.0
|
||||
switch ispaved 2.0 100.0
|
||||
10.0
|
||||
|
||||
|
@ -157,10 +161,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -176,7 +180,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---lookupversion:10
|
||||
---minorversion:11
|
||||
---minorversion:13
|
||||
|
||||
---context:way
|
||||
|
||||
|
@ -634,6 +634,14 @@ embedded_rails;0000000928 tram
|
|||
embedded_rails;0000000007 yes
|
||||
embedded_rails;0000000003 rail
|
||||
|
||||
living_street;0000000404 yes
|
||||
|
||||
sidewalk:bicycle;0000000439 yes designated
|
||||
sidewalk:left:bicycle;0000001722 yes designated
|
||||
sidewalk:right:bicycle;0000002667 yes designated
|
||||
|
||||
bicycle_road;0000006521 yes designated
|
||||
|
||||
---context:node
|
||||
|
||||
highway;0001314954 bus_stop
|
||||
|
@ -879,3 +887,11 @@ traffic_calming;0000000186 dip
|
|||
|
||||
ford;0000037927 yes
|
||||
ford;0000000310 stepping_stones
|
||||
|
||||
direction;0000274642 forward
|
||||
direction;0000249637 backward
|
||||
direction;0000021634 both
|
||||
|
||||
traffic_signals:direction;0000062645 forward
|
||||
traffic_signals:direction;0000033961 backward
|
||||
traffic_signals:direction;0000007309 both
|
||||
|
|
|
@ -29,6 +29,8 @@ assign initialcost switch route=ferry 20000 0
|
|||
#
|
||||
# calculate logical car access
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign motorverhicleaccess
|
||||
switch motor_vehicle=
|
||||
switch vehicle=
|
||||
|
@ -39,7 +41,7 @@ assign motorverhicleaccess
|
|||
switch or highway=tertiary highway=tertiary_link 1
|
||||
switch highway=unclassified 1
|
||||
switch route=ferry 1
|
||||
switch or highway=residential highway=living_street 1
|
||||
switch isresidentialorliving 1
|
||||
switch highway=service 1
|
||||
0
|
||||
or access=yes or access=designated access=destination
|
||||
|
@ -90,7 +92,7 @@ assign costfactor
|
|||
switch highway=unclassified 1.2
|
||||
switch route=ferry 5.67
|
||||
switch highway=bridleway 5
|
||||
switch or highway=residential highway=living_street 2
|
||||
switch isresidentialorliving 2
|
||||
switch highway=service 2
|
||||
switch or highway=track or highway=road highway=path
|
||||
switch tracktype=grade1 5
|
||||
|
@ -113,7 +115,7 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 4 else 2
|
||||
else if ( highway=bridleway|road ) then 2
|
||||
|
@ -126,7 +128,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
else if oneway= then junction=roundabout else oneway=yes|true|1
|
||||
assign isroundabout = junction=roundabout
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ assign defaultaccess
|
|||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
1
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
|
@ -67,6 +69,8 @@ assign costfactor
|
|||
|
||||
# way priorities used for voice hint generation
|
||||
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
|
||||
assign priorityclassifier =
|
||||
|
||||
if ( highway=motorway ) then 30
|
||||
|
@ -80,10 +84,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -95,7 +99,7 @@ assign priorityclassifier =
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ assign is_ldcr =
|
|||
if ignore_cycleroutes then false
|
||||
else any_cycleroute
|
||||
|
||||
assign isbike = or bicycle=yes or or bicycle=permissive bicycle=designated lcn=yes
|
||||
assign isbike = or bicycle_road=yes or bicycle=yes or or bicycle=permissive bicycle=designated lcn=yes
|
||||
assign ispaved = surface=paved|asphalt|concrete|paving_stones
|
||||
assign isunpaved = not or surface= or ispaved surface=fine_gravel|cobblestone
|
||||
assign probablyGood = or ispaved and isbike not isunpaved
|
||||
|
@ -102,7 +102,8 @@ assign bikeaccess =
|
|||
if any_cycleroute then true
|
||||
else if bicycle= then
|
||||
(
|
||||
if vehicle= then defaultaccess
|
||||
if bicycle_road=yes then true
|
||||
else if vehicle= then defaultaccess
|
||||
else not vehicle=private|no
|
||||
)
|
||||
else not bicycle=private|no|dismount
|
||||
|
@ -157,6 +158,7 @@ assign onewaypenalty =
|
|||
# must be >=1 and it's supposed to be close to 1 for
|
||||
# the type of way the routing profile is searching for
|
||||
#
|
||||
assign isresidentialorliving = or highway=residential|living_street living_street=yes
|
||||
assign costfactor
|
||||
|
||||
#
|
||||
|
@ -203,7 +205,7 @@ assign costfactor
|
|||
if ( highway=pedestrian ) then 3
|
||||
else if ( highway=bridleway ) then 5
|
||||
else if ( highway=cycleway ) then 1
|
||||
else if ( highway=residential|living_street ) then ( if isunpaved then 1.5 else 1.1 )
|
||||
else if ( isresidentialorliving ) then ( if isunpaved then 1.5 else 1.1 )
|
||||
else if ( highway=service ) then ( if isunpaved then 1.6 else 1.3 )
|
||||
|
||||
#
|
||||
|
@ -256,10 +258,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( isresidentialorliving ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -274,7 +276,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or isresidentialorliving highway=service ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route
|
|||
assign nodeaccessgranted or any_cycleroute lcn=yes
|
||||
|
||||
assign cycleway
|
||||
or highway=cycleway and highway=path|footway bicycle=designated|yes
|
||||
or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
|
||||
|
||||
assign footway
|
||||
or highway=footway and highway=path foot=designated|yes
|
||||
|
@ -99,6 +99,8 @@ assign defaultaccess
|
|||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
1
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
|
@ -253,7 +255,7 @@ assign costfactor
|
|||
switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege
|
||||
add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
|
||||
switch cycleway 1.3 # Kosten für Fahrradwege
|
||||
switch highway=living_street 4 # Kosten für Spielstraßen
|
||||
switch ( or highway=living_street living_street=yes ) 4 # Kosten für Spielstraßen
|
||||
switch highway=road 7 # Kosten für noch nicht genauer beschriebene Straße
|
||||
switch footway 15 # Kosten für Fußwege
|
||||
switch highway=pedestrian 20 # Kosten für Gehwege
|
||||
|
@ -296,7 +298,7 @@ assign uphillcostfactor
|
|||
switch tracktype=grade5 add lmc 50
|
||||
add lmc 20
|
||||
switch cycleway 1
|
||||
switch highway=living_street 2.5
|
||||
switch ( or highway=living_street living_street=yes ) 2.5
|
||||
switch highway=road 5
|
||||
switch footway 15
|
||||
switch highway=pedestrian 20
|
||||
|
@ -339,7 +341,7 @@ assign downhillcostfactor
|
|||
switch tracktype=grade5 add lmc 50
|
||||
add lmc 20
|
||||
switch cycleway 2
|
||||
switch highway=living_street 8
|
||||
switch ( or highway=living_street living_street=yes ) 8
|
||||
switch highway=road 10
|
||||
switch footway 20
|
||||
switch highway=pedestrian 30
|
||||
|
@ -366,10 +368,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( or highway=residential|living_street living_street=yes ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -384,7 +386,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or highway=residential|living_street|service living_street=yes ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ assign any_cycleroute or route_bicycle_icn=yes or route_bicycle_ncn=yes or route
|
|||
assign nodeaccessgranted or any_cycleroute lcn=yes
|
||||
|
||||
assign cycleway
|
||||
or highway=cycleway and highway=path|footway bicycle=designated|yes
|
||||
or bicycle_road=yes or highway=cycleway and highway=path|footway bicycle=designated|yes
|
||||
|
||||
assign footway
|
||||
or highway=footway and highway=path foot=designated|yes
|
||||
|
@ -99,6 +99,8 @@ assign defaultaccess
|
|||
assign bikeaccess
|
||||
or any_cycleroute
|
||||
switch bicycle=
|
||||
switch bicycle_road=yes
|
||||
1
|
||||
switch vehicle=
|
||||
defaultaccess
|
||||
switch or vehicle=private vehicle=no
|
||||
|
@ -253,7 +255,7 @@ assign costfactor
|
|||
switch tracktype=grade5 add lmc 50 # Kosten für kaum erkennbare Feldwege
|
||||
add lmc 20 # Kosten für Feldwege ohne Oberflächenangabe
|
||||
switch cycleway 2.5 # Kosten für Fahrradwege
|
||||
switch highway=living_street 5 # Kosten für Spielstraßen
|
||||
switch ( or highway=living_street living_street=yes ) 5 # Kosten für Spielstraßen
|
||||
switch highway=road 10 # Kosten für noch nicht genauer beschriebene Straße
|
||||
switch footway 30 # Kosten für Fußwege
|
||||
switch highway=pedestrian 30 # Kosten für Gehwege
|
||||
|
@ -296,7 +298,7 @@ assign uphillcostfactor
|
|||
switch tracktype=grade5 add lmc 50
|
||||
add lmc 20
|
||||
switch cycleway 2
|
||||
switch highway=living_street 5
|
||||
switch ( or highway=living_street living_street=yes ) 5
|
||||
switch highway=road 10
|
||||
switch footway 30
|
||||
switch highway=pedestrian 30
|
||||
|
@ -339,7 +341,7 @@ assign downhillcostfactor
|
|||
switch tracktype=grade5 add lmc 50
|
||||
add lmc 20
|
||||
switch cycleway 5
|
||||
switch highway=living_street 8
|
||||
switch ( or highway=living_street living_street=yes ) 8
|
||||
switch highway=road 10
|
||||
switch footway 30
|
||||
switch highway=pedestrian 30
|
||||
|
@ -366,10 +368,10 @@ assign priorityclassifier =
|
|||
else if ( highway=tertiary ) then 22
|
||||
else if ( highway=tertiary_link ) then 21
|
||||
else if ( highway=unclassified ) then 20
|
||||
else if ( highway=residential|living_street ) then 6
|
||||
else if ( or highway=residential|living_street living_street=yes ) then 6
|
||||
else if ( highway=service ) then 6
|
||||
else if ( highway=cycleway ) then 6
|
||||
else if ( bicycle=designated ) then 6
|
||||
else if ( or bicycle=designated bicycle_road=yes ) then 6
|
||||
else if ( highway=track ) then if tracktype=grade1 then 6 else 4
|
||||
else if ( highway=bridleway|road|path|footway ) then 4
|
||||
else if ( highway=steps ) then 2
|
||||
|
@ -384,7 +386,7 @@ assign isgoodoneway = if reversedirection=yes then oneway=-1
|
|||
assign isroundabout = junction=roundabout
|
||||
assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
|
||||
assign isgoodforcars = if greater priorityclassifier 6 then true
|
||||
else if highway=residential|living_street|service then true
|
||||
else if ( or highway=residential|living_street|service living_street=yes ) then true
|
||||
else if ( and highway=track tracktype=grade1 ) then true
|
||||
else false
|
||||
|
||||
|
|
81
misc/readmes/mapcreation.md
Normal file
81
misc/readmes/mapcreation.md
Normal file
|
@ -0,0 +1,81 @@
|
|||
Build your own BRouter segments files
|
||||
=====================================
|
||||
|
||||
BRouter uses its own data format (`.rd5` files), split in tiles of 5 x 5
|
||||
in latitude and longitude. You can download the official segment files (weekly
|
||||
built) from [brouter.de](http://brouter.de/brouter/segments4/) but you can
|
||||
also build them yourself from an OSM dump.
|
||||
|
||||
|
||||
## Build the pbfparser
|
||||
|
||||
First, there are two file formats available to download OSM data: `bzip`-ed
|
||||
XML files (very large) and `.pbf`
|
||||
([Protobuf](https://github.com/protocolbuffers/protobuf) format) which is much
|
||||
more efficient. If you want to use the latter one, you will have to build the
|
||||
`pbfparser` (located in `misc/pbfparser` first):
|
||||
|
||||
* Download [the latest
|
||||
version](https://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip)
|
||||
of [Osmosis](https://wiki.openstreetmap.org/wiki/Osmosis) and unzip it
|
||||
somewhere.
|
||||
* Copy the `lib/default/protobuf-java-*.jar` and
|
||||
`lib/default/osmosis-osm-binary-*.jar` files from the unzipped Osmosis
|
||||
archive to `misc/pbfparser/protobuf.jar` and `misc/pbfparser/osmosis.jar`.
|
||||
* Build BRouter and copy
|
||||
`brouter-server/target/brouter-server-*-jar-with-dependencies.jar` to
|
||||
`misc/pbfparser/brouter.jar`.
|
||||
* You can build the `pbfparser` using, in the `misc/pbfparser/`
|
||||
folder,
|
||||
|
||||
```
|
||||
javac -d . -cp "brouter.jar:protobuf.jar:osmosis.jar" *.java
|
||||
```
|
||||
|
||||
* Finally, you can build a `jar` file from these files using
|
||||
|
||||
```
|
||||
jar cf pbfparser.jar btools/**/*.class
|
||||
```
|
||||
|
||||
_Note:_ If the `jar` file is not properly created, everything else will seem
|
||||
to work normally but there will not be any data extracted from the OSM data
|
||||
dump. You can check what is actually inside the built `jar` file using
|
||||
`jar tf pbfparser.jar`.
|
||||
|
||||
|
||||
## Run the map creation script
|
||||
|
||||
If you want to have elevation information in the generated segments files, you
|
||||
should download the required [SRTM
|
||||
files](https://cgiarcsi.community/data/srtm-90m-digital-elevation-database-v4-1/)
|
||||
and set the `SRTM_PATH` variable when running the `process_pbf_planet.sh`
|
||||
script.
|
||||
|
||||
Any flavor of the 90m SRTM database should be working, but the one used by the
|
||||
official BRouter segments files are the ones provided by
|
||||
[CGIAR](https://cgiarcsi.community/data/srtm-90m-digital-elevation-database-v4-1/).
|
||||
If you are working with rather small geographical extracts, you can download
|
||||
tiles manually using [this
|
||||
interface](http://srtm.csi.cgiar.org/SELECTION/inputCoord.asp) (use the
|
||||
"ArcInfo ASCII" format), instead of having to ask for an access for bulk
|
||||
download of data. There is no need to unzip the downloaded files, the
|
||||
`process_pbf_planet.sh` script expects a folder with all the ZIP files inside
|
||||
and will manage it.
|
||||
|
||||
Note that if you don't have the SRTM data available, the segments files will
|
||||
still be generated without any issue (but they will miss the elevation data).
|
||||
If you are not sure which SRTM files you have to download, you can run the
|
||||
script once and it will log all the SRTM files it is looking for.
|
||||
|
||||
You can now run the `misc/scripts/mapcreation/process_pbf_planet.sh` script to
|
||||
build the segments. Have a look at the variables defined at the beginning of
|
||||
the files and overwrite them according to your needs. By default, the script
|
||||
will download the latest full planet dump from
|
||||
[planet.osm.org](https://planet.osm.org/). You can also download a
|
||||
geographical extract provided by [Geofabrik](https://download.geofabrik.de/)
|
||||
and set the `PLANET_FILE` variable to point to it.
|
||||
|
||||
_Note:_ It is possible that you encounter an error complaining about not being
|
||||
able to run `bash^M` on Linux/Mac OS. You can fix this one by running
|
||||
`sed -i -e 's/\r$//' process_pbf_planet.sh`.
|
64
misc/readmes/osmand/README.md
Normal file
64
misc/readmes/osmand/README.md
Normal file
|
@ -0,0 +1,64 @@
|
|||
Using BRouter on Android with OSMAnd
|
||||
====================================
|
||||
|
||||
BRouter integration in OSMAnd changed a lot during the summer of 2019. This
|
||||
guide assumes you are using the BRouter Android app in version 1.5.0 or higher
|
||||
as well as OSMAnd in version 3.4 or higher.
|
||||
|
||||
|
||||
## Installing BRouter app on your Android device
|
||||
|
||||
First, install the BRouter app on your Android device from
|
||||
[F-Droid](https://f-droid.org/packages/btools.routingapp) or [Google Play
|
||||
Store](https://play.google.com/store/apps/details?id=btools.routingapp). You
|
||||
can also build the BRouter Android app yourself.
|
||||
|
||||
<a href="https://f-droid.org/packages/btools.routingapp" target="_blank">
|
||||
<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" height="90"/></a>
|
||||
<a href="https://play.google.com/store/apps/details?id=btools.routingapp" target="_blank">
|
||||
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" alt="Get it on Google Play" height="90"/></a>
|
||||
|
||||
|
||||
## Downloading BRouter segments
|
||||
|
||||
Then, launch the BRouter app and choose "Download Manager". Zoom in and select
|
||||
the areas you want to route in. Then click "Start Download" and BRouter will
|
||||
start downloading the [segments](http://brouter.de/brouter/segments4/) files
|
||||
for the selected areas.
|
||||
|
||||
<img src="./brouter-main.png" alt="Main menu of BRouter android app"/>
|
||||
|
||||
<img src="./brouter-grid.png" alt="Grid selection of segments to download"/>
|
||||
|
||||
Note that you will have to repeat this step periodically, whenever you want to have an
|
||||
updated version of the OSM data used for the routing.
|
||||
|
||||
|
||||
## Selecting profiles to use
|
||||
|
||||
Once this is done, start again the BRouter app and choose the "BRouter App"
|
||||
entry on the main menu. Select the routing profile you want to use and click
|
||||
"Server-Mode". Then, tick the boxes for the routing modes you want to use this
|
||||
profile for. You can use two different profiles per transportation mode, which
|
||||
will be mapped to the "shortest" and "fastest" presets (these are just
|
||||
labelling) in OSMAnd.
|
||||
|
||||
<img src="./brouter-profiles.png" alt="Profiles selection"/>
|
||||
|
||||
<img src="./brouter-profiles-summary.png" alt="Profiles selection summary"/>
|
||||
|
||||
|
||||
## Configure OSMAnd to make use of BRouter offline navigation
|
||||
|
||||
You can now create an "Application profile" in OSMAnd which will be using
|
||||
BRouter for offline routing. Go to Settings -> Application profiles -> Add and
|
||||
create a new profile based on the base profile of your choice (cycling here,
|
||||
for bicycle routing), with a custom name of your choice ("BRouter" on the
|
||||
screenshot below) and making use of "BRouter (offline)" for navigation.
|
||||
|
||||
<img src="./brouter-osmand.png" alt="BRouter configuration in OSMAnd
|
||||
application profiles"/>
|
||||
|
||||
The BRouter app should be launched before OSMAnd for this specific entry to
|
||||
appear in OSMAnd. Therefore, if you cannot find "BRouter (offline)" navigation
|
||||
option, you should force quit OSMAnd and restart it.
|
BIN
misc/readmes/osmand/brouter-grid.png
Normal file
BIN
misc/readmes/osmand/brouter-grid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
BIN
misc/readmes/osmand/brouter-main.png
Normal file
BIN
misc/readmes/osmand/brouter-main.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
misc/readmes/osmand/brouter-osmand.png
Normal file
BIN
misc/readmes/osmand/brouter-osmand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
misc/readmes/osmand/brouter-profiles-summary.png
Normal file
BIN
misc/readmes/osmand/brouter-profiles-summary.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
misc/readmes/osmand/brouter-profiles.png
Normal file
BIN
misc/readmes/osmand/brouter-profiles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
|
@ -1,6 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
wget -N http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Fetch OSM planet dump if no planet file is specified
|
||||
if [ -z "$PLANET_FILE" ]; then
|
||||
if [ -x "$(command -v osmupdate)" ] && [[ -f "./planet-latest.osm.pbf" ]]; then
|
||||
# Prefer running osmupdate to update the planet file if available
|
||||
mv "./planet-latest.osm.pbf" "./planet-latest.old.osm.pbf"
|
||||
osmupdate "planet-latest.old.osm.pbf" "./planet-latest.osm.pbf"
|
||||
rm "./planet-latest.old.osm.pbf"
|
||||
else
|
||||
# Otherwise, download it again
|
||||
wget -N http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
|
||||
fi
|
||||
fi
|
||||
|
||||
if test lastmaprun.date -nt planet-latest.osm.pbf; then
|
||||
echo "no osm update, exiting"
|
||||
|
@ -20,7 +33,7 @@ OSMOSIS_JAR=$(realpath "../../pbfparser/osmosis.jar")
|
|||
PROTOBUF_JAR=$(realpath "../../pbfparser/protobuf.jar")
|
||||
PBFPARSER_JAR=$(realpath "../../pbfparser/pbfparser.jar")
|
||||
|
||||
PLANET_FILE=$(realpath "./planet-latest.osm.pbf")
|
||||
PLANET_FILE=${PLANET_FILE:-$(realpath "./planet-latest.osm.pbf")}
|
||||
# Download SRTM zip files from
|
||||
# https://cgiarcsi.community/data/srtm-90m-digital-elevation-database-v4-1/
|
||||
# (use the "ArcInfo ASCII" version) and put the ZIP files directly in this
|
||||
|
|
Loading…
Reference in a new issue