summaryrefslogtreecommitdiff
path: root/lib/Travel
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-03-27 17:36:09 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-03-27 17:36:09 +0100
commit1e7d9d019865e58eb63d2c4501adb15fc3e888c8 (patch)
tree9a0ef08266881829058b4229273a508c6c47d905 /lib/Travel
parent3027b36f363f3bc1bdf1434eb6149f0bfb64e132 (diff)
Support ÖBB (and possibly other non-DB HAFAS) polylines
Diffstat (limited to 'lib/Travel')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index b14ff95..50095b4 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -752,9 +752,17 @@ sub parse_journey {
my $journey = $self->{raw_json}{svcResL}[0]{res}{journey};
my @polyline;
- if ( $journey->{poly} ) {
- @polyline = decode_polyline( $journey->{poly}{crdEncYX} );
- for my $ref ( @{ $journey->{poly}{ppLocRefL} // [] } ) {
+ my $poly = $journey->{poly};
+
+ # ÖBB
+ if ( $journey->{polyG} and @{ $journey->{polyG}{polyXL} // [] } ) {
+ $poly = $self->{raw_json}{svcResL}[0]{res}{common}{polyL}
+ [ $journey->{polyG}{polyXL}[0] ];
+ }
+
+ if ($poly) {
+ @polyline = decode_polyline( $poly->{crdEncYX} );
+ for my $ref ( @{ $poly->{ppLocRefL} // [] } ) {
my $poly = $polyline[ $ref->{ppIdx} ];
my $loc = $locL[ $ref->{locX} ];