MaxHalford / bike-sharing-history

๐Ÿšฒ Git scraping for bike sharing APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bike-sharing-history

This repo tracks the status of bike stations from various bike-sharing providers. The data is fetched every 15 minutes. The results are stored and versioned as GeoJSON files. This is done using the git scraping technique.

The weather forecast for the next 24 hours is also collected every 15 minutes, for each city.

Everyone is welcome to add new cities. You simply have to contribute the necessary details to scripts/systems.py, and then send out a pull request.

Live data

# Country City Provider Stations Weather
001 ๐Ÿ‡ฆ๐Ÿ‡ช Dubai Careem BIKE dubai/careem-bike.geojson dubai.json
002 ๐Ÿ‡ฆ๐Ÿ‡บ Brisbane JCDecaux brisbane/jcdecaux.geojson brisbane.json
003 ๐Ÿ‡ง๐Ÿ‡ช Brussels JCDecaux brussels/jcdecaux.geojson brussels.json
004 ๐Ÿ‡ง๐Ÿ‡ช Namur JCDecaux namur/jcdecaux.geojson namur.json
005 ๐Ÿ‡ง๐Ÿ‡ท Rio de Janeiro Bike Itaรบ rio-de-janeiro/bike-itau.geojson rio-de-janeiro.json
006 ๐Ÿ‡จ๐Ÿ‡ฆ Vancouver Mobi Bike Share vancouver/mobi-bike-share.geojson vancouver.json
007 ๐Ÿ‡ช๐Ÿ‡ธ Santander JCDecaux santander/jcdecaux.geojson santander.json
008 ๐Ÿ‡ช๐Ÿ‡ธ Sevilla JCDecaux sevilla/jcdecaux.geojson sevilla.json
009 ๐Ÿ‡ช๐Ÿ‡ธ Valencia JCDecaux valencia/jcdecaux.geojson valencia.json
010 ๐Ÿ‡ซ๐Ÿ‡ท Amiens JCDecaux amiens/jcdecaux.geojson amiens.json
011 ๐Ÿ‡ซ๐Ÿ‡ท Belfort Optymo belfort/optymo.geojson belfort.json
012 ๐Ÿ‡ซ๐Ÿ‡ท Besanรงon JCDecaux besancon/jcdecaux.geojson besancon.json
013 ๐Ÿ‡ซ๐Ÿ‡ท Bordeaux Bird bordeaux/bird.geojson bordeaux.json
014 ๐Ÿ‡ซ๐Ÿ‡ท Bordeaux VCub bordeaux/vcub.geojson bordeaux.json
015 ๐Ÿ‡ซ๐Ÿ‡ท Brest Donkey Republic brest/donkey-republic.geojson brest.json
016 ๐Ÿ‡ซ๐Ÿ‡ท Carcassonne Cyclolib carcassonne/cyclolib.geojson carcassonne.json
017 ๐Ÿ‡ซ๐Ÿ‡ท Cergy-Pontoise JCDecaux cergy-pontoise/jcdecaux.geojson cergy-pontoise.json
018 ๐Ÿ‡ซ๐Ÿ‡ท Chรขlons-en-Champagne Bird chalons-en-champagne/bird.geojson chalons-en-champagne.json
019 ๐Ÿ‡ซ๐Ÿ‡ท Clermont-Ferrand C-Vรฉlo clermont-ferrand/c-velo.geojson clermont-ferrand.json
020 ๐Ÿ‡ซ๐Ÿ‡ท Crรฉteil JCDecaux creteil/jcdecaux.geojson creteil.json
021 ๐Ÿ‡ซ๐Ÿ‡ท Draguignan Bird draguignan/bird.geojson draguignan.json
022 ๐Ÿ‡ซ๐Ÿ‡ท La Roche-sur-Yon Bird la-roche-sur-yon/bird.geojson la-roche-sur-yon.json
023 ๐Ÿ‡ซ๐Ÿ‡ท Laval Bird laval/bird.geojson laval.json
024 ๐Ÿ‡ซ๐Ÿ‡ท Lille V'lille lille/v-lille.geojson lille.json
025 ๐Ÿ‡ซ๐Ÿ‡ท Lyon JCDecaux lyon/jcdecaux.geojson lyon.json
026 ๐Ÿ‡ซ๐Ÿ‡ท Marseille JCDecaux marseille/jcdecaux.geojson marseille.json
027 ๐Ÿ‡ซ๐Ÿ‡ท Marseille Bird marseille/bird.geojson marseille.json
028 ๐Ÿ‡ซ๐Ÿ‡ท Marseille Lime marseille/lime.geojson marseille.json
029 ๐Ÿ‡ซ๐Ÿ‡ท Millau Bird millau/bird.geojson millau.json
030 ๐Ÿ‡ซ๐Ÿ‡ท Montluรงon Bird montlucon/bird.geojson montlucon.json
031 ๐Ÿ‡ซ๐Ÿ‡ท Montpellier Vรฉlomagg' montpellier/velomagg.geojson montpellier.json
032 ๐Ÿ‡ซ๐Ÿ‡ท Mulhouse JCDecaux mulhouse/jcdecaux.geojson mulhouse.json
033 ๐Ÿ‡ซ๐Ÿ‡ท Nancy JCDecaux nancy/jcdecaux.geojson nancy.json
034 ๐Ÿ‡ซ๐Ÿ‡ท Nantes JCDecaux nantes/jcdecaux.geojson nantes.json
035 ๐Ÿ‡ซ๐Ÿ‡ท Paris Lime paris/lime.geojson paris.json
036 ๐Ÿ‡ซ๐Ÿ‡ท Paris Smovengo paris/smovengo.geojson paris.json
037 ๐Ÿ‡ซ๐Ÿ‡ท Rouen JCDecaux rouen/jcdecaux.geojson rouen.json
038 ๐Ÿ‡ซ๐Ÿ‡ท Saint-Etienne Vรฉlivert saint-etienne/velivert.geojson saint-etienne.json
039 ๐Ÿ‡ซ๐Ÿ‡ท Sarreguemines Bird sarreguemines/bird.geojson sarreguemines.json
040 ๐Ÿ‡ซ๐Ÿ‡ท Toulouse JCDecaux toulouse/jcdecaux.geojson toulouse.json
041 ๐Ÿ‡ซ๐Ÿ‡ท Valenciennes Donkey Republic valenciennes/donkey-republic.geojson valenciennes.json
042 ๐Ÿ‡ซ๐Ÿ‡ท Vannes Vรฉlocรฉo vannes/veloceo.geojson vannes.json
043 ๐Ÿ‡ซ๐Ÿ‡ท Vichy Bird vichy/bird.geojson vichy.json
044 ๐Ÿ‡ฎ๐Ÿ‡ช Dublin JCDecaux dublin/jcdecaux.geojson dublin.json
045 ๐Ÿ‡ฏ๐Ÿ‡ต Toyama JCDecaux toyama/jcdecaux.geojson toyama.json
046 ๐Ÿ‡ฑ๐Ÿ‡น Vilnius JCDecaux vilnius/jcdecaux.geojson vilnius.json
047 ๐Ÿ‡ฑ๐Ÿ‡บ Luxembourg JCDecaux luxembourg/jcdecaux.geojson luxembourg.json
048 ๐Ÿ‡ณ๐Ÿ‡ด Lillestrรธm JCDecaux lillestrom/jcdecaux.geojson lillestrom.json
049 ๐Ÿ‡ธ๐Ÿ‡ช Lund JCDecaux lund/jcdecaux.geojson lund.json
050 ๐Ÿ‡ธ๐Ÿ‡ช Stockholm JCDecaux stockholm/jcdecaux.geojson stockholm.json
051 ๐Ÿ‡ธ๐Ÿ‡ฎ Ljubljana JCDecaux ljubljana/jcdecaux.geojson ljubljana.json
052 ๐Ÿ‡ธ๐Ÿ‡ฎ Maribor JCDecaux maribor/jcdecaux.geojson maribor.json
053 ๐Ÿ‡บ๐Ÿ‡ธ Boulder BCycle boulder/bcycle.geojson boulder.json
054 ๐Ÿ‡บ๐Ÿ‡ธ Chattanooga Bike Chattanooga chattanooga/bike-chattanooga.geojson chattanooga.json
055 ๐Ÿ‡บ๐Ÿ‡ธ San Francisco Bay Area Bay Wheels san-francisco-bay-area/bay-wheels.geojson san-francisco-bay-area.json

Archives

The git history contains the state of each station and weather at several points in time. This git history can be turned into Parquet files for easy consumption. This is done by archive.py script. The latter generates Parquet files. These files are stored in a GCP bucket, here.

An easy way to query these files is to use DuckDB. The following Python snippet shows how to fetch the all bike station updates for the city of Toulouse:

import duckdb

with duckdb.connect(":memory:") as con:
    con.execute("SET s3_endpoint='storage.googleapis.com'")
    updates = con.execute(f"""
    SELECT *
    FROM READ_PARQUET('s3://bike-sharing-history/toulouse/jcdecaux/*/*.parquet');
    """).fetch_df()

And here's a snippet to fetch the 24 hour weather forecast at different points in time for the city of Toulouse:

with duckdb.connect(":memory:") as con:
    con.execute("SET s3_endpoint='storage.googleapis.com'")
    weather = con.execute(f"""
    SELECT *
    FROM READ_PARQUET('s3://weather-forecast-history/toulouse/*/*.parquet');
    """).fetch_df()

If these exports are not adapted to your needs, feel welcome to reach out. The exports can be easily adapted to different needs, because the source of truth is the git history.

About

๐Ÿšฒ Git scraping for bike sharing APIs


Languages

Language:Python 100.0%