BBBikeRouting - frontend for using BBBike routing
use BBBikeRouting;
use Data::Dumper;
my $routing = BBBikeRouting->new;
$routing->init_context;
$routing->Start->Street("from street");
$routing->Goal->Street("to street");
$routing->search;
print Dumper $routing->RouteInfo;
This is a wrapper around Strassen.pm to make simple routing scripts easier. The basic approach is described as code in "SYNOPSIS" and looks as following:
construct the
BBBikeRouting
objectinitialize the
Context
member withinit_context
and maybe change someContext
parametersset
Start
andGoal
membersperform the route search
output the route information
- new
-
The constructor of
BBBikeRouting
takes no arguments. - init_context
-
This method sets the
Context
member to initial values (bike routing in city scope. For the routing, maximum caching and speed (by using the C variant of the A* algorithm) will be used. See "MEMBERS" for a list ofContext
members. - search
-
Perform a search from the start to the goal position.
- continue($position)
-
After a performed search, prepare the module to continue the existing route using the $position (a
BBBikeRouting::Position
object) as new goal. The old goal is pushed to theVia
array. The actual search is performed by calling search() again. - delete_to_last_via
-
The opposite of continue(). This method will delete the path and routeinfo added by the last continue()/search() calls.
Context
-
Hold a
BBBikeRouting::Context
object. The members of this object are:- Vehicle
-
Can be
pedestrian
,bike
,car
oroepnv
(public transport). - Velocity
-
The average speed in km/h. Default is 20 km/h.
- Scope
-
Can be
city
(only Berlin) orregion
(Berlin and Brandenburg). - UseXS
-
Use the XS extension, if possible. This will speed up the net creation.
- UseCache
-
Use caches, if possible. This will speed up the creation of some internal data structures.
- UseNetServer
-
Use the net server started by the
bbbikestrserver
script. This can be used instead of the XS and Cache speedups. - SearchArgs
-
An array reference with more search arguments. See the Strassen documentation for the method
StrassenNetz::search
. - Algorithm
-
The algorihm which should be used. Possible values are:
srt
(an ancient slower own search algorithm),A*
(a pure-perl implementation of A*), orC-A*
(a C/perl combination of A*, only available if the Inline::C module is installed and a C compiler is available). - CGI
-
Only for CGI scripts: the CGI query object.
- BrowserInfo
-
Only for CGI scripts: the BrowserInfo object.
- Verbose
-
Be verbose (output statistics to stderr etc.).
- MultipleChoices
-
Fill the StartChoices/ViaChoices/GoalChoices members if a search for a start/via/goal has multiple results.
- MultipleChoicesLimit
-
Limit the number of entries in the *Choices members. By default this is
undef
, which means unlimited.
Start
,Goal
-
Hold
BBBikeRouting::Position
objects for the start and goal position. The members of this object are:- Street
-
The street of the position (without house numbers).
- Citypart
-
The citypart of the position.
- Coord
-
The coordinate (standard coordinate system) of the position.
- Multi
-
Not used now.
- RouteInfo
-
After finding a route, this member will contain an array reference of the route "elements". Please refer to the Strassen::StrassenNetz documentation for the format of a route element.
XXX For now, the goal node is *not* part of the RouteInfo. This may change in future.
Other members of BBBikeRouting
are not meant for public use.
It is assumed that data is available in a data subdirectory of the current script. The data/strassen file is mandatory if routing on streets is used (this is true for the vehicles pedestrian
, bike
and car
), otherwise, for public transport, the files data/ubahn
(for undergrounds) and data/sbahn (for city railway) are used.
For public transport, also a file data/umsteigebhf is needed for railway junctions with different station names (e.g. in Berlin you can change between "Rathaus Spandau" (U-Bahn) and "Spandau" (S-Bahn)).
For bike and car street routing, the file data/gesperrt should contain one-way streets, blocked streets, and blocked paths. Extra blocked streets for cars only should be put into the file data/gesperrt_car. It is assumed that there are no blocked streets for pedestrians at all.
Slaven Rezic <[email protected]>
Copyright (c) 2001,2003 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
bbbike(1), Strassen(3), Strassen::StrassenNetz(3).