Getting started overview

Transport for Bordeaux, France provides public transport data through the Bordeaux Métropole open data portal. This data is available in standard General Transit Feed Specification (GTFS) and GTFS-Realtime (GTFS-RT) formats, which are widely adopted for public transit information globally. The GTFS format provides static information such as routes, schedules, and stop locations, while GTFS-RT offers dynamic updates like vehicle positions, service alerts, and trip updates in real time Google's GTFS documentation. Accessing this data does not require API keys or an account; all datasets are publicly available for direct download or consumption via specified URLs.

This getting started guide focuses on retrieving these data feeds for use in applications. You will learn how to locate the relevant datasets on the Bordeaux Métropole portal, understand the different data types available, and perform a basic request to fetch a GTFS-RT feed. The process is designed to be straightforward for developers familiar with data consumption from open data platforms.

The primary access point for all Transport for Bordeaux, France data is the Bordeaux Métropole open data portal. This portal serves as a centralized repository for various public datasets, including those related to the Bordeaux Métropole public transport network (TBM). Developers can browse available datasets, view metadata, and obtain direct links to the data files, which are often provided in formats such as CSV, JSON, or direct GTFS/GTFS-RT feeds.

For those new to GTFS or GTFS-RT, understanding the structure of these formats is crucial for effective data utilization. The GTFS specification details how static transit data, including stops, routes, trips, and fares, should be organized into a collection of CSV files GTFS Reference Guide. GTFS-RT, on the other hand, uses Protocol Buffers to serialize real-time information, offering efficiency in data transfer for dynamic updates GTFS-Realtime specification. Familiarity with these specifications will significantly aid in parsing and interpreting the data obtained from the Transport for Bordeaux, France feeds.

Create an account and get keys

Accessing Transport for Bordeaux, France's public transport data does not require an account or API keys. All data is provided as open data through the Bordeaux Métropole open data portal and is freely accessible. This means developers can directly access the data feeds without any registration process or credential management.

The absence of API keys simplifies the initial setup, allowing developers to integrate the data into their applications immediately. You will primarily interact with direct URLs for the GTFS and GTFS-RT feeds. These URLs are stable and are published on the respective dataset pages within the open data portal. While no authentication is needed, it is recommended to review the terms of use on the Bordeaux Métropole data portal to ensure compliance with any data usage policies.

To locate the specific data feeds, navigate to the Bordeaux Métropole open data portal. Use the search function or browse by category to find datasets related to 'TBM' or 'transport'. Key datasets typically include:

  • Static GTFS data: Contains schedules, routes, stops, and other unchanging information. This is often provided as a ZIP archive of CSV files.
  • Real-time GTFS-RT data: Provides live updates on vehicle positions, trip delays, and service alerts. This is usually available as a continuously updated feed via a specific URL.

Once you locate a dataset, the information page will provide details on its format, update frequency, and the direct access link. For GTFS-RT feeds, this link will typically point to a Protocol Buffer message that your application can consume and decode. No special headers or authentication tokens are required for these requests.

Your first request

To make your first request, you will fetch a GTFS-RT feed, which provides real-time updates for the TBM network. This example uses a command-line tool like curl to demonstrate how to retrieve the data. You will need a protobuf decoder to interpret the binary data returned by the GTFS-RT feed. For this example, we'll focus on fetching the raw data.

Step 1: Locate the GTFS-RT feed URL

Navigate to the TBM Vehicle Positions GTFS-RT dataset page on the Bordeaux Métropole open data portal. On this page, look for the 'API' or 'Export' section, which will provide the direct URL for the GTFS-RT feed. As of this guide, a typical URL might look like https://data.bordeaux-metropole.fr/wfs/tbm_gtfs_rt_vehicle_positions.pb (note: verify the exact URL on the portal as it may change).

Step 2: Make the request using curl

Open your terminal or command prompt and execute the following command, replacing the placeholder URL with the actual GTFS-RT feed URL you found:


curl -o vehicle_positions.pb "https://data.bordeaux-metropole.fr/wfs/tbm_gtfs_rt_vehicle_positions.pb"

This command downloads the binary Protocol Buffer data into a file named vehicle_positions.pb. The -o flag specifies the output file.

Step 3: Decode the Protocol Buffer data (conceptual)

The downloaded .pb file contains binary data encoded using Protocol Buffers. To read this data, you would typically use a GTFS-RT library in your preferred programming language (e.g., Python, Java, JavaScript). These libraries include a Protocol Buffer compiler that can interpret the GTFS-RT specification.

For instance, in Python, you might use the gtfs-realtime-bindings library:


from google.transit import gtfs_realtime_pb2

feed = gtfs_realtime_pb2.FeedMessage()
with open('vehicle_positions.pb', 'rb') as f:
    feed.ParseFromString(f.read())

for entity in feed.entity:
    if entity.HasField('vehicle'):
        print(f"Vehicle ID: {entity.vehicle.trip.trip_id}, Latitude: {entity.vehicle.position.latitude}, Longitude: {entity.vehicle.position.longitude}")

This Python snippet demonstrates how you would parse the downloaded .pb file and extract relevant information such as vehicle IDs and their geographical coordinates. The specific fields available depend on the GTFS-RT feed type (e.g., vehicle positions, trip updates, service alerts) and the data provided by Transport for Bordeaux, France.

Common next steps

After successfully retrieving your first GTFS-RT feed, consider these common next steps to further integrate Transport for Bordeaux, France's data into your applications:

  1. Explore other datasets: The Bordeaux Métropole open data portal offers various datasets beyond real-time vehicle positions. Look for static GTFS data (schedules, routes, stops), service alerts, and trip updates. Each dataset serves a different purpose and can enhance the functionality of your application. For example, the static GTFS data is essential for route planning and displaying fixed schedules TBM GTFS Stops dataset.
  2. Implement a GTFS-RT parser: Integrate a robust GTFS-RT parsing library into your application's codebase. Libraries are available for most popular programming languages and simplify the process of decoding Protocol Buffer messages into structured data objects. This allows you to efficiently access specific fields like vehicle latitude, longitude, trip ID, and service alert details.
  3. Develop real-time mapping: Use the real-time vehicle position data to display public transport vehicles on a map interface. Libraries like Leaflet.js or Google Maps Platform APIs can be used to visualize vehicle movements dynamically. Regularly polling the GTFS-RT feed and updating vehicle markers on the map can create a live tracking experience Google Maps JavaScript API overview.
  4. Create service alerts: Utilize the service alerts feed (if available) to inform users about disruptions, delays, or changes to public transport services. Displaying these alerts prominently in your application can improve user experience by providing timely information.
  5. Combine static and real-time data: For comprehensive applications, combine static GTFS data with real-time GTFS-RT data. For example, use static route information to draw bus or tram lines, and then overlay real-time vehicle positions on those lines. This provides a complete picture of the public transport network and its current operational status.
  6. Consider data refresh rates: GTFS-RT feeds are updated frequently. Design your application to poll the feed at appropriate intervals (e.g., every 15-30 seconds for vehicle positions) to balance data freshness with resource usage and adherence to any usage guidelines from the data provider.
  7. Review usage policies: While the data is open, it is always good practice to review the terms of use on the Bordeaux Métropole open data portal. This ensures your application complies with any specified attribution requirements or fair usage policies.

Troubleshooting the first call

When making your first call to Transport for Bordeaux, France's GTFS-RT feeds, you might encounter some common issues. Here’s a guide to troubleshooting:

Step What to do Where
Verify URL accuracy Ensure the GTFS-RT feed URL is exactly as provided on the Bordeaux Métropole open data portal. Typos, extra spaces, or outdated links are common issues. TBM Vehicle Positions GTFS-RT dataset page
Check internet connectivity Confirm your machine has an active internet connection and can reach external domains. Try pinging a known website like google.com. Your local machine/network configuration
Inspect curl output for errors If curl returns an error, examine the HTTP status code. A 404 Not Found indicates an incorrect URL, while a 5xx error suggests a server-side issue. Increase verbosity with curl -v for more details. Terminal/Command Prompt
Confirm data format The GTFS-RT feeds are binary Protocol Buffer messages. If you receive unreadable characters, it's likely correct. The issue might be with your decoding process, not the data retrieval itself. Downloaded .pb file content
Use a Protocol Buffer debugger/viewer For initial inspection, online Protocol Buffer viewers or command-line tools (like protoc --decode_raw if you have the .proto definitions) can help confirm the structure and content of the downloaded .pb file. Relevant software/online tools
Review GTFS-RT library usage If you are using a programming library to parse the data, ensure you are using it correctly, initializing the correct message types (e.g., FeedMessage for the root of a GTFS-RT feed), and handling potential exceptions. Your application's source code and the library's documentation
Check for service disruptions Occasionally, the data provider's service may experience temporary outages or maintenance. Check the Bordeaux Métropole open data portal or TBM's official communication channels for announcements regarding data availability. TBM Official website or Bordeaux Métropole open data portal

If you continue to experience issues, refer to the detailed documentation on the Bordeaux Métropole open data portal for TBM datasets. This resource often contains specific notes or contact information for data-related inquiries.