Distance to metro and bus station?

Hi guys.

I need to show the distance between my place( a hotel)and the nearest metro station and bus station? Can i do that with the google maps api?

How do I do it?

Yep, totally possible with the Google Maps API. The easiest way is to store both the hotel and the stations as ‘geographic address’ data types, then use Bubble’s built-in distance calculation.

For more control, use the API Connector with Google’s Distance Matrix API.

It will give you a list of nearby points of interest from your location by returning valuable data, like distance, time to travel, and other useful logistics.

Its very easy, use AI to build a ApI call for your exact need and ask it to give you curl example.

Then just add it to your api connect also ask ai what option need to be dunamic. And use those dynamic option to fill your specific details.

If you like i can integrate it for you, for free

Yes — you can do this with Google Maps API, but the right approach depends on what you mean by “nearest”.

If you want the nearest metro station and bus station automatically, you’ll typically use Google Places API (Nearby Search) to find the closest “subway_station” and “bus_station” around your hotel’s location, then use Google Distance Matrix API (or Directions API) to calculate the distance (and optionally travel time). In Bubble, the clean setup is:

  1. Store your hotel location as a Geographic address (e.g., Hotel's address).

  2. Call Places Nearby Search with:

    • location = hotel lat/lng

    • rankby=distance (so Google returns nearest first)

    • type=subway_station (for metro)

    • then do a second call with type=bus_station (for bus)

  3. From each response, take the first result (that’s the nearest), save:

    • station name

    • station place_id

    • station lat/lng

  4. Now calculate distance:

    • Quick/simple: use Bubble’s built-in Hotel's address:distance from Station's address (straight-line distance).

    • Accurate (walking/driving + time): call Distance Matrix API with:

      • origins = hotel lat/lng

      • destinations = station lat/lng

      • mode=walking (or driving/transit if supported)

    • Display returned distance.text and duration.text.

1 Like

thanks a lot guys. so, I need to work with a different Google API (key) called Googole Places API. Did i get it right?

yes sir

1 Like