NAME
Map::Metro::Plugin::Map - How to make your own map
SYNOPSIS
--stations
Stadshagen
Fridhemsplan
Rådhuset
T-Centralen
# comments are possible
Gamla stan
Slussen
Medborgarplatsen
Skanstull
Gullmarsplan
Globen
Sergels torg
Nybroplan
--transfers
T-Centralen|Sergels torg|weight:4
--lines
10|T10|Blue line
11|T11|Blue line
19|T19|Green line
7|L7|Spårväg city
--segments
10,11|Stadshagen|Fridhemsplan
10,11|Fridhemsplan|Rådhuset
10,11|Rådhuset|T-Centralen
10,11|T-Centralen|Kungsträdgården
19|T-Centralen|Gamla stan
19|Gamla stan|Slussen
19|Slussen|Medborgarplatsen
19|Medborgarplatsen|Skanstull
19|Skanstull|Gullmarsplan
19|Gullmarsplan|Globen
7|Sergels torg|Nybroplan
DESCRIPTION
It is straightforward to create a map file. It consists of four parts:
--stations
This is a list of all stations in the network. Currently only one value per line. Don't use |
in station names.
--transfers
This is a list of Transfers. If two stations share at least one line they are not transfers. Three groups of data per line (delimited by |
):
The options in turn is a comma separated list of colon separated key-value pairs. Currently the only supported option is:
- weight. Integer. Set a custom weight for the 'cost' of making this transfer. Default value is 5. (Travelling between two stations on the same line cost 1, and changing lines at a station costs 3).
--lines
This is a list of all lines in the network. Three values per line (delimited by |
):
- Line id (only a-z, A-Z and 0-9 allowed). Used in segments.
- Line name. This should preferably be short(ish) and a common name for the line.
- Line description. This can be a longer common name for the line.
--segments
This is a list of all Segments in the network. (A segment is a pair of consecutive stations.) Three groups of data per line (delimited by |
):
- A list of line ids (comma delimited). This references the line list above. The list of line ids represents all lines travelling between the two stations.
- The first station.
- The following station
WHAT NOW?
Start a distribution called Map::Metro::Plugin::Map::$city
.
Save this file as map-$city.metro
in the share
directory.
Make a role called Map::Metro::Plugin::Map::$city
. See Map::Metro::Plugin::Map::Stockholm for a template.
An important part is the single attribute the role should have. It must be in this form:
my $city = 'RioDeJaneiro';
my $attribute_name = join '_' => map {
join ('_' => map { lc } grep { length } split m{([A-Z]{1}[^A-Z]*)})
} split '::' => $city;
print $attribute_name;
# rio_de_janeiro
AUTHOR
Erik Carlsson <info@code301.com>
COPYRIGHT
Copyright 2014 - Erik Carlsson
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.