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

What's the difference between LineData StopArea and LineData StopPoint?

I downloaded and processed both. They look identical to me.
Did I miss anything?
Thanks.

Kommentarer

  • Do you mean when used in the request URL?
    All of the requests below will return a Response with the value of Type being StopPoint, meaning that the requests are being interpreted as StopPoint requests.
    http://api.sl.se/api2/LineData.xml?model=Stop&key=XXX
    http://api.sl.se/api2/LineData.xml?model=StopPoint&key=XXX
    http://api.sl.se/api2/LineData.xml?model=StopArea&key=XXX
    http://api.sl.se/api2/LineData.xml?model=StopFooBar&key=XXX

    // Kevin
    Team Trafiklab
  • Sorry for being unclear.
    I meant the xml files I extracted using StopPoint or StopArea. They look the same.
  • Could you show how your request URLs look like? Don't include the key.
    Team Trafiklab
  • Thank you 
    I am using R to read and process the xml files. I hope the codes are self-explanatory.

    X1 <- read_xml ("http://api.sl.se/api2/LineData.xml?model=StopArea&key=MYKEY")%>% 
    x1 <- as_list (x1) 
    y1 <- x1 $ ResponseData 

    x2 <- read_xml ( "Http://api.sl.se/api2/LineData.xml?model=StopPoint&key=MYKEY")%>% 
    x2 <- as_list (x2) 
    y2 <- x2 $ ResponseData 

    Then I unlist and make y1, y2, as data.frame. Both return 13183 rows and 9 columns. 
    The column names are
    [8] "StopPointNumber"            
    [2] "StopPointNumber"              
    [3] "StopAreaNumber"             
    [4] "LocationNorthingCoordinate" 
    [5] "LocationEastingCoordinate" 
    [6] "ZoneShortName"              
    [7] "StopAreaTypeCode"           
    [8] "LastModifiedUtcDateTime"    
    [9 ] "ExistsFromDate"
    And the data look identical.

    By the way, I also get identical results from querying JourneyPattern and JourneyPatternPointOnline.
  • Your two requests works as it is intended, they both will return a Response of the Type "StopPoint", which is why the data you receive is the same. The API doesn't accept "model=StopArea" as a parameter, it will map everything that matches "model=Stop.*" to return a StopPoint response.
    I'm guessing that you're confused by the documentation (which, to be fair, I was as well) that can be found here: https://www.trafiklab.se/api/sl-hallplatser-och-linjer-2/dokumentation
    The different concepts described at the top of the page are not acceptable values for the "model" parameter in the request. Instead they are listed as sub-headers under the large header called "Example". There you will find sub-headers like "site", "StopPoint", "line", "JourneyPatternPointOnline" and "transportMode". These are the values that you would want to use in your model-parameter during requests.

    This would also explain why you get the same result when using "JourneyPattern" and "JourneyPatternPointOnline" as the model-parameter, they are both returning a JourneyPatternPointOnline response.

    // Kevin
    Team Trafiklab
  • Thank you very much. This explains it. Yes I was indeed confused by the documentation and the API smartly accepts both model names.

    A followup question:
    one column in JourneyPatternPointOnline is JourneyPatternPointNumber, which I assume matches StopPointNumber in StopPoint.
    Let's say
    a = JourneyPatternPointOnline$JourneyPatternPointNumber
    b = StopPoint$StopPointNumber

    But the number of unique value of a is 11615, and the number of unique value of b is 13170. The number of intersection between a and b is 10845.

    Is there anything unexpected here?


  • I'm not sure I understand your example/question. I've searched for the value 11615 in the JourneyPatternPointOnline request and can't find a result. Could you elaborate?
    You are correct however that a JourneyPatternPointNumber should match a StopPointNumber.

    // Kevin
    Team Trafiklab
  • Thank you.
    11615 is not a value in a. It is the total number of distinct values in a.
    Similarly the number of non-repeating values in b is 13170.
    10845 is the number of overlap between distinct a and distinct b.
    That is to say, a and b are not fully matched.
    I hope this time I made it clear.

    /Otto
  • I wouldn't be too worried about having more StopPointNumbers than references to them from JourneyPatternPointNumbers. There can be several reasons why a StopPoint exists but is not found in a JourneyPatternPointNumber, the StopPoint might not exist anymore but is not yet removed from the dataset or it might just be used in certain times (seasonal, during delays).
    If you've found a JourneyPatternPointNumber that has no matching StopPointNumber, something might be wrong with the data. Is this the case, and if yes, could you give some examples?

    // Kevin
    Team Trafiklab
  • Thank you for your reply. That explains more.
    I double checked the data I extracted from .xml files.
    Somehow the StopPointNumber is recognised as integer, instead of character like JourneyPatternPointNumber. I figured this by adding one or two zeros in front of some integers. So the number I mentioned earlier was wrong. But the issue still exists.
    I found 303 JourneyPatternPointNumber that are not included in StopPointNumber. Examples are:
    "00139" "00141" "00144" "00145" "00147" "00163"
    ....
    "68008" "68007" "68817" "68816" "68508" "68509"
    Could you check it from your side?
    Thank you again and have a nice weekend.
  • Thanks, Otto! I will make sure this is looked into.

    // Kevin
    Team Trafiklab

Kommentera eller skriv ett nytt inlägg

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