Till senaste kommentaren

GTFS download file unsupported format

When I try to download the GTFS and open it (using the following URL: https://opendata.samtrafiken.se/gtfs/skane/skane.zip?key={api_key}) it won't open and it gives a popup stating the file is in an unsupported format: 

Luke Morgan

Kommentarer

  • Hi Luke,

    Did you replace {api_key} with your api key when downloading the file?

    Regards,
    Bert
    Bert på Trafiklab
  • Hey Bert,

    Yes I did. The download was successful but the file itself is corrupted.

    Luke
    Luke Morgan
  • Which browser did you use to download the file?

    The browser may not have stored the file correctly, for example by not handling the compression during transport correctly. During transport, the file is compressed using gzip, so if the browser did not handle this correctly the file may still be gzip compressed. Renaming it to skane.zip.gz may resolve the issue in this case.

    Another possibility is an incomplete download. The total file size for todays file should be 33,4mb, 35 082 444 bytes.

    Bert på Trafiklab
  • Unfortunately this still doesn't help the issue, I tried using safari and google chrome with the same result. Even when adding .gz to the file name the result is the same.

    Luke Morgan
  • Can you try opening the file using another program such as 7zip?
    Bert på Trafiklab
  • We could but this wouldn't be how our backend systems download zip files and in turn process them. We need the zip file to be in a supported format in order to access the data.

    The last GTFS update where this wasn't an issue was Mon 10/02/2025, 07:30, can you see if there was some format change after this update?
    Luke Morgan
  • There have been no changes on our side as to how files are created or downloaded since last wednessday, so if it worked previously we have no idea as to why it would stop working now. I tested the exact file you are trying to download and can open it using Windows Explorer or 7zip both without problems.

    I have re-run our data export to recreate the same file again, in order to ensure the problem doesn't lie there. Otherwise I'd expect it to be some issue during file transfer, of you're sure nothing changed on your side.

    Regards,
    Bert
    Bert på Trafiklab
  • Nothing has changed on our side as far as I'm aware, this has been an issue for a month not since last Wednesday?

    I've attached the last GTFS that works (file name starts with dk-) and also the most recent file (skane.zip). The GTFS that works came through our automatic pipeline for context but the latter I downloaded directly from the URL. I thought this may help the investigation.

    Let me know if there's anything else I can do to help.

    Kind regards
    Luke Morgan
  • My bad, I read the date wrong.

    Both files you uploaded open normally when I download them. The date for which your import stopped working coincides with the date we added a new file to our datasets, booking_rules.txt. It might be worth to verify if it's really the download which is failing in your automated pipeline, and not the import of this new file booking_rules.

    We have not heard any other complaints regarding the ingestion of these zip files, which leads me to believe that the zip files are correctly compressed and should open without issues. Does the old file open on your computer without issues? In that case it may be worth to try opening a recent file downloaded through your automatic pipeline.

    Regards,
    Bert


    Bert på Trafiklab
  • No problem.

    We found the issue with the file for our systems, it can read the zip (although I still can't manually) but the issue arrises as an IO error because stop_times has entries which are not referenced in booking_rules (121120000365600738).

    Thanks for your help investigating this Bert.

    Kind regards
    Luke Morgan
  • Hi Luke,

    Glad to hear you found the issue.

    Please provide the full stop_time row and dataset in case there are rows in stop_times referring to a non-existing booking_rule, so we can fix any possible bugs in our datasets. I looked up the id you provided 121120000365600738, but it matches a row in booking_rules:

    stop_times.txt

    121120000365600737,23:01:00,23:01:00,9022012080020002,1,Malmö C,2,1,0,1,121120000365600738,
    121120000365600737,23:01:45,23:01:45,9022012080021002,2,Malmö C,2,2,427.08,0,121120000365600738,121120000365600738
    121120000365600737,23:02:34,23:02:34,9022012080030002,3,Malmö C,2,2,879.82,0,121120000365600738,121120000365600738
    121120000365600737,23:03:03,23:03:03,9022012080018002,4,Malmö C,2,2,1204.72,0,121120000365600738,121120000365600738
    121120000365600737,23:04:00,23:04:00,9022012080016002,5,Malmö C,2,2,1776.41,0,121120000365600738,121120000365600738
    121120000365600737,23:05:02,23:05:02,9022012080070002,6,Malmö C,2,2,2256.95,0,121120000365600738,121120000365600738
    121120000365600737,23:07:23,23:07:23,9022012080014002,7,Malmö C,2,2,3118.6,0,121120000365600738,121120000365600738
    121120000365600737,23:09:02,23:09:02,9022012080013024,8,Malmö C,2,2,3700.89,0,121120000365600738,121120000365600738
    121120000365600737,23:12:00,23:12:00,9022012080000001,9,Malmö C,1,2,4358.78,1,,121120000365600738

    booking_rules.txt

    121120000365600738,1,120,,,"Turen körs med taxi och beställs på tel: 0771-77 44 99, minst två timmar i förväg. Ska du resa tidigt på morgonen behöver du beställa dagen innan. För grupper 5-9 personer ska beställning göras minst fem arbetsdagar i förväg.",
    Regards,
    Bert
    Bert på Trafiklab
  • Yes I can see that is does exist, it was a matter of bad logging on our side.

    It seems like we have to investigate further how we want to handle booking_rules as it's causing issues at various points in our pipeline.

    No need to investigate any further, we can manually remove this file and any references to make it fit.

    Thanks for your help again Bert, sorry if I lead you down a rabbit hole!
    Luke Morgan
  • No problem! Let us know in case you should find any issues with the GTFS contents, as we always strive to follow the GTFS standards so our files can be used in all systems and tools.

    If you did not receive an email regarding this upcoming change in january, please check if your email address on developer.trafiklab.se is correct and whether the email may have been classed as spam.

    Regards,
    Bert

    Bert på Trafiklab

Kommentera eller skriv ett nytt inlägg

Ditt namn och inlägg kan ses av alla. Din e-post visas aldrig publikt.