Till senaste kommentaren
Detta inlägg är gammalt och kan innehålla inaktuell information.

How to get all SiteIDs of all stops?

In response of "SL Platsuppslag", there is a field named "SiteID".
There is a API "GTFS Sverige 2", from which we get some files such as stops.txt, etc, and there is a "stop_id" field. Obviously stop_id doesn't equals SiteID, but what is the difference between them?

There is a way to get all SiteIDs of all stops in Stockholm?

Thank you for your attention.

Kommentarer

  • Hi Zhihui

    SitesID is Stockholm Länstrafik (SL) identifier for a stop and stops_id is Samtrafiken and resrobots unique identifier for a stop. Right now there is no mapping between StiesID and stops_id, so you have to do the mapping yourself.

    To get all the SiteIDs for SL you can use SL Hållplatser och Linjer 2:

    All sites:
    http://api.sl.se/api2/LineData.json?key=[your key]&model=sites

    //Daniel

    Team Trafiklab
  • Hi Zhihui

    Sorry, I was wrong before. There exist a mapping file between SiteID and stops_id. To get the mapping file you can use this api call:

    https://api.trafiklab.se/v2/samtrafiken/gtfs/extra/agency_stops_275.txt?key=[your key]

    //Daniel

    Team Trafiklab
  • Hi Daniel,

    First thank you very much for you response.
    I got all SiteIDs from "SL Hållplatser och Linjer 2". Unfortunately there is no Longitude/Latitude in each record.

    In stops.txt of "GTFS Sweden 2", we can get Longitude/Latitude but no SiteIDs.
    I tried the API "https://api.trafiklab.se/v2/samtrafiken/gtfs/extra/agency_stops_275.txt?key=[your key]", the response is as follows:

    agency_id,stop_id,agency_stop_id
    275,740000706,80813
    275,740000779,61011
    275,740001036,80722

    It seems there is no mapping between stop_id and SiteId, am I wrong somewhere?
    Looking forward your reply. thank you very much.

  • Hi Zhiui

    Yeah my bad again. Thought agency_stop_id mapped to SiteId but it seam to be mapping to StopArea. I linked a model representation of a stop:
    https://www.trafiklab.se/sites/default/files/do...

    As you can see a Site consist of one to many StopArea and a StopArea consist of one to many StopPoint.

    To get all the StopArea you use this api call:
    http://api.sl.se/api2/LineData.json?key=[your key]&model=sites

    The number you are interested in is "StopAreaNumber":"10375" and not the "StopPointNumber". You also get the coordinates when you make this api call.

    //Daniel

    Team Trafiklab
  • Hi Daniel,

    Now I think I understand stop_id and SiteID. The SiteID might includes multiple stop_id, so the SiteID doesn't have a Longitude/Latitude, but stop_id does.
    Your responses are very helpful, thank you very much.

    Best Regards,
    Zhihui Tang

  • Good to hear and good luck with your project.

    //Daniel

    Team Trafiklab

Kommentera eller skriv ett nytt inlägg

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