Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading some GBFS links #10

Closed
jc-ulles opened this issue Apr 26, 2023 · 6 comments
Closed

Error loading some GBFS links #10

jc-ulles opened this issue Apr 26, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@jc-ulles
Copy link

Hi,
On many French cities (for example Marseille, Lyon...), I get an error when trying to load the get_station_status() :

"The supplied "city" argument looks like the top-level "gbfs.json" URL, but the webpage for the station_status .json feed doesn't seem to exist. Please supply the actual URL or the name of the city as a string."

I think this is due to the layout of the data in some APIs. Is there a resolution?
Thanks for your help!

@simonpcouch
Copy link
Owner

Thanks for the issue! Confirming that I see this as well with one of the Marseille feeds:

library(gbfs)

get_station_status("https://gbfs.api.ridedott.com/public/v2/marseille/gbfs.json")
#> Error in find_feed_from_top_level(city_, feed_): The supplied "city" argument 
#> looks like the top-level "gbfs.json" URL, but the webpage for the station_status 
#> .json feed doesn't seem to exist. Please supply the actual URL or the name of 
#> the city as a string.

Created on 2023-04-26 with reprex v2.0.2

It looks like, at least for this feed, there is no station_status feed:

{"data":{"en":{"feeds":[{"name":"gbfs_versions","url":"https://gbfs.api.ridedott.com/public/v2/gbfs_versions.json"},{"name":"free_bike_status","url":"https://gbfs.api.ridedott.com/public/v2/marseille/free_bike_status.json"},{"name":"geofencing_zones","url":"https://gbfs.api.ridedott.com/public/v2/marseille/geofencing_zones.json"},{"name":"system_information","url":"https://gbfs.api.ridedott.com/public/v2/marseille/system_information.json"},{"name":"system_pricing_plans","url":"https://gbfs.api.ridedott.com/public/v2/marseille/system_pricing_plans.json"},{"name":"vehicle_types","url":"https://gbfs.api.ridedott.com/public/v2/marseille/vehicle_types.json"}]}},"last_updated":1682527258,"ttl":0,"version":"2.3"}

In that case, there's not much I can do from this package. Do you have any examples of gbfs.json feeds that do supply a station_status feed but the package is unable to identify it? Could you send the link if so?

@jc-ulles
Copy link
Author

Oh I forgot that there is effectively no data in Marseille. On the other hand, Nancy (and many others) is really problematic: https://transport.data.gouv.fr/gbfs/nancy/gbfs.json

@jc-ulles
Copy link
Author

Oh I forgot that there is effectively no data in Marseille. On the other hand, Nancy (and many others) is really problematic: https://transport.data.gouv.fr/gbfs/nancy/gbfs.json

Same for Lyon here: https://transport.data.gouv.fr/gbfs/lyon/gbfs.json

@simonpcouch
Copy link
Owner

Reproduced, thanks!

This ought to be fixed at some point. In the meantime, supplying the URL of the station_status feed itself seems to work fine:

library(gbfs)

res <- get_station_status("https://transport.data.gouv.fr/gbfs/nancy/gbfs.json")
#> Error in find_feed_from_top_level(city_, feed_): The supplied "city" argument 
#> looks like the top-level "gbfs.json" URL, but the webpage for the station_status 
#> .json feed doesn't seem to exist. Please supply the actual URL or the name of 
#> the city as a string.

res2 <- get_station_status("https://transport.data.gouv.fr/gbfs/nancy/station_status.json")

head(res2)
#>   is_installed is_renting is_returning last_reported num_bikes_available
#> 1            1          1            1    1682527913                   8
#> 2            1          1            1    1682527538                  10
#> 3            1          1            1    1682527674                  18
#> 4            1          1            1    1682527895                   3
#> 5            1          1            1    1682527972                   1
#> 6            1          1            1    1682527763                   7
#>   num_docks_available station_id        last_updated year month day hour minute
#> 1                   7         30 2023-04-26 12:55:11 2023     4  26   12     55
#> 2                  14         29 2023-04-26 12:55:11 2023     4  26   12     55
#> 3                   7          1 2023-04-26 12:55:11 2023     4  26   12     55
#> 4                  12         33 2023-04-26 12:55:11 2023     4  26   12     55
#> 5                  15          6 2023-04-26 12:55:11 2023     4  26   12     55
#> 6                  11         19 2023-04-26 12:55:11 2023     4  26   12     55

Created on 2023-04-26 with reprex v2.0.2

@simonpcouch simonpcouch added the bug Something isn't working label Apr 26, 2023
@jc-ulles
Copy link
Author

Thanks for the alternative, I will use it!

@simonpcouch
Copy link
Owner

Thanks for the issue, @jc-ulles. :) The problem has now been resolved and the fix will be in the CRAN version of the package soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants