Detect the nearest transit stop from the given location

后端 未结 3 701
轮回少年
轮回少年 2020-12-12 12:54

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, et

3条回答
  •  执念已碎
    2020-12-12 13:30

    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:

    • location (latlng-object of the given location)
    • radius(radius to search for in meters)
    • types(array of valid types, e.g. ['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.

提交回复
热议问题