NAME
WWW::AzimuthAero::RouteMap - Route map representation
VERSION
version 0.4
SYNOPSIS
my $rm = WWW::AzimuthAero::RouteMap->new($route_map_raw_hash);
$rm->route_map_iata()
DESCRIPTION
https://azimuth.aero/ru/about/flight-map
METHODS
new
my $rm = WWW::AzimuthAero::RouteMap->new($route_map_raw_hash);
new
Return hash with original route map parsed from site
all_cities
Return sorted list of city names in route map
print $rm->all_cities()
print join(',' map { "\'". $_ ."\'" } $rm->all_cities() ); # for json array
get
Universal accessor function for route map, wrapper under "all_cities" in WWW::AzimuthAero::RouteMap
$rm->get( $which_property, $by_what_property, $what_property_val )
Examples:
$rm->get('IATA', 'NAME', 'Ростов-на-Дону')
$rm->get('IATA', 'AZO', 'РОВ')
route_map_iata
Return hash with IATA route map
perl -Ilib -MWWW::AzimuthAero -MData::Dumper -e 'my $x = WWW::AzimuthAero->new->route_map->route_map_iata; warn Dumper $x;'
Amount of cities
my $x = WWW::AzimuthAero->new->route_map->route_map_iata; print scalar values %$x;
Amount of all routes
perl -Ilib -MWWW::AzimuthAero -e 'my $x = WWW::AzimuthAero->new->route_map->route_map_iata; my $i = 0; $i+= scalar @$_ for values %$x; print $i;'
Params:
cities
perl -Ilib -MWWW::AzimuthAero -MData::Dumper -e 'my $x = WWW::AzimuthAero->new->route_map->route_map_iata('ROV', 'LED', 'KRR'); warn Dumper $x;'
neighbor_airports
Return hash of airports that are no more than 4 hours by train from each other
For now it's manually hardcoded
{
'Ростов-на-Дону' => [qw/Краснодар/],
'Москва' => [qw/Калуга/],
'Санкт-Петербург' => [qw/Псков/]
};
Cities are set by name, not IATA code, for convenience
When you set new city please check it's availability at "all_cities" in WWW::AzimuthAero::RouteMap
TO-DO: check correctness with Yandex Maps API and RZD API
get_neighbor_airports_iata
Return list of IATA codes of neighbor airports based on "neighbor_airports" in WWW::AzimuthAero::RouteMap
$rm->get_neighbor_airports_iata('LED') # ( 'PKV' )
transfer_routes
Convert route map to Graph object and return ARRAYref of routes with one transfer maximum
perl -Ilib -MData::Dumper -MWWW::AzimuthAero -e 'my $x = WWW::AzimuthAero->new->route_map->transfer_routes; warn Dumper $x;'
Params:
# graph processing options :
# $params{max_edges} - 2 by default, hardcoded for now
# $params{check_neighbors}
# source and destination cities :
# $params{from} +
# $params{to} +
# schedule processing :
# $params{min}
# $params{max}
# $params{max_delay_days}
AUTHOR
Pavel Serikov <pavelsr@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Pavel Serikov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.