/bike-sharing-history

๐Ÿšฒ Git scraping for bike sharing APIs

Primary LanguagePython

bike-sharing-history

๐Ÿ“ See blog post

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 ๐Ÿ‡ฆ๐Ÿ‡ท Buenos Aires Ecobici buenos-aires/ecobici.geojson buenos-aires.json
003 ๐Ÿ‡ฆ๐Ÿ‡น Vienna Nextbike vienna/nextbike.geojson vienna.json
004 ๐Ÿ‡ง๐Ÿ‡ช Antwerp Blue-bike antwerp/blue-bike.geojson antwerp.json
005 ๐Ÿ‡ง๐Ÿ‡ช Antwerp Velo Antwerpen antwerp/velo-antwerpen.geojson antwerp.json
006 ๐Ÿ‡ง๐Ÿ‡ช Brussels JCDecaux brussels/jcdecaux.geojson brussels.json
007 ๐Ÿ‡ง๐Ÿ‡ช Namur JCDecaux namur/jcdecaux.geojson namur.json
008 ๐Ÿ‡ง๐Ÿ‡ท Porto Alegre Bike Itaรบ porto-alegre/bike-itau.geojson porto-alegre.json
009 ๐Ÿ‡ง๐Ÿ‡ท Rio de Janeiro Bike Itaรบ rio-de-janeiro/bike-itau.geojson rio-de-janeiro.json
010 ๐Ÿ‡ง๐Ÿ‡ท Salvador Bike Itaรบ salvador/bike-itau.geojson salvador.json
011 ๐Ÿ‡ง๐Ÿ‡ท Sampa Bike Itaรบ sampa/bike-itau.geojson sampa.json
012 ๐Ÿ‡จ๐Ÿ‡ฆ Montrรฉal BIXI montreal/bixi.geojson montreal.json
013 ๐Ÿ‡จ๐Ÿ‡ฆ Quรฉbec City ร Vรฉlo quebec-city/avelo.geojson quebec-city.json
014 ๐Ÿ‡จ๐Ÿ‡ฆ Toronto Bike Share Toronto toronto/bike-share-toronto.geojson toronto.json
015 ๐Ÿ‡จ๐Ÿ‡ฆ Vancouver Mobi Bike Share vancouver/mobi-bike-share.geojson vancouver.json
016 ๐Ÿ‡จ๐Ÿ‡ด Bogotรก Tembici bogota/tembici.geojson bogota.json
017 ๐Ÿ‡จ๐Ÿ‡ฟ Brno Nextbike brno/nextbike.geojson brno.json
018 ๐Ÿ‡จ๐Ÿ‡ฟ Olomouc Nextbike olomouc/nextbike.geojson olomouc.json
019 ๐Ÿ‡จ๐Ÿ‡ฟ Ostrava Nextbike ostrava/nextbike.geojson ostrava.json
020 ๐Ÿ‡จ๐Ÿ‡ฟ Prague Nextbike prague/nextbike.geojson prague.json
021 ๐Ÿ‡ฉ๐Ÿ‡ช Berlin Nextbike berlin/nextbike.geojson berlin.json
022 ๐Ÿ‡ฉ๐Ÿ‡ช Dรผsseldorf Nextbike dusseldorf/nextbike.geojson dusseldorf.json
023 ๐Ÿ‡ฉ๐Ÿ‡ช Frankfurt Nextbike frankfurt/nextbike.geojson frankfurt.json
024 ๐Ÿ‡ฉ๐Ÿ‡ช Freiburg Frelo Freiburg freiburg/frelo-freiburg.geojson freiburg.json
025 ๐Ÿ‡ฉ๐Ÿ‡ช Leipzig Nextbike leipzig/nextbike.geojson leipzig.json
026 ๐Ÿ‡ช๐Ÿ‡ธ Barcelona Bicing barcelona/bicing.geojson barcelona.json
027 ๐Ÿ‡ช๐Ÿ‡ธ Madrid bicimad madrid/bicimad.geojson madrid.json
028 ๐Ÿ‡ช๐Ÿ‡ธ Santander JCDecaux santander/jcdecaux.geojson santander.json
029 ๐Ÿ‡ช๐Ÿ‡ธ Sevilla JCDecaux sevilla/jcdecaux.geojson sevilla.json
030 ๐Ÿ‡ช๐Ÿ‡ธ Valencia JCDecaux valencia/jcdecaux.geojson valencia.json
031 ๐Ÿ‡ซ๐Ÿ‡ท Amiens JCDecaux amiens/jcdecaux.geojson amiens.json
032 ๐Ÿ‡ซ๐Ÿ‡ท Besanรงon JCDecaux besancon/jcdecaux.geojson besancon.json
033 ๐Ÿ‡ซ๐Ÿ‡ท Cergy-Pontoise JCDecaux cergy-pontoise/jcdecaux.geojson cergy-pontoise.json
034 ๐Ÿ‡ซ๐Ÿ‡ท Clermont-Ferrand C-Vรฉlo clermont-ferrand/c-velo.geojson clermont-ferrand.json
035 ๐Ÿ‡ซ๐Ÿ‡ท Crรฉteil JCDecaux creteil/jcdecaux.geojson creteil.json
036 ๐Ÿ‡ซ๐Ÿ‡ท Lyon JCDecaux lyon/jcdecaux.geojson lyon.json
037 ๐Ÿ‡ซ๐Ÿ‡ท Marseille JCDecaux marseille/jcdecaux.geojson marseille.json
038 ๐Ÿ‡ซ๐Ÿ‡ท Mulhouse JCDecaux mulhouse/jcdecaux.geojson mulhouse.json
039 ๐Ÿ‡ซ๐Ÿ‡ท Nancy JCDecaux nancy/jcdecaux.geojson nancy.json
040 ๐Ÿ‡ซ๐Ÿ‡ท Nantes JCDecaux nantes/jcdecaux.geojson nantes.json
041 ๐Ÿ‡ซ๐Ÿ‡ท Paris Smovengo paris/smovengo.geojson paris.json
042 ๐Ÿ‡ซ๐Ÿ‡ท Toulouse JCDecaux toulouse/jcdecaux.geojson toulouse.json
043 ๐Ÿ‡ญ๐Ÿ‡บ Budapest MOL Bubi budapest/mol-bubi.geojson budapest.json
044 ๐Ÿ‡ฎ๐Ÿ‡ช Dublin JCDecaux dublin/jcdecaux.geojson dublin.json
045 ๐Ÿ‡ฎ๐Ÿ‡น Milan Bikemi milan/bikemi.geojson milan.json
046 ๐Ÿ‡ฏ๐Ÿ‡ต Tokyo Docomo Bike Sharing tokyo/docomo-bike-sharing.geojson tokyo.json
047 ๐Ÿ‡ฏ๐Ÿ‡ต Toyama JCDecaux toyama/jcdecaux.geojson toyama.json
048 ๐Ÿ‡ฑ๐Ÿ‡น Vilnius JCDecaux vilnius/jcdecaux.geojson vilnius.json
049 ๐Ÿ‡ฑ๐Ÿ‡บ Luxembourg JCDecaux luxembourg/jcdecaux.geojson luxembourg.json
050 ๐Ÿ‡ฒ๐Ÿ‡ฝ Guadalajara Mibici guadalajara/mibici.geojson guadalajara.json
051 ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico City Ecobici mexico-city/ecobici.geojson mexico-city.json
052 ๐Ÿ‡ณ๐Ÿ‡ด Bergen Bergen Bysykkel bergen/bergen-bysykkel.geojson bergen.json
053 ๐Ÿ‡ณ๐Ÿ‡ด Lillestrรธm JCDecaux lillestrom/jcdecaux.geojson lillestrom.json
054 ๐Ÿ‡ณ๐Ÿ‡ด Oslo Oslo Bysykkel oslo/oslo-bysykkel.geojson oslo.json
055 ๐Ÿ‡ณ๐Ÿ‡ด Stavanger Kolumbus Bysykkel stavanger/kolumbus-bysykkel.geojson stavanger.json
056 ๐Ÿ‡ธ๐Ÿ‡ช Gothenburg Styr & Stรคll gothenburg/styr--stall.geojson gothenburg.json
057 ๐Ÿ‡ธ๐Ÿ‡ช Lund JCDecaux lund/jcdecaux.geojson lund.json
058 ๐Ÿ‡ธ๐Ÿ‡ฎ Ljubljana JCDecaux ljubljana/jcdecaux.geojson ljubljana.json
059 ๐Ÿ‡ธ๐Ÿ‡ฎ Maribor JCDecaux maribor/jcdecaux.geojson maribor.json
060 ๐Ÿ‡บ๐Ÿ‡ธ Boulder BCycle boulder/bcycle.geojson boulder.json
061 ๐Ÿ‡บ๐Ÿ‡ธ Chattanooga Bike Chattanooga chattanooga/bike-chattanooga.geojson chattanooga.json
062 ๐Ÿ‡บ๐Ÿ‡ธ Chicago Divvy chicago/divvy.geojson chicago.json
063 ๐Ÿ‡บ๐Ÿ‡ธ Honolulu Biki honolulu/biki.geojson honolulu.json
064 ๐Ÿ‡บ๐Ÿ‡ธ Milwaukee Bublr Bikes milwaukee/bublr-bikes.geojson milwaukee.json
065 ๐Ÿ‡บ๐Ÿ‡ธ New York City citibike new-york-city/citibike.geojson new-york-city.json
066 ๐Ÿ‡บ๐Ÿ‡ธ Philadelphia Indego philadelphia/indego.geojson philadelphia.json
067 ๐Ÿ‡บ๐Ÿ‡ธ San Francisco Bay Area Bay Wheels san-francisco-bay-area/bay-wheels.geojson san-francisco-bay-area.json
068 ๐Ÿ‡บ๐Ÿ‡ธ Santa Cruz BCycle santa-cruz/bcycle.geojson santa-cruz.json
069 ๐Ÿ‡บ๐Ÿ‡ธ Washington D.C. Capital Bikeshare washington-d-c/capital-bikeshare.geojson washington-d-c.json
070 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Brighton Beryl brighton/beryl.geojson brighton.json
071 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Manchester Beryl manchester/beryl.geojson manchester.json
072 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Norwich Beryl norwich/beryl.geojson norwich.json
073 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Plymouth Beryl plymouth/beryl.geojson plymouth.json
074 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Portsmouth Beryl portsmouth/beryl.geojson portsmouth.json
075 ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ Southampton Beryl southampton/beryl.geojson southampton.json
076 ๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ Glasgow Nextbike glasgow/nextbike.geojson glasgow.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.