- MORE INFORMATION
- Map::Metro or Map::Tube?
- SEE ALSO
- COPYRIGHT AND LICENSE
Map::Metro - Public transport graphing
Version 0.2405, released 2016-07-23.
# Install a map $ cpanm Map::Metro::Plugin::Map::Stockholm # And then my $graph = Map::Metro->new('Stockholm', hooks => ['PrettyPrinter'])->parse; my $routing = $graph->routing_for('Universitetet', 'Kista'); # or in a terminal $ map-metro.pl route Stockholm Universitetet Kista
From Universitetet to Kista =========================== -- Route 1 (cost 15) ---------- [ T14 ] Universitetet [ T14 ] Tekniska högskolan [ T14 ] Stadion [ T14 ] Östermalmstorg [ T14 ] T-Centralen [ * T11 ] T-Centralen [ T11 ] Rådhuset [ T11 ] Fridhemsplan [ T11 ] Stadshagen [ T11 ] Västra skogen [ T11 ] Solna centrum [ T11 ] Näckrosen [ T11 ] Hallonbergen [ T11 ] Kista T11 Blue line T14 Red line *: Transfer to other line +: Transfer to other station
The purpose of this distribution is to find the shortest unique route/routes between two stations in a transport network.
See Task::MapMetro::Maps for a list of released maps.
The name of the city you want to search connections in. Mandatory, unless you are only going to call "available_maps".
Array reference of Hooks that listens for events.
Returns a Map::Metro::Graph object containing the entire graph.
Returns an array reference containing the names of all Map::Metro maps installed on the system.
The following rules are a guideline:
If the starting station and finishing station...
...are on the same line there will be no changes to other lines.
...shares multiple lines (e.g., both stations are on both line 2 and 4), each line constitutes a route.
...are on different lines, line changes will take place at suitable station(s). There is no guarantee that the same stations will be chosen for line changes between searches, if there are more than one suitable station to make a change at.
Map::Metro::Graph - How to use graph object.
Map::Metro::Plugin::Map - How to make your own maps.
Map::Metro::Hook - How to extend Map::Metro via hooks/events.
Map::Metro::Cmd - A guide to the command line application.
Map::Metro::Graph::Connection - Defines a MMG::Connection.
Map::Metro::Graph::Line - Defines a MMG::Line.
Map::Metro::Graph::LineStation - Defines a MMG::LineStation.
Map::Metro::Graph::Route - Defines a MMG::Route.
Map::Metro::Graph::Routing - Defines a MMG::Routing.
Map::Metro::Graph::Segment - Defines a MMG::Segment.
Map::Metro::Graph::Station - Defines a MMG::Station.
Map::Metro::Graph::Step - Defines a MMG::Step.
Map::Metro::Graph::Transfer - Defines a MMG::Transfer.
The following is a conceptual overview of the various parts of a graph:
At first, the map file is parsed. The four types of information (stations, transfers, lines and segments) are translated into their respective objects.
Now the network is complete, and it is time to start traversing it.
Then we do the same for the destination station.
Since 0.2200 performance is less of an issue than it used to be, but it could still be improved. Prior to that version the entire network was analyzed up-front. This is unnecessary when searching one (or a few) routes. For long-running applications it is still possible to pre-calculate all paths, see asps.
It is also possible to run the backend to some commands in a server, see App::Map::Metro.
This is somewhat experimental. I don't expect that the map file format will break, but it might be extended. Only the documented api should be used, though breaking changes might occur.
For all maps in the Map::Metro::Plugin::Map namespace (unless noted):
These maps are not an official source. Use accordingly.
There should be a note regarding what routes the map covers.
Under Perl 5.16 or greater,
fc will be used instead of
lc for some string comparisons. Depending on the map definition this might lead to some maps not working properly on pre-5.16 Perls.
Prior to version 0.2400,
Map::Metro required at least Perl 5.16.
Map::Tube is the main alternative to
Map::Metro. They both have their strong and weak points.
Map::Tube is faster.
Map::Tube is more stable: It has been on Cpan for a long time, and is under active development.
Map::Metro has (in my opinion) a better map format.
Map::Metro supports eg. transfers between stations.
It is possible to convert Map::Metro maps into Map::Tube maps using map-metro.pl.
Erik Carlsson <email@example.com>
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.