I need to get all the nearby public transit information within certain distance from a given location. The type of public transit can be either bus, train, etc..
If I use Google Map to query "Transit Stop near a Location (e.g. Bugis Street Singapore)", then it will return us all the nearby Transit Stop that I want. Like the one shown in the picture. But I need its API to get those details out. (such as bus service No, bus stop ID, etc. as shown in the picture). But I couldn't found any.
I have tried using the Google Map Nearby Place API to search for a place with the type of transit_station, bus_station, train_station,etc... But they all return Zero Result. I could only use this API to search for Nearby Place of Interest, but not nearby transit.
I've also check Google Transit API, but I only found API to insert transit data to Google but Not to extract it out. I think Google didn't publicize the transit API yet.
I have check the site Gothere.sg. And confused How? because they able to detect the nearby transit. Is it only because they specify the direction "From-To".
I have read a pretty similar question on Detecting nearby transit. Perhaps It is not yet possible if we use Google APIs.
But nothing is impossible for me
As Last resort, I also check with the provider, publictransport.sg. I hack around with the API. And found out that it can provide me with a transit stop with some coordinate. But it lack a nearby API which found on Google Map.
So one workaround I could think of at the moment, is to use the provider in this case was publictransport.sg which give me the Stop ID and its coordinate. To do this, First, I have to translate the location name using the Google GeoCoding API into Coordinate then I have to create my own nearby calculation to find the nearby station by comparing the searched Coordinate against all the station coordinate that the provider have.
Now, it is possible for me, but very painful :-)
Is there a way to retrieve all transit stop data from a given location (either using Google Maps API or Any other API)? and How did u do that?
At least thanks for reading my lengthy question. I appreciate any help from you. Thanks in advance :-)
The bus stop code is the unique 8 digit number given to every bus stop. The code can be found on the website via the map search within the bus stop marker balloon or on the timetable at stops on street.
Well, you could use the places-API to find the nearest transit-stops, it works fine for me for the given location.
Just do a request with the parameters:
latlng
-object of the given location)['bus_station','subway_station']
)Checkout the fiddle: http://jsfiddle.net/doktormolle/aZrvs/
For retrieving further details(bus service No, bus stop ID) I don't have any good idea right now.
There should be a way, those data on maps.google.com will be retrieved by using AJAX, so there is a ressource. But as long as there is no public API to fetch those results it would not be legal to use this ressource.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With