NAME

Map::Tube::Beijing - Interface to the Beijing tube map

SYNOPSIS

    use Map::Tube::Beijing;
	my $tube = Map::Tube::Beijing->new( nametype => 'alt' );

    my $route = $tube->get_shortest_route('Yonghegong', 'Chongwenmen');

    print "Route: $route\n";

DESCRIPTION

This module allows to find the shortest route between any two given tube stations in Beijing. All interesting methods are provided by the role Map::Tube.

METHODS

CONSTRUCTOR

use Map::Tube::Beijing;
my $tube_chin = Map::Tube::Beijing->new();
my $tube_pinyin = Map::Tube::Beijing->new( nametype => 'alt' );

This will read the tube information from the shared file beijing-map.xml, which is part of the distribution. Without argument, full Chinese characters (simplified) will be used. With the value 'alt' for nametype, pinyin transliteration into Western characters will be used. Other values will throw an error.

METHODS

nametype( )

This yields the nametype that was specified with the constructor call, or '' if none.

MAP DATA FORMAT

The data format for Map::Tube instances is described in the documentation for Map::Tube. The Beijing map, however, comes either with station and line names in the original Chinese writing or in pinyin, i.e., in Latin alphabet letters that are a rough representation of the pronunciation. To this end, all tags that have a name attribute containing the name in Chinese script also have a name_alt attribute with the pinyin writing. When reading the map data and no nametype is given, all the name_alt attributes are deleted, so that the Map::Tube software sees only a standard data structure. However, if nametype=alt was specified when instantiating Map::Data::Beijing, the name_alt attributes will be copied into the name atributes, and, again, the name_alt attributes themselves are removed.

This mechanism may also be employed also for other countries/regions where more than one language and/or writing system is used. E.g., for Swiss subway systems it is conceivable to have up to four different languages. name might be used for the French name, name_d for the German name, name_i for Italian, and name_r for Romansh.

ERRORS

If something goes wrong, maybe because the map information file was corrupted, the constructor will die.

AUTHOR

Gisbert W. Selke, TapirSoft Selke & Selke GbR.

COPYRIGHT AND LICENCE

The data for the XML file were mainly taken from the appropriate Wikipedia pages. They are CC BY-SA 2.0. The module itself is free software; you may redistribute and/or modify it under the same terms as Perl itself.

SEE ALSO

Map::Tube, Map::Tube::GraphViz.