From 1e7d9d019865e58eb63d2c4501adb15fc3e888c8 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 27 Mar 2024 17:36:09 +0100 Subject: Support ÖBB (and possibly other non-DB HAFAS) polylines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Travel/Status/DE/HAFAS.pm | 14 +++++++++++--- 1 file 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} ]; -- cgit v1.2.3