Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'feature/opposite_direction' into develop

  • Loading branch information...
commit 348e656671529b51c91099802b9b7a11abeb3e54 2 parents 7c5ca8f + 54cdf6d
DennisOSRM authored
Showing with 1,043 additions and 624 deletions.
  1. +6 −4 Contractor/Contractor.h
  2. +19 −8 Contractor/EdgeBasedGraphFactory.cpp
  3. +28 −27 Contractor/EdgeBasedGraphFactory.h
  4. +12 −0 DataStructures/DeallocatingVector.h
  5. +1 −0  DataStructures/DynamicGraph.h
  6. +10 −6 DataStructures/ImportEdge.h
  7. +5 −4 DataStructures/NNGrid.h
  8. +4 −38 DataStructures/TurnInstructions.h
  9. +5 −4 Extractor/ExtractionContainers.cpp
  10. +1 −1  Extractor/ExtractionContainers.h
  11. +62 −24 Extractor/ExtractorCallbacks.cpp
  12. +1 −1  Extractor/ExtractorCallbacks.h
  13. +34 −32 Extractor/ExtractorStructs.h
  14. +4 −4 Extractor/PBFParser.cpp
  15. +1 −1  Extractor/PBFParser.h
  16. +12 −11 Extractor/ScriptingEnvironment.cpp
  17. +3 −3 Extractor/XMLParser.cpp
  18. +2 −2 Extractor/XMLParser.h
  19. +3 −2 Util/GraphLoader.h
  20. +1 −3 extractor.cpp
  21. +92 −75 features/bicycle/access.feature
  22. +64 −0 features/bicycle/access_node.feature
  23. +10 −10 features/bicycle/cycleway.feature
  24. +32 −0 features/bicycle/maxspeed.feature
  25. +72 −71 features/bicycle/oneway.feature
  26. +72 −0 features/bicycle/pushing.feature
  27. +60 −60 features/bicycle/restrictions.feature
  28. +33 −27 features/bicycle/way.feature
  29. +23 −3 features/car/maxspeed.feature
  30. 0  features/car/permissive.feature
  31. +4 −1 features/step_definitions/routing.rb
  32. +4 −3 features/support/data.rb
  33. +52 −0 features/testbot/maxspeed.feature
  34. +7 −8 features/testbot/opposite.feature
  35. +1 −0  profile.lua
  36. +0 −1  profile.lua
  37. +105 −60 profiles/bicycle.lua
  38. +154 −129 profiles/car.lua
  39. +44 −1 profiles/testbot.lua
View
10 Contractor/Contractor.h
@@ -157,11 +157,13 @@ class Contractor {
forwardEdge.data.distance = backwardEdge.data.distance = std::numeric_limits< int >::max();
//remove parallel edges
while ( i < edges.size() && edges[i].source == source && edges[i].target == target ) {
- if ( edges[i].data.forward )
+ if ( edges[i].data.forward) {
forwardEdge.data.distance = std::min( edges[i].data.distance, forwardEdge.data.distance );
- if ( edges[i].data.backward )
+ }
+ if ( edges[i].data.backward) {
backwardEdge.data.distance = std::min( edges[i].data.distance, backwardEdge.data.distance );
- i++;
+ }
+ ++i;
}
//merge edges (s,t) and (t,s) into bidirectional edge
if ( forwardEdge.data.distance == backwardEdge.data.distance ) {
@@ -242,7 +244,7 @@ class Contractor {
nodePriority[x] = _Evaluate( data, &nodeData[x], x );
}
}
- std::cout << "ok" << std::endl << "preprocessing ..." << std::flush;
+ std::cout << "ok" << std::endl << "preprocessing " << numberOfNodes << " nodes ..." << std::flush;
bool flushedContractor = false;
while ( numberOfContractedNodes < numberOfNodes ) {
View
27 Contractor/EdgeBasedGraphFactory.cpp
@@ -61,9 +61,9 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
edge.data.forward = i->isForward();
edge.data.backward = i->isBackward();
}
- if(edge.source == edge.target)
- continue;
-
+ if(edge.source == edge.target) {
+ continue;
+ }
edge.data.distance = (std::max)((int)i->weight(), 1 );
assert( edge.data.distance > 0 );
edge.data.shortcut = false;
@@ -73,6 +73,7 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
edge.data.type = i->type();
edge.data.isAccessRestricted = i->isAccessRestricted();
edge.data.edgeBasedNodeID = edges.size();
+ edge.data.contraFlow = i->isContraFlow();
edges.push_back( edge );
if( edge.data.backward ) {
std::swap( edge.source, edge.target );
@@ -107,7 +108,7 @@ NodeID EdgeBasedGraphFactory::CheckForEmanatingIsOnlyTurn(const NodeID u, const
RestrictionMap::const_iterator restrIter = _restrictionMap.find(restrictionSource);
if (restrIter != _restrictionMap.end()) {
unsigned index = restrIter->second;
- BOOST_FOREACH(RestrictionSource restrictionTarget, _restrictionBucketVector.at(index)) {
+ BOOST_FOREACH(const RestrictionSource & restrictionTarget, _restrictionBucketVector.at(index)) {
if(restrictionTarget.second) {
return restrictionTarget.first;
}
@@ -239,6 +240,7 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename) {
for(_NodeBasedDynamicGraph::EdgeIterator e1 = _nodeBasedGraph->BeginEdges(u); e1 < _nodeBasedGraph->EndEdges(u); ++e1) {
++nodeBasedEdgeCounter;
_NodeBasedDynamicGraph::NodeIterator v = _nodeBasedGraph->GetTarget(e1);
+ bool isBollardNode = (_barrierNodes.find(v) != _barrierNodes.end());
//EdgeWeight heightPenalty = ComputeHeightPenalty(u, v);
NodeID onlyToNode = CheckForEmanatingIsOnlyTurn(u, v);
for(_NodeBasedDynamicGraph::EdgeIterator e2 = _nodeBasedGraph->BeginEdges(v); e2 < _nodeBasedGraph->EndEdges(v); ++e2) {
@@ -248,7 +250,7 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename) {
++numberOfSkippedTurns;
continue;
}
- bool isBollardNode = (_barrierNodes.find(v) != _barrierNodes.end());
+
if(u == w && 1 != _nodeBasedGraph->GetOutDegree(v) ) {
continue;
}
@@ -291,7 +293,6 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename) {
originalEdgeData.clear();
}
++numberOfOriginalEdges;
- ++nodeBasedEdgeCounter;
edgeBasedEdges.push_back(newEdge);
} else {
++numberOfSkippedTurns;
@@ -316,6 +317,7 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename) {
// std::vector<EdgeBasedNode>(edgeBasedNodes).swap(edgeBasedNodes);
// INFO("size: " << edgeBasedNodes.size() << ", cap: " << edgeBasedNodes.capacity());
INFO("Node-based graph contains " << nodeBasedEdgeCounter << " edges");
+ INFO("Edge-based graph contains " << edgeBasedEdges.size() << " edges");
// INFO("Edge-based graph contains " << edgeBasedEdges.size() << " edges, blowup is " << 2*((double)edgeBasedEdges.size()/(double)nodeBasedEdgeCounter));
INFO("Edge-based graph skipped " << numberOfSkippedTurns << " turns, defined by " << numberOfTurnRestrictions << " restrictions.");
INFO("Generated " << edgeBasedNodes.size() << " edge based nodes");
@@ -332,6 +334,13 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID
_NodeBasedDynamicGraph::EdgeData & data1 = _nodeBasedGraph->GetEdgeData(edge1);
_NodeBasedDynamicGraph::EdgeData & data2 = _nodeBasedGraph->GetEdgeData(edge2);
+ if(!data1.contraFlow && data2.contraFlow) {
+ return TurnInstructions.EnterAgainstAllowedDirection;
+ }
+ if(data1.contraFlow && !data2.contraFlow) {
+ return TurnInstructions.LeaveAgainstAllowedDirection;
+ }
+
//roundabouts need to be handled explicitely
if(data1.roundabout && data2.roundabout) {
//Is a turn possible? If yes, we stay on the roundabout!
@@ -353,10 +362,12 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID
}
//If street names stay the same and if we are certain that it is not a roundabout, we skip it.
- if( (data1.nameID == data2.nameID) && (0 != data1.nameID))
+ if( (data1.nameID == data2.nameID) && (0 != data1.nameID)) {
return TurnInstructions.NoTurn;
- if( (data1.nameID == data2.nameID) && (0 == data1.nameID) && (_nodeBasedGraph->GetOutDegree(v) <= 2) )
+ }
+ if( (data1.nameID == data2.nameID) && (0 == data1.nameID) && (_nodeBasedGraph->GetOutDegree(v) <= 2) ) {
return TurnInstructions.NoTurn;
+ }
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
return TurnInstructions.GetTurnDirectionOfInstruction(angle);
View
55 Contractor/EdgeBasedGraphFactory.h
@@ -34,6 +34,7 @@
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/make_shared.hpp>
+#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
@@ -49,7 +50,32 @@
#include "../DataStructures/TurnInstructions.h"
#include "../Util/BaseConfiguration.h"
-class EdgeBasedGraphFactory {
+class EdgeBasedGraphFactory : boost::noncopyable {
+public:
+ struct EdgeBasedNode {
+ bool operator<(const EdgeBasedNode & other) const {
+ return other.id < id;
+ }
+ bool operator==(const EdgeBasedNode & other) const {
+ return id == other.id;
+ }
+ NodeID id;
+ int lat1;
+ int lat2;
+ int lon1;
+ int lon2:31;
+ bool belongsToTinyComponent:1;
+ NodeID nameID;
+ unsigned weight:31;
+ bool ignoreInGrid:1;
+ };
+
+ struct SpeedProfileProperties{
+ SpeedProfileProperties() : trafficSignalPenalty(0), uTurnPenalty(0) {}
+ int trafficSignalPenalty;
+ int uTurnPenalty;
+ } speedProfile;
+
private:
struct _NodeBasedEdgeData {
int distance;
@@ -62,6 +88,7 @@ class EdgeBasedGraphFactory {
bool backward:1;
bool roundabout:1;
bool ignoreInGrid:1;
+ bool contraFlow;
};
struct _EdgeBasedEdgeData {
@@ -77,32 +104,7 @@ class EdgeBasedGraphFactory {
typedef _NodeBasedDynamicGraph::InputEdge _NodeBasedEdge;
std::vector<NodeInfo> inputNodeInfoList;
unsigned numberOfTurnRestrictions;
-public:
- struct EdgeBasedNode {
- bool operator<(const EdgeBasedNode & other) const {
- return other.id < id;
- }
- bool operator==(const EdgeBasedNode & other) const {
- return id == other.id;
- }
- NodeID id;
- int lat1;
- int lat2;
- int lon1;
- int lon2:31;
- bool belongsToTinyComponent:1;
- NodeID nameID;
- unsigned weight:31;
- bool ignoreInGrid:1;
- };
-
- struct SpeedProfileProperties{
- SpeedProfileProperties() : trafficSignalPenalty(0), uTurnPenalty(0) {}
- int trafficSignalPenalty;
- int uTurnPenalty;
- } speedProfile;
-private:
boost::shared_ptr<_NodeBasedDynamicGraph> _nodeBasedGraph;
boost::unordered_set<NodeID> _barrierNodes;
boost::unordered_set<NodeID> _trafficLights;
@@ -114,7 +116,6 @@ class EdgeBasedGraphFactory {
std::vector<EmanatingRestrictionsVector> _restrictionBucketVector;
RestrictionMap _restrictionMap;
-
DeallocatingVector<EdgeBasedEdge> edgeBasedEdges;
DeallocatingVector<EdgeBasedNode> edgeBasedNodes;
std::vector<OriginalEdgeData> originalEdgeData;
View
12 DataStructures/DeallocatingVector.h
@@ -302,6 +302,18 @@ class DeallocatingVector {
size_t _index = index % bucketSizeC;
return (mBucketList[_bucket][_index]);
}
+
+ inline ElementT & back() {
+ size_t _bucket = mCurrentSize / bucketSizeC;
+ size_t _index = mCurrentSize % bucketSizeC;
+ return (mBucketList[_bucket][_index]);
+ }
+
+ const inline ElementT & back() const {
+ size_t _bucket = mCurrentSize / bucketSizeC;
+ size_t _index = mCurrentSize % bucketSizeC;
+ return (mBucketList[_bucket][_index]);
+ }
};
#endif /* DEALLOCATINGVECTOR_H_ */
View
1  DataStructures/DynamicGraph.h
@@ -72,6 +72,7 @@ class DynamicGraph {
m_nodes[node].edges = edge - lastEdge;
position += m_nodes[node].edges;
}
+ m_nodes.back().firstEdge = position;
m_edges.reserve( position * 1.1 );
m_edges.resize( position );
edge = 0;
View
16 DataStructures/ImportEdge.h
@@ -40,12 +40,8 @@ class NodeBasedEdge {
return (source() < e.source());
}
- /** Default constructor. target and weight are set to 0.*/
- NodeBasedEdge() :
- _source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false), _ignoreInGrid(false), _accessRestricted(false) { assert(false); } //shall not be used.
-
- explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra, bool ig, bool ar) :
- _source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar) { if(ty < 0) {ERR("Type: " << ty);}; }
+ explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra, bool ig, bool ar, bool cf) :
+ _source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _contraFlow(cf) { if(ty < 0) {ERR("Type: " << ty);}; }
NodeID target() const {return _target; }
NodeID source() const {return _source; }
@@ -59,6 +55,7 @@ class NodeBasedEdge {
bool isRoundabout() const { return _roundabout; }
bool ignoreInGrid() const { return _ignoreInGrid; }
bool isAccessRestricted() const { return _accessRestricted; }
+ bool isContraFlow() const { return _contraFlow; }
NodeID _source;
NodeID _target;
@@ -70,6 +67,13 @@ class NodeBasedEdge {
bool _roundabout;
bool _ignoreInGrid;
bool _accessRestricted;
+ bool _contraFlow;
+
+private:
+ /** Default constructor. target and weight are set to 0.*/
+ NodeBasedEdge() :
+ _source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false), _ignoreInGrid(false), _accessRestricted(false), _contraFlow(false) { assert(false); } //shall not be used.
+
};
class EdgeBasedEdge {
View
9 DataStructures/NNGrid.h
@@ -221,7 +221,7 @@ class NNGrid {
// }
// INFO("startCoord: " << smallestEdge.startCoord << "; targetCoord: " << smallestEdge.targetCoord << "; newEndpoint: " << resultNode.location);
- double ratio = (foundNode ? std::min(1., ApproximateDistance(smallestEdge.startCoord, resultNode.location)/ApproximateDistance(smallestEdge.startCoord, smallestEdge.targetCoord)) : 0);
+ const double ratio = (foundNode ? std::min(1., ApproximateDistance(smallestEdge.startCoord, resultNode.location)/ApproximateDistance(smallestEdge.startCoord, smallestEdge.targetCoord)) : 0);
resultNode.location.lat = round(100000.*(y2lat(static_cast<double>(resultNode.location.lat)/100000.)));
// INFO("Length of vector: " << ApproximateDistance(smallestEdge.startCoord, resultNode.location)/ApproximateDistance(smallestEdge.startCoord, smallestEdge.targetCoord));
//Hack to fix rounding errors and wandering via nodes.
@@ -232,12 +232,13 @@ class NNGrid {
resultNode.weight1 *= ratio;
if(INT_MAX != resultNode.weight2) {
- resultNode.weight2 -= resultNode.weight1;
+ resultNode.weight2 *= (1.-ratio);
}
resultNode.ratio = ratio;
-// INFO("New weight1: " << resultNode.weight1 << ", new weight2: " << resultNode.weight2 << ", ratio: " << ratio);
// INFO("start: " << edgeStartCoord << ", end: " << edgeEndCoord);
-// INFO("selected node: " << resultNode.edgeBasedNode << ", bidirected: " << (resultNode.isBidirected() ? "yes" : "no") << "\n--");
+// INFO("selected node: " << resultNode.edgeBasedNode << ", bidirected: " << (resultNode.isBidirected() ? "yes" : "no"));
+// INFO("New weight1: " << resultNode.weight1 << ", new weight2: " << resultNode.weight2 << ", ratio: " << ratio);
+ // INFO("distance to input coordinate: " << ApproximateDistance(location, resultNode.location) << "\n--");
// double time2 = get_timestamp();
// INFO("NN-Lookup in " << 1000*(time2-time1) << "ms");
return foundNode;
View
42 DataStructures/TurnInstructions.h
@@ -21,12 +21,12 @@
#ifndef TURNINSTRUCTIONS_H_
#define TURNINSTRUCTIONS_H_
-#include <string>
+#include <boost/noncopyable.hpp>
typedef unsigned char TurnInstruction;
//This is a hack until c++0x is available enough to use scoped enums
-struct TurnInstructionsClass {
+struct TurnInstructionsClass : boost::noncopyable {
const static TurnInstruction NoTurn = 0; //Give no instruction at all
const static TurnInstruction GoStraight = 1; //Tell user to go straight!
@@ -44,48 +44,14 @@ struct TurnInstructionsClass {
const static TurnInstruction StayOnRoundAbout = 13;
const static TurnInstruction StartAtEndOfStreet = 14;
const static TurnInstruction ReachedYourDestination = 15;
+ const static TurnInstruction EnterAgainstAllowedDirection = 16;
+ const static TurnInstruction LeaveAgainstAllowedDirection = 17;
const static TurnInstruction AccessRestrictionFlag = 128;
const static TurnInstruction InverseAccessRestrictionFlag = 0x7f; // ~128 does not work without a warning.
const static int AccessRestrictionPenalty = 1 << 15; //unrelated to the bit set in the restriction flag
-// std::string TurnStrings[16];
-// std::string Ordinals[12];
-
- //This is a hack until c++0x is available enough to use initializer lists.
-// TurnInstructionsClass(){
-// TurnStrings [0] = "";
-// TurnStrings [1] = "Continue";
-// TurnStrings [2] = "Turn slight right";
-// TurnStrings [3] = "Turn right";
-// TurnStrings [4] = "Turn sharp right";
-// TurnStrings [5] = "U-Turn";
-// TurnStrings [6] = "Turn sharp left";
-// TurnStrings [7] = "Turn left";
-// TurnStrings [8] = "Turn slight left";
-// TurnStrings [9] = "Reach via point";
-// TurnStrings[10] = "Head";
-// TurnStrings[11] = "Enter roundabout";
-// TurnStrings[12] = "Leave roundabout";
-// TurnStrings[13] = "Stay on roundabout";
-// TurnStrings[14] = "Start";
-// TurnStrings[15] = "You have reached your destination";
-//
-// Ordinals[0] = "zeroth";
-// Ordinals[1] = "first";
-// Ordinals[2] = "second";
-// Ordinals[3] = "third";
-// Ordinals[4] = "fourth";
-// Ordinals[5] = "fifth";
-// Ordinals[6] = "sixth";
-// Ordinals[7] = "seventh";
-// Ordinals[8] = "eighth";
-// Ordinals[9] = "nineth";
-// Ordinals[10] = "tenth";
-// Ordinals[11] = "one of the too many";
-// };
-
static inline TurnInstruction GetTurnDirectionOfInstruction( const double angle ) {
if(angle >= 23 && angle < 67) {
return TurnSharpRight;
View
9 Extractor/ExtractionContainers.cpp
@@ -231,17 +231,17 @@ void ExtractionContainers::PrepareData(const std::string & outputFileName, const
fout.write((char*)&edgeIT->target, sizeof(unsigned));
fout.write((char*)&intDist, sizeof(int));
switch(edgeIT->direction) {
- case _Way::notSure:
+ case ExtractionWay::notSure:
fout.write((char*)&zero, sizeof(short));
break;
- case _Way::oneway:
+ case ExtractionWay::oneway:
fout.write((char*)&one, sizeof(short));
break;
- case _Way::bidirectional:
+ case ExtractionWay::bidirectional:
fout.write((char*)&zero, sizeof(short));
break;
- case _Way::opposite:
+ case ExtractionWay::opposite:
fout.write((char*)&one, sizeof(short));
break;
default:
@@ -256,6 +256,7 @@ void ExtractionContainers::PrepareData(const std::string & outputFileName, const
fout.write((char*)&edgeIT->isRoundabout, sizeof(bool));
fout.write((char*)&edgeIT->ignoreInGrid, sizeof(bool));
fout.write((char*)&edgeIT->isAccessRestricted, sizeof(bool));
+ fout.write((char*)&edgeIT->isContraFlow, sizeof(bool));
}
++usedEdgeCounter;
++edgeIT;
View
2  Extractor/ExtractionContainers.h
@@ -31,7 +31,7 @@ class ExtractionContainers {
public:
typedef stxxl::vector<NodeID> STXXLNodeIDVector;
typedef stxxl::vector<_Node> STXXLNodeVector;
- typedef stxxl::vector<_Edge> STXXLEdgeVector;
+ typedef stxxl::vector<InternalExtractorEdge> STXXLEdgeVector;
typedef stxxl::vector<std::string> STXXLStringVector;
typedef stxxl::vector<_RawRestrictionContainer> STXXLRestrictionsVector;
typedef stxxl::vector<_WayIDStartAndEndEdge> STXXLWayIDStartEndVector;
View
86 Extractor/ExtractorCallbacks.cpp
@@ -64,46 +64,84 @@ bool ExtractorCallbacks::restrictionFunction(_RawRestrictionContainer &r) {
}
/** warning: caller needs to take care of synchronization! */
-bool ExtractorCallbacks::wayFunction(_Way &w) {
- /*** Store name of way and split it into edge segments ***/
-
- if ( (0 < w.speed) || (0 < w.duration) ) { //Only true if the way is specified by the speed profile
+bool ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
+ if ( parsed_way.speed > 0 || (0 < parsed_way.duration)) { //Only true if the way is specified by the speed profile
+ if(parsed_way.id == UINT_MAX){
+ WARN("found bogus way with id: " << parsed_way.id << " of size " << parsed_way.path.size());
+ return true;
+ }
//Get the unique identifier for the street name
- const StringMap::const_iterator strit = stringMap->find(w.name);
- if(strit == stringMap->end()) {
- w.nameID = externalMemory->nameVector.size();
- externalMemory->nameVector.push_back(w.name);
- stringMap->insert(StringMap::value_type(w.name, w.nameID));
+ const StringMap::const_iterator string_map_iterator = stringMap->find(parsed_way.name);
+ if(string_map_iterator == stringMap->end()) {
+ parsed_way.nameID = externalMemory->nameVector.size();
+ externalMemory->nameVector.push_back(parsed_way.name);
+ stringMap->insert(StringMap::value_type(parsed_way.name, parsed_way.nameID));
} else {
- w.nameID = strit->second;
+ parsed_way.nameID = string_map_iterator->second;
}
- if(w.duration > 0) {
- //TODO: iterate all way segments and set duration corresponding to the length of each segment
- w.speed = w.duration/(w.path.size()-1);
+ if(parsed_way.duration > 0) {
+ //TODO: iterate all way segments and set duration corresponding to the length of each segment
+ parsed_way.speed = parsed_way.duration/(parsed_way.path.size()-1);
}
- if(fabs(-1. - w.speed) < FLT_EPSILON){
- WARN("found way with bogus speed, id: " << w.id);
+ if(fabs(-1. - parsed_way.speed) < FLT_EPSILON){
+ WARN("found way with bogus speed, id: " << parsed_way.id);
return true;
}
- if(w.id == UINT_MAX) {
- WARN("found way with unknown type: " << w.id);
+ if(parsed_way.id == UINT_MAX) {
+ WARN("found way with unknown type: " << parsed_way.id);
return true;
}
- if ( w.direction == _Way::opposite ){
- std::reverse( w.path.begin(), w.path.end() );
+ if ( parsed_way.direction == ExtractionWay::opposite ){
+ std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
+ parsed_way.direction = ExtractionWay::oneway;
}
- for(std::vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
- externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout, w.ignoreInGrid, (w.duration > 0), w.isAccessRestricted));
- externalMemory->usedNodeIDs.push_back(w.path[n]);
+ bool split_bidirectional_edge = (parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed);
+
+ for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
+ externalMemory->allEdges.push_back(
+ InternalExtractorEdge(parsed_way.path[n],
+ parsed_way.path[n+1],
+ parsed_way.type,
+ (split_bidirectional_edge ? ExtractionWay::oneway : parsed_way.direction),
+ parsed_way.speed,
+ parsed_way.nameID,
+ parsed_way.roundabout,
+ parsed_way.ignoreInGrid,
+ (0 < parsed_way.duration),
+ parsed_way.isAccessRestricted
+ )
+ );
+ externalMemory->usedNodeIDs.push_back(parsed_way.path[n]);
}
- externalMemory->usedNodeIDs.push_back(w.path.back());
+ externalMemory->usedNodeIDs.push_back(parsed_way.path.back());
//The following information is needed to identify start and end segments of restrictions
- externalMemory->wayStartEndVector.push_back(_WayIDStartAndEndEdge(w.id, w.path[0], w.path[1], w.path[w.path.size()-2], w.path[w.path.size()-1]));
+ externalMemory->wayStartEndVector.push_back(_WayIDStartAndEndEdge(parsed_way.id, parsed_way.path[0], parsed_way.path[1], parsed_way.path[parsed_way.path.size()-2], parsed_way.path.back()));
+
+ if ( split_bidirectional_edge) { //Only true if the way should be split
+ std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
+ for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
+ externalMemory->allEdges.push_back(
+ InternalExtractorEdge(parsed_way.path[n],
+ parsed_way.path[n+1],
+ parsed_way.type,
+ ExtractionWay::oneway,
+ parsed_way.backward_speed,
+ parsed_way.nameID,
+ parsed_way.roundabout,
+ parsed_way.ignoreInGrid,
+ (0 < parsed_way.duration),
+ parsed_way.isAccessRestricted,
+ (ExtractionWay::oneway == parsed_way.direction)
+ )
+ );
+ }
+ externalMemory->wayStartEndVector.push_back(_WayIDStartAndEndEdge(parsed_way.id, parsed_way.path[0], parsed_way.path[1], parsed_way.path[parsed_way.path.size()-2], parsed_way.path.back()));
+ }
}
return true;
}
View
2  Extractor/ExtractorCallbacks.h
@@ -50,7 +50,7 @@ class ExtractorCallbacks{
bool restrictionFunction(_RawRestrictionContainer &r);
/** warning: caller needs to take care of synchronization! */
- bool wayFunction(_Way &w);
+ bool wayFunction(ExtractionWay &w);
};
View
66 Extractor/ExtractorStructs.h
@@ -40,8 +40,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
typedef boost::unordered_map<std::string, NodeID > StringMap;
typedef boost::unordered_map<std::string, std::pair<int, short> > StringToIntPairMap;
-struct _Way {
- _Way() {
+struct ExtractionWay {
+ ExtractionWay() {
Clear();
}
@@ -50,8 +50,9 @@ struct _Way {
nameID = UINT_MAX;
path.clear();
keyVals.EraseAll();
- direction = _Way::notSure;
+ direction = ExtractionWay::notSure;
speed = -1;
+ backward_speed = -1;
duration = -1;
type = -1;
access = true;
@@ -67,6 +68,7 @@ struct _Way {
unsigned nameID;
std::string name;
double speed;
+ double backward_speed;
double duration;
short type;
bool access;
@@ -77,19 +79,22 @@ struct _Way {
HashTable<std::string, std::string> keyVals;
};
-struct _Relation {
- _Relation() : type(unknown){}
+struct ExtractorRelation {
+ ExtractorRelation() : type(unknown){}
enum {
unknown = 0, ferry, turnRestriction
} type;
HashTable<std::string, std::string> keyVals;
};
-struct _Edge {
- _Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false) {};
- _Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false) { }
- _Edge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false) { }
- _Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar) {
+struct InternalExtractorEdge {
+ InternalExtractorEdge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) {};
+ InternalExtractorEdge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) { }
+ InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) { }
+ InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(false) {
+ assert(0 <= type);
+ }
+ InternalExtractorEdge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, bool icf): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(icf) {
assert(0 <= type);
}
NodeID start;
@@ -102,19 +107,21 @@ struct _Edge {
bool ignoreInGrid;
bool isDurationSet;
bool isAccessRestricted;
+ bool isContraFlow;
_Coordinate startCoord;
_Coordinate targetCoord;
- static _Edge min_value() {
- return _Edge(0,0);
+ static InternalExtractorEdge min_value() {
+ return InternalExtractorEdge(0,0);
}
- static _Edge max_value() {
- return _Edge((std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)());
+ static InternalExtractorEdge max_value() {
+ return InternalExtractorEdge((std::numeric_limits<unsigned>::max)(), (std::numeric_limits<unsigned>::max)());
}
-
};
+
+
struct _WayIDStartAndEndEdge {
unsigned wayID;
NodeID firstStart;
@@ -171,34 +178,29 @@ struct CmpNodeByID : public std::binary_function<_Node, _Node, bool> {
}
};
-struct CmpEdgeByStartID : public std::binary_function<_Edge, _Edge, bool>
-{
- typedef _Edge value_type;
- bool operator () (const _Edge & a, const _Edge & b) const {
+struct CmpEdgeByStartID : public std::binary_function<InternalExtractorEdge, InternalExtractorEdge, bool> {
+ typedef InternalExtractorEdge value_type;
+ bool operator () (const InternalExtractorEdge & a, const InternalExtractorEdge & b) const {
return a.start < b.start;
}
value_type max_value() {
- return _Edge::max_value();
+ return InternalExtractorEdge::max_value();
}
value_type min_value() {
- return _Edge::min_value();
+ return InternalExtractorEdge::min_value();
}
};
-struct CmpEdgeByTargetID : public std::binary_function<_Edge, _Edge, bool>
-{
- typedef _Edge value_type;
- bool operator () (const _Edge & a, const _Edge & b) const
- {
+struct CmpEdgeByTargetID : public std::binary_function<InternalExtractorEdge, InternalExtractorEdge, bool> {
+ typedef InternalExtractorEdge value_type;
+ bool operator () (const InternalExtractorEdge & a, const InternalExtractorEdge & b) const {
return a.target < b.target;
}
- value_type max_value()
- {
- return _Edge::max_value();
+ value_type max_value() {
+ return InternalExtractorEdge::max_value();
}
- value_type min_value()
- {
- return _Edge::min_value();
+ value_type min_value() {
+ return InternalExtractorEdge::min_value();
}
};
View
8 Extractor/PBFParser.cpp
@@ -332,8 +332,8 @@ inline void PBFParser::parseRelation(_ThreadData * threadData) {
}
inline void PBFParser::parseWay(_ThreadData * threadData) {
- _Way w;
- std::vector<_Way> waysToParse(threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways_size());
+ ExtractionWay w;
+ std::vector<ExtractionWay> waysToParse(threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways_size());
for(int i = 0, ways_size = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways_size(); i < ways_size; ++i) {
w.Clear();
const OSMPBF::Way& inputWay = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).ways( i );
@@ -356,7 +356,7 @@ inline void PBFParser::parseWay(_ThreadData * threadData) {
unsigned endi_ways = waysToParse.size();
#pragma omp parallel for schedule ( guided )
for(unsigned i = 0; i < endi_ways; ++i) {
- _Way & w = waysToParse[i];
+ ExtractionWay & w = waysToParse[i];
/** Pass the unpacked way to the LUA call back **/
try {
luabind::call_function<int>(
@@ -376,7 +376,7 @@ inline void PBFParser::parseWay(_ThreadData * threadData) {
// }
}
- BOOST_FOREACH(_Way & w, waysToParse) {
+ BOOST_FOREACH(ExtractionWay & w, waysToParse) {
if(!externalMemory->wayFunction(w)) {
std::cerr << "[PBFParser] way not parsed" << std::endl;
}
View
2  Extractor/PBFParser.h
@@ -41,7 +41,7 @@
#include "ExtractorStructs.h"
#include "ScriptingEnvironment.h"
-class PBFParser : public BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, _Way> {
+class PBFParser : public BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, ExtractionWay> {
enum EntityType {
TypeNode = 1,
View
23 Extractor/ScriptingEnvironment.cpp
@@ -65,18 +65,19 @@ ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
];
luabind::module(myLuaState) [
- luabind::class_<_Way>("Way")
+ luabind::class_<ExtractionWay>("Way")
.def(luabind::constructor<>())
- .def_readwrite("name", &_Way::name)
- .def_readwrite("speed", &_Way::speed)
- .def_readwrite("duration", &_Way::duration)
- .def_readwrite("type", &_Way::type)
- .def_readwrite("access", &_Way::access)
- .def_readwrite("roundabout", &_Way::roundabout)
- .def_readwrite("is_access_restricted", &_Way::isAccessRestricted)
- .def_readwrite("ignore_in_grid", &_Way::ignoreInGrid)
- .def_readwrite("tags", &_Way::keyVals)
- .def_readwrite("direction", &_Way::direction)
+ .def_readwrite("name", &ExtractionWay::name)
+ .def_readwrite("speed", &ExtractionWay::speed)
+ .def_readwrite("backward_speed", &ExtractionWay::backward_speed)
+ .def_readwrite("duration", &ExtractionWay::duration)
+ .def_readwrite("type", &ExtractionWay::type)
+ .def_readwrite("access", &ExtractionWay::access)
+ .def_readwrite("roundabout", &ExtractionWay::roundabout)
+ .def_readwrite("is_access_restricted", &ExtractionWay::isAccessRestricted)
+ .def_readwrite("ignore_in_grid", &ExtractionWay::ignoreInGrid)
+ .def_readwrite("tags", &ExtractionWay::keyVals)
+ .def_readwrite("direction", &ExtractionWay::direction)
.enum_("constants")
[
luabind::value("notSure", 0),
View
6 Extractor/XMLParser.cpp
@@ -100,7 +100,7 @@ bool XMLParser::Parse() {
}
if ( xmlStrEqual( currentName, ( const xmlChar* ) "way" ) == 1 ) {
- _Way way = _ReadXMLWay( );
+ ExtractionWay way = _ReadXMLWay( );
/** Pass the unpacked way to the LUA call back **/
try {
@@ -221,8 +221,8 @@ _RawRestrictionContainer XMLParser::_ReadXMLRestriction() {
return restriction;
}
-_Way XMLParser::_ReadXMLWay() {
- _Way way;
+ExtractionWay XMLParser::_ReadXMLWay() {
+ ExtractionWay way;
if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
const int depth = xmlTextReaderDepth( inputReader );
while ( xmlTextReaderRead( inputReader ) == 1 ) {
View
4 Extractor/XMLParser.h
@@ -28,7 +28,7 @@
#include "ExtractorCallbacks.h"
#include "ScriptingEnvironment.h"
-class XMLParser : public BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, _Way> {
+class XMLParser : public BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, ExtractionWay> {
public:
XMLParser(const char * filename);
virtual ~XMLParser();
@@ -39,7 +39,7 @@ class XMLParser : public BaseParser<ExtractorCallbacks, _Node, _RawRestrictionCo
private:
_RawRestrictionContainer _ReadXMLRestriction();
- _Way _ReadXMLWay();
+ ExtractionWay _ReadXMLWay();
ImportNode _ReadXMLNode( );
/* Input Reader */
xmlTextReaderPtr inputReader;
View
5 Util/GraphLoader.h
@@ -101,7 +101,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
short type;
NodeID nameID;
int length;
- bool isRoundabout, ignoreInGrid, isAccessRestricted;
+ bool isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow;
for (EdgeID i=0; i<m; ++i) {
in.read((char*)&source, sizeof(unsigned));
@@ -114,6 +114,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
in.read((char*)&isRoundabout, sizeof(bool));
in.read((char*)&ignoreInGrid, sizeof(bool));
in.read((char*)&isAccessRestricted, sizeof(bool));
+ in.read((char*)&isContraFlow, sizeof(bool));
GUARANTEE(length > 0, "loaded null length edge" );
GUARANTEE(weight > 0, "loaded null weight");
@@ -150,7 +151,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
std::swap(forward, backward);
}
- EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout, ignoreInGrid, isAccessRestricted );
+ EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow );
edgeList.push_back(inputEdge);
}
std::sort(edgeList.begin(), edgeList.end());
View
4 extractor.cpp
@@ -58,7 +58,6 @@ int main (int argc, char *argv[]) {
}
omp_set_num_threads(numberOfThreads);
-
INFO("extracting data from input file " << argv[1]);
bool isPBF(false);
std::string outputFileName(argv[1]);
@@ -93,10 +92,9 @@ int main (int argc, char *argv[]) {
StringMap stringMap;
ExtractionContainers externalMemory;
-
stringMap[""] = 0;
extractCallBacks = new ExtractorCallbacks(&externalMemory, &stringMap);
- BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, _Way> * parser;
+ BaseParser<ExtractorCallbacks, _Node, _RawRestrictionContainer, ExtractionWay> * parser;
if(isPBF) {
parser = new PBFParser(argv[1]);
} else {
View
167 features/bicycle/access.feature
@@ -1,5 +1,5 @@
@routing @bicycle @access
-Feature: Bike - Restricted access
+Feature: Bike - Access tags on ways
Reference: http://wiki.openstreetmap.org/wiki/Key:access
Background:
@@ -7,37 +7,95 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access
Scenario: Bike - Access tag hierachy on ways
Then routability should be
- | access | vehicle | bicycle | bothw |
- | | | | x |
- | yes | | | x |
- | no | | | |
- | | yes | | x |
- | | no | | |
- | no | yes | | x |
- | yes | no | | |
- | | | yes | x |
- | | | no | |
- | no | | yes | x |
- | yes | | no | |
- | | no | yes | x |
- | | yes | no | |
+ | highway | access | vehicle | bicycle | bothw |
+ | | | | | x |
+ | | yes | | | x |
+ | | no | | | |
+ | | | yes | | x |
+ | | | no | | |
+ | | no | yes | | x |
+ | | yes | no | | |
+ | | | | yes | x |
+ | | | | no | |
+ | | no | | yes | x |
+ | | yes | | no | |
+ | | | no | yes | x |
+ | | | yes | no | |
+ | runway | | | | |
+ | runway | yes | | | x |
+ | runway | no | | | |
+ | runway | | yes | | x |
+ | runway | | no | | |
+ | runway | no | yes | | x |
+ | runway | yes | no | | |
+ | runway | | | yes | x |
+ | runway | | | no | |
+ | runway | no | | yes | x |
+ | runway | yes | | no | |
+ | runway | | no | yes | x |
+ | runway | | yes | no | |
- Scenario: Bike - Access tag hierachy on nodes
- Then routability should be
- | node/access | node/vehicle | node/bicycle | bothw |
- | | | | x |
- | yes | | | x |
- | no | | | |
- | | yes | | x |
- | | no | | |
- | no | yes | | x |
- | yes | no | | |
- | | | yes | x |
- | | | no | |
- | no | | yes | x |
- | yes | | no | |
- | | no | yes | x |
- | | yes | no | |
+ @todo
+ Scenario: Bike - Access tag in forward direction
+ Then routability should be
+ | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw |
+ | | | | | x | |
+ | | yes | | | x | |
+ | | no | | | | |
+ | | | yes | | x | |
+ | | | no | | | |
+ | | no | yes | | x | |
+ | | yes | no | | | |
+ | | | | yes | x | |
+ | | | | no | | |
+ | | no | | yes | x | |
+ | | yes | | no | | |
+ | | | no | yes | x | |
+ | | | yes | no | | |
+ | runway | | | | x | |
+ | runway | yes | | | x | |
+ | runway | no | | | | |
+ | runway | | yes | | x | |
+ | runway | | no | | | |
+ | runway | no | yes | | x | |
+ | runway | yes | no | | | |
+ | runway | | | yes | x | |
+ | runway | | | no | | |
+ | runway | no | | yes | x | |
+ | runway | yes | | no | | |
+ | runway | | no | yes | x | |
+ | runway | | yes | no | | |
+
+ @todo
+ Scenario: Bike - Access tag in backward direction
+ Then routability should be
+ | highway | access:forward | vehicle:forward | bicycle:forward | forw | backw |
+ | | | | | | x |
+ | | yes | | | | x |
+ | | no | | | | |
+ | | | yes | | | x |
+ | | | no | | | |
+ | | no | yes | | | x |
+ | | yes | no | | | |
+ | | | | yes | | x |
+ | | | | no | | |
+ | | no | | yes | | x |
+ | | yes | | no | | |
+ | | | no | yes | | x |
+ | | | yes | no | | |
+ | runway | | | | | x |
+ | runway | yes | | | | x |
+ | runway | no | | | | |
+ | runway | | yes | | | x |
+ | runway | | no | | | |
+ | runway | no | yes | | | x |
+ | runway | yes | no | | | |
+ | runway | | | yes | | x |
+ | runway | | | no | | |
+ | runway | no | | yes | | x |
+ | runway | yes | | no | | |
+ | runway | | no | yes | | x |
+ | runway | | yes | no | | |
Scenario: Bike - Overwriting implied acccess on ways
Then routability should be
@@ -51,18 +109,6 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access
| runway | | yes | | x |
| runway | | | yes | x |
- Scenario: Bike - Overwriting implied acccess on nodes
- Then routability should be
- | highway | node/access | node/vehicle | node/bicycle | bothw |
- | cycleway | | | | x |
- | runway | | | | |
- | cycleway | no | | | |
- | cycleway | | no | | |
- | cycleway | | | no | |
- | runway | yes | | | |
- | runway | | yes | | |
- | runway | | | yes | |
-
Scenario: Bike - Access tags on ways
Then routability should be
| access | vehicle | bicycle | bothw |
@@ -92,35 +138,6 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access
| | | agricultural | |
| | | forestery | |
- Scenario: Bike - Access tags on nodes
- Then routability should be
- | node/access | node/vehicle | node/bicycle | bothw |
- | | | | x |
- | yes | | | x |
- | permissive | | | x |
- | designated | | | x |
- | some_tag | | | x |
- | no | | | |
- | private | | | |
- | agricultural | | | |
- | forestery | | | |
- | | yes | | x |
- | | permissive | | x |
- | | designated | | x |
- | | some_tag | | x |
- | | no | | |
- | | private | | |
- | | agricultural | | |
- | | forestery | | |
- | | | yes | x |
- | | | permissive | x |
- | | | designated | x |
- | | | some_tag | x |
- | | | no | |
- | | | private | |
- | | | agricultural | |
- | | | forestery | |
-
Scenario: Bike - Access tags on both node and way
Then routability should be
| access | node/access | bothw |
@@ -147,10 +164,10 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:access
Scenario: Bike - Ignore access tags for other modes
Then routability should be
- | highway | foot | motor_vehicle | moped | bothw |
- | runway | yes | | | |
+ | highway | boat | motor_vehicle | moped | bothw |
+ | river | yes | | | |
| cycleway | no | | | x |
| runway | | yes | | |
| cycleway | | no | | x |
| runway | | | yes | |
- | cycleway | | | no | x |
+ | cycleway | | | no | x |
View
64 features/bicycle/access_node.feature
@@ -0,0 +1,64 @@
+@routing @bicycle @access
+Feature: Bike - Access tags on nodes
+Reference: http://wiki.openstreetmap.org/wiki/Key:access
+
+ Background:
+ Given the profile "bicycle"
+
+ Scenario: Bike - Access tag hierachy on nodes
+ Then routability should be
+ | node/access | node/vehicle | node/bicycle | bothw |
+ | | | | x |
+ | yes | | | x |
+ | no | | | |
+ | | yes | | x |
+ | | no | | |
+ | no | yes | | x |
+ | yes | no | | |
+ | | | yes | x |
+ | | | no | |
+ | no | | yes | x |
+ | yes | | no | |
+ | | no | yes | x |
+ | | yes | no | |
+
+ Scenario: Bike - Overwriting implied acccess on nodes
+ Then routability should be
+ | highway | node/access | node/vehicle | node/bicycle | bothw |
+ | cycleway | | | | x |
+ | runway | | | | |
+ | cycleway | no | | | |
+ | cycleway | | no | | |
+ | cycleway | | | no | |
+ | runway | yes | | | |
+ | runway | | yes | | |
+ | runway | | | yes | |
+
+ Scenario: Bike - Access tags on nodes
+ Then routability should be
+ | node/access | node/vehicle | node/bicycle | bothw |
+ | | | | x |
+ | yes | | | x |
+ | permissive | | | x |
+ | designated | | | x |
+ | some_tag | | | x |
+ | no | | | |
+ | private | | | |
+ | agricultural | | | |
+ | forestery | | | |
+ | | yes | | x |
+ | | permissive | | x |
+ | | designated | | x |
+ | | some_tag | | x |
+ | | no | | |
+ | | private | | |
+ | | agricultural | | |
+ | | forestery | | |
+ | | | yes | x |
+ | | | permissive | x |
+ | | | designated | x |
+ | | | some_tag | x |
+ | | | no | |
+ | | | private | |
+ | | | agricultural | |
+ | | | forestery | |
View
20 features/bicycle/cycleway.feature
@@ -29,16 +29,16 @@ Reference: http://wiki.openstreetmap.org/wiki/Key:cycleway
Then routability should be
| highway | cycleway | cycleway:left | cycleway:right | forw | backw |
| primary | | | | x | x |
- | pirmary | track | | | x | x |
- | pirmary | opposite | | | x | x |
- | pirmary | | track | | x | x |
- | pirmary | | opposite | | x | x |
- | pirmary | | | track | x | x |
- | pirmary | | | opposite | x | x |
- | pirmary | | track | track | x | x |
- | pirmary | | opposite | opposite | x | x |
- | pirmary | | track | opposite | x | x |
- | pirmary | | opposite | track | x | x |
+ | primary | track | | | x | x |
+ | primary | opposite | | | x | x |
+ | primary | | track | | x | x |
+ | primary | | opposite | | x | x |
+ | primary | | | track | x | x |
+ | primary | | | opposite | x | x |
+ | primary | | track | track | x | x |
+ | primary | | opposite | opposite | x | x |
+ | primary | | track | opposite | x | x |
+ | primary | | opposite | track | x | x |
Scenario: Bike - Left/right side cycleways on implied oneways
Then routability should be
View
32 features/bicycle/maxspeed.feature
@@ -36,3 +36,35 @@ Feature: Bike - Max speed restrictions
| residential | | 40s ~10% |
| residential | none | 40s ~10% |
| residential | signals | 40s ~10% |
+
+ Scenario: Bike - Do not use maxspeed when higher that way type speed
+ Given the node map
+ | a | b | c |
+
+ And the ways
+ | nodes | highway | maxspeed |
+ | ab | residential | |
+ | bc | residential | 80 |
+
+ When I route I should get
+ | from | to | route | time |
+ | a | b | ab | 20s ~5% |
+ | b | c | bc | 20s ~5% |
+
+ Scenario: Bike - Forward/backward maxspeed
+ Given the shortcuts
+ | key | value |
+ | bike | 43s ~10% |
+ | run | 73s ~10% |
+ | walk | 145s ~10% |
+ | snail | 720s ~10% |
+
+ Then routability should be
+ | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
+ | | | | bike | bike |
+ | 10 | | | run | run |
+ | | 10 | | run | bike |
+ | | | 10 | bike | run |
+ | 1 | 10 | | run | snail |
+ | 1 | | 10 | snail | run |
+ | 1 | 5 | 10 | walk | run |
View
143 features/bicycle/oneway.feature
@@ -1,19 +1,20 @@
@routing @bicycle @oneway
Feature: Bike - Oneway streets
Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tags_for_routing
+Usually we can push bikes against oneways, but we use foot=no to prevent this in these tests
Background:
Given the profile "bicycle"
Scenario: Bike - Simple oneway
Then routability should be
- | highway | oneway | forw | backw |
- | primary | yes | x | |
+ | highway | foot | oneway | forw | backw |
+ | primary | no | yes | x | |
Scenario: Simple reverse oneway
Then routability should be
- | highway | oneway | forw | backw |
- | primary | -1 | | x |
+ | highway | foot | oneway | forw | backw |
+ | primary | no | -1 | | x |
Scenario: Bike - Around the Block
Given the node map
@@ -21,11 +22,11 @@ Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tag
| d | c |
And the ways
- | nodes | oneway |
- | ab | yes |
- | bc | |
- | cd | |
- | da | |
+ | nodes | oneway | foot |
+ | ab | yes | no |
+ | bc | | no |
+ | cd | | no |
+ | da | | no |
When I route I should get
| from | to | route |
@@ -34,80 +35,80 @@ Handle oneways streets, as defined at http://wiki.openstreetmap.org/wiki/OSM_tag
Scenario: Bike - Handle various oneway tag values
Then routability should be
- | oneway | forw | backw |
- | | x | x |
- | nonsense | x | x |
- | no | x | x |
- | false | x | x |
- | 0 | x | x |
- | yes | x | |
- | true | x | |
- | 1 | x | |
- | -1 | | x |
+ | foot | oneway | forw | backw |
+ | no | | x | x |
+ | no | nonsense | x | x |
+ | no | no | x | x |
+ | no | false | x | x |
+ | no | 0 | x | x |
+ | no | yes | x | |
+ | no | true | x | |
+ | no | 1 | x | |
+ | no | -1 | | x |
Scenario: Bike - Implied oneways
Then routability should be
- | highway | bicycle | junction | forw | backw |
- | | | | x | x |
- | | | roundabout | x | |
- | motorway | yes | | x | |
- | motorway_link | yes | | x | |
- | motorway | yes | roundabout | x | |
- | motorway_link | yes | roundabout | x | |
+ | highway | foot | bicycle | junction | forw | backw |
+ | | no | | | x | x |
+ | | no | | roundabout | x | |
+ | motorway | no | yes | | x | |
+ | motorway_link | no | yes | | x | |
+ | motorway | no | yes | roundabout | x | |
+ | motorway_link | no | yes | roundabout | x | |
Scenario: Bike - Overriding implied oneways
Then routability should be
- | highway | junction | oneway | forw | backw |
- | primary | roundabout | no | x | x |
- | primary | roundabout | yes | x | |
- | motorway_link | | -1 | | |
- | trunk_link | | -1 | | |
- | primary | roundabout | -1 | | x |
+ | highway | foot | junction | oneway | forw | backw |
+ | primary | no | roundabout | no | x | x |
+ | primary | no | roundabout | yes | x | |
+ | motorway_link | no | | -1 | | |
+ | trunk_link | no | | -1 | | |
+ | primary | no | roundabout | -1 | | x |
Scenario: Bike - Oneway:bicycle should override normal oneways tags
Then routability should be
- | oneway:bicycle | oneway | junction | forw | backw |
- | yes | | | x | |
- | yes | yes | | x | |
- | yes | no | | x | |
- | yes | -1 | | x | |
- | yes | | roundabout | x | |
- | no | | | x | x |
- | no | yes | | x | x |
- | no | no | | x | x |
- | no | -1 | | x | x |
- | no | | roundabout | x | x |
- | -1 | | | | x |
- | -1 | yes | | | x |
- | -1 | no | | | x |
- | -1 | -1 | | | x |
- | -1 | | roundabout | | x |
+ | foot | oneway:bicycle | oneway | junction | forw | backw |
+ | no | yes | | | x | |
+ | no | yes | yes | | x | |
+ | no | yes | no | | x | |
+ | no | yes | -1 | | x | |
+ | no | yes | | roundabout | x | |
+ | no | no | | | x | x |
+ | no | no | yes | | x | x |
+ | no | no | no | | x | x |
+ | no | no | -1 | | x | x |
+ | no | no | | roundabout | x | x |
+ | no | -1 | | | | x |
+ | no | -1 | yes | | | x |
+ | no | -1 | no | | | x |
+ | no | -1 | -1 | | | x |
+ | no | -1 | | roundabout | | x |
Scenario: Bike - Contra flow
Then routability should be
- | oneway | cycleway | forw | backw |
- | yes | opposite | x | x |
- | yes | opposite_track | x | x |
- | yes | opposite_lane | x | x |
- | -1 | opposite | x | x |
- | -1 | opposite_track | x | x |
- | -1 | opposite_lane | x | x |
- | no | opposite | x | x |
- | no | opposite_track | x | x |
- | no | opposite_lane | x | x |
+ | foot | oneway | cycleway | forw | backw |
+ | no | yes | opposite | x | x |
+ | no | yes | opposite_track | x | x |
+ | no | yes | opposite_lane | x | x |
+ | no | -1 | opposite | x | x |
+ | no | -1 | opposite_track | x | x |
+ | no | -1 | opposite_lane | x | x |
+ | no | no | opposite | x | x |
+ | no | no | opposite_track | x | x |
+ | no | no | opposite_lane | x | x |
Scenario: Bike - Should not be affected by car tags
Then routability should be
- | junction | oneway | oneway:car | forw | backw |
- | | yes | yes | x | |
- | | yes | no | x | |
- | | yes | -1 | x | |
- | | no | yes | x | x |
- | | no | no | x | x |
- | | no | -1 | x | x |
- | | -1 | yes | | x |
- | | -1 | no | | x |
- | | -1 | -1 | | x |
- | roundabout | | yes | x | |
- | roundabout | | no | x | |
- | roundabout | | -1 | x | |
+ | foot | junction | oneway | oneway:car | forw | backw |
+ | no | | yes | yes | x | |
+ | no | | yes | no | x | |
+ | no | | yes | -1 | x | |
+ | no | | no | yes | x | x |
+ | no | | no | no | x | x |
+ | no | | no | -1 | x | x |
+ | no | | -1 | yes | | x |
+ | no | | -1 | no | | x |
+ | no | | -1 | -1 | | x |
+ | no | roundabout | | yes | x | |
+ | no | roundabout | | no | x | |
+ | no | roundabout | | -1 | x | |
View
72 features/bicycle/pushing.feature
@@ -0,0 +1,72 @@
+@routing @bicycle @pushing
+Feature: Bike - Accessability of different way types
+
+ Background:
+ Given the profile "bicycle"
+ Given the shortcuts
+ | key | value |
+ | bike | 40s ~20% |
+ | foot | 180s ~20% |
+
+ Scenario: Bike - Pushing bikes on pedestrian-only ways
+ Then routability should be
+ | highway | oneway | forw | backw |
+ | (nil) | | | |
+ | cycleway | | bike | bike |
+ | primary | | bike | bike |
+ | pedestrian | | foot | foot |
+ | footway | | foot | foot |
+ | primary | yes | bike | foot |
+
+ Scenario: Bike - Pushing bikes against normal oneways
+ Then routability should be
+ | highway | oneway | forw | backw |
+ | (nil) | | | |
+ | primary | yes | bike | foot |
+ | pedestrian | yes | foot | foot |
+
+ Scenario: Bike - Pushing bikes against reverse oneways
+ Then routability should be
+ | highway | oneway | forw | backw |
+ | (nil) | | | |
+ | primary | -1 | foot | bike |
+ | pedestrian | -1 | foot | foot |
+
+ @square
+ Scenario: Bike - Push bikes on pedestrian areas
+ Given the node map
+ | x | |
+ | a | b |
+ | d | c |
+
+ And the ways
+ | nodes | area | highway |
+ | xa | | primary |
+ | abcda | yes | pedestrian |
+
+ When I route I should get
+ | from | to | route |
+ | a | b | abcda |
+ | a | d | abcda |
+ | b | c | abcda |
+ | c | b | abcda |
+ | c | d | abcda |
+ | d | c | abcda |
+ | d | a | abcda |
+ | a | d | abcda |
+
+ Scenario: Bike - Pushing bikes on ways with foot=yes
+ Then routability should be
+ | highway | foot | bothw |
+ | motorway | | |
+ | motorway | yes | foot |
+ | runway | | |
+ | runway | yes | foot |
+
+ @todo
+ Scenario: Bike - Pushing bikes on ways with foot=yes in one direction
+ Then routability should be
+ | highway | foot:forward | foot:backward | forw | backw |
+ | motorway | | | | |
+ | motorway | yes | | foot | |
+ | motorway | | yes | | foot |
View
120 features/bicycle/restrictions.feature
@@ -3,7 +3,7 @@ Feature: Bike - Turn restrictions
Handle turn restrictions as defined by http://wiki.openstreetmap.org/wiki/Relation:restriction
Note that if u-turns are allowed, turn restrictions can lead to suprising, but correct, routes.
- Background: Use car routing
+ Background:
Given the profile "bicycle"
@no_turning
@@ -14,11 +14,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -38,11 +38,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -62,11 +62,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -86,11 +86,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -110,11 +110,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -134,11 +134,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -158,11 +158,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -182,11 +182,11 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | nj | -1 |
- | wj | -1 |
- | ej | -1 |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | nj | -1 | no |
+ | wj | -1 | no |
+ | ej | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction |
@@ -206,13 +206,13 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | no |
- | xj | -1 |
- | aj | -1 |
- | bj | no |
- | cj | -1 |
- | dj | -1 |
+ | nodes | oneway | foot |
+ | sj | no | no |
+ | xj | -1 | no |
+ | aj | -1 | no |
+ | bj | no | no |
+ | cj | -1 | no |
+ | dj | -1 | no |
And the relations
| type | way:from | way:to | node:via | restriction | except |
@@ -236,10 +236,10 @@ Feature: Bike - Turn restrictions
| | s | |
And the ways
- | nodes | oneway |
- | sj | yes |
- | aj | no |
- | bj | no |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | aj | no | no |
+ | bj | no | no |
And the relations
| type | way:from | way:to | node:via | restriction | except |
@@ -261,14 +261,14 @@ Feature: Bike - Turn restrictions
| | | f |
And the ways
- | nodes | oneway |
- | sj | yes |
- | ja | yes |
- | jb | yes |
- | jc | yes |
- | jd | yes |
- | je | yes |
- | jf | yes |
+ | nodes | oneway | foot |
+ | sj | yes | no |
+ | ja | yes | no |
+ | jb | yes | no |
+ | jc | yes | no |
+ | jd | yes | no |
+ | je | yes | no |
+ | jf | yes | no |
And the relations
| type | way:from | way:to | node:via | restriction | except |
View
60 features/bicycle/way.feature
@@ -4,32 +4,38 @@ Feature: Bike - Accessability of different way types
Background:
Given the profile "bicycle"
- Scenario: Bike - Basic access
+ Scenario: Bike - Routability of way types
Bikes are allowed on footways etc because you can pull your bike at a lower speed.
- Given the profile "bicycle"
+ Pier is not allowed, since it's tagged using man_made=pier.
Then routability should be
- | highway | forw |
- | (nil) | |
- | motorway | |
- | motorway_link | |
- | trunk | |
- | trunk_link | |
- | primary | x |
- | primary_link | x |
- | secondary | x |
- | secondary_link | x |
- | tertiary | x |
- | tertiary_link | x |
- | residential | x |
- | service | x |
- | unclassified | x |
- | living_street | x |
- | road | x |
- | track | x |
- | path | x |
- | footway | x |
- | pedestrian | x |
- | steps | x |
- | pier | x |
- | cycleway | x |
- | bridleway | |
+ | highway | bothw |
+ | (nil) | |
+ | motorway | |
+ | motorway_link | |
+ | trunk | |
+ | trunk_link | |
+ | primary | x |
+ | primary_link | x |
+ | secondary | x |
+ | secondary_link | x |
+ | tertiary | x |
+ | tertiary_link | x |
+ | residential | x |
+ | service | x |
+ | unclassified | x |
+ | living_street | x |
+ | road | x |
+ | track | x |
+ | path | x |
+ | footway | x |
+ | pedestrian | x |
+ | steps | x |
+ | cycleway | x |
+ | bridleway | |
+ | pier | |
+
+ Scenario: Bike - Routability of man_made structures
+ Then routability should be
+ | highway | man_made | bothw |
+ | (nil) | (nil) | |
+ | (nil) | pier | x |
View
26 features/car/maxspeed.feature
@@ -10,9 +10,9 @@ Feature: Car - Max speed restrictions
| a | b | c |
And the ways
- | nodes | highway | maxspeed |
- | ab | trunk | |
- | bc | trunk | 10 |
+ | nodes | highway | maxspeed |
+ | ab | trunk | |
+ | bc | trunk | 10 |
When I route I should get
| from | to | route | time |
@@ -32,3 +32,23 @@ Feature: Car - Max speed restrictions
| from | to | route | time |
| a | b | ab | 144s ~10% |
| b | c | bc | 63s ~10% |
+
+ Scenario: Car - Forward/backward maxspeed
+ Given the shortcuts
+ | key | value |
+ | car | 12s ~10% |
+ | run | 73s ~10% |
+ | walk | 146s ~10% |
+ | snail | 720s ~10% |
+
+ And a grid size of 100 meters
+
+ Then routability should be
+ | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
+ | | | | car | car |
+ | 10 | | | run | run |
+ | | 10 | | run | car |
+ | | | 10 | car | run |
+ | 1 | 10 | | run | snail |
+ | 1 | | 10 | snail | run |
+ | 1 | 5 | 10 | walk | run |
View
0  features/car/permissive.feature
No changes.
View
5 features/step_definitions/routing.rb
@@ -46,6 +46,9 @@
if table.headers.include? 'turns'
got['turns'] = turns
end
+ if table.headers.include? '#' # comment column
+ got['#'] = row['#'] # copy value so it always match
+ end
end
ok = true
@@ -74,4 +77,4 @@
ok = false unless step "I route I should get", table
end
ok
-end
+end
View
7 features/support/data.rb
@@ -71,14 +71,15 @@ def build_ways_from_table table
way << node5
tags = row.dup
- #remove tags that describe expected test result
+
+ # remove tags that describe expected test result
tags.reject! do |k,v|
k =~ /^forw\b/ ||
k =~ /^backw\b/ ||
k =~ /^bothw\b/
end
-
- #remove empty tags
+
+ ##remove empty tags
tags.reject! { |k,v| v=='' }
# sort tag keys in the form of 'node/....'
View
52 features/testbot/maxspeed.feature
@@ -0,0 +1,52 @@
+@routing @maxspeed @testbot
+Feature: Car - Max speed restrictions
+
+ Background: Use specific speeds
+ Given the profile "testbot"
+
+ Scenario: Testbot - Respect maxspeeds when lower that way type speed
+ Given the node map
+ | a | b | c | d |
+
+ And the ways
+ | nodes | maxspeed |
+ | ab | |
+ | bc | 24 |
+ | cd | 18 |
+
+ When I route I should get
+ | from | to | route | time |
+ | a | b | ab | 10s +-1 |
+ | b | a | ab | 10s +-1 |
+ | b | c | bc | 15s +-1 |
+ | c | b | bc | 15s +-1 |
+ | c | d | cd | 20s +-1 |
+ | d | c | cd | 20s +-1 |
+
+ Scenario: Testbot - Ignore maxspeed when higher than way speed
+ Given the node map
+ | a | b | c |
+
+ And the ways
+ | nodes | maxspeed |
+ | ab | |
+ | bc | 200 |
+
+ When I route I should get
+ | from | to | route | time |
+ | a | b | ab | 10s +-1 |
+ | b | a | ab | 10s +-1 |
+ | b | c | bc | 10s +-1 |
+ | c | b | bc | 10s +-1 |
+
+ @opposite
+ Scenario: Testbot - Forward/backward maxspeed
+ Then routability should be
+ | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
+ | | | | 20s +-1 | 20s +-1 |
+ | 18 | | | 40s +-1 | 40s +-1 |
+ | | 18 | | 40s +-1 | 20s +-1 |
+ | | | 18 | 20s +-1 | 40s +-1 |
+ | 9 | 18 | | 40s +-1 | 80s +-1 |
+ | 9 | | 18 | 80s +-1 | 40s +-1 |
+ | 9 | 24 | 18 | 30s +-1 | 40s +-1 |
View
15 features/testbot/opposite.feature
@@ -1,19 +1,18 @@
-@routing @opposite @todo
+@routing @testbot @opposite
Feature: Separate settings for forward/backward direction
Background:
Given the profile "testbot"
- @smallest
- Scenario: Going against the flow
+ Scenario: Testbot - Going against the flow
Given the node map
- | a | b |
+ | a | b | c | d |
And the ways
| nodes | highway |
- | ab | river |
+ | abcd | river |
When I route I should get
- | from | to | route | distance | time |
- | a | b | ab | 100m | 10s |
- | b | a | ab | 100m | 20s |
+ | from | to | route | distance | time |
+ | a | d | abcd | 300 +- 1m | 30s |
+ | d | a | abcd | 300 +- 1m | 68s |
View
1  profile.lua
@@ -0,0 +1 @@
+profiles/car.lua
View
1  profile.lua
View
165 profiles/bicycle.lua
@@ -12,7 +12,9 @@ restriction_exception_tags = { "bicycle", "vehicle", "access" }
default_speed = 16
-main_speeds = {
+walking_speed = 4
+
+bicycle_speeds = {
["cycleway"] = 18,
["primary"] = 17,
["primary_link"] = 17,
@@ -26,17 +28,14 @@ main_speeds = {
["road"] = 16,
["service"] = 16,
["track"] = 13,
- ["path"] = 13,
- ["footway"] = 12,
- ["pedestrian"] = 12,
- ["pier"] = 12,
- ["steps"] = 2
+ ["path"] = 13
+ --["footway"] = 12,
+ --["pedestrian"] = 12,
}
pedestrian_speeds = {
- ["footway"] = 5,
- ["pedestrian"] = 5,
- ["pier"] = 5,
+ ["footway"] = walking_speed,
+ ["pedestrian"] = walking_speed,
["steps"] = 2
}
@@ -50,7 +49,7 @@ railway_speeds = {
}
platform_speeds = {
- ["platform"] = 5
+ ["platform"] = walking_speed
}
amenity_speeds = {
@@ -58,6 +57,10 @@ amenity_speeds = {
["parking_entrance"] = 10
}
+man_made_speeds = {
+ ["pier"] = walking_speed
+}
+
route_speeds = {
["ferry"] = 5
}
@@ -110,44 +113,49 @@ function way_function (way, numberOfNodesInWay)