You can get the name, ID and coordinates of the bus station, and then get information about the bus stop with any other API. Here is the code:
var overlay; overlay = new google.maps.OverlayView(); overlay.draw = function() {}; overlay.setMap(map); $('#map-canvas').click(function(event){ var point = new google.maps.Point(event.pageX,event.pageY); var location = overlay.getProjection().fromContainerPixelToLatLng(point); //get map coordinates by click var request = { location: location, types: ['bus_station','subway_station'], //get bus stops and metro stations radius: 10, }; placesService = new google.maps.places.PlacesService(map); placesService.search(request, function(result, status, pagination){ station = result[0]; if(typeof station != 'undefined'){ pos = station.geometry['location']; //position bus_no = station.name.match(/\[([0-9]+)\]/i)[1]; //get ID by name alert(bus_no); // ID } }); });
source share