-2

i want to fetch Bus time and number etc using This in json or XML format in android , i am able to fetch mode=driving,mode=walking,mode=bicycling etc information , see this link for reference but i want mode=transit , you can check this Link here in Left corner you can see Bus Number, Bus arrival minutes, etc , i want these all details in XML or JSON format , can you suggest me the link or how can i do this ?

Thank you.

j0k
  • 22,600
  • 28
  • 79
  • 90
Ronak Mehta
  • 5,971
  • 5
  • 42
  • 69

1 Answers1

0

i got answer from https://stackoverflow.com/users/1171619/mike

1)There's no official Google Transit API at the momemnt. Transits are provided by agencies, and most of Transits are not public. So, Google is not allowed to open them as API.

2)u may try to consume the "unofficial" data using your link + "&output=json".

3)wever, the result won't be a valid JSON. Instead, that's something, that can be easily converted to a JavaScript object. (The differences are: there is no quotes around property names, the strings are not properly encoded etc.)

4)Imagine you got this JavaScript object. However, it won't allow you to easily get the structured route details. Object's properties contain the route points coordinates, but no descriptions. The only place where the descriptions may be found is 'panel' property, which contains a chunk of HTML text (you may find a link to the sample of HTML in my blog post)

5)So, you'll have to convert this HTML into XML (X-HTML) and then build the parser of this XML to get the essence data of a trip.

6)Seems like a bit of overkill to me. Having in mind, that "unofficial" API may change in the future, including slight changes in 'panel' HTML structure that will kill your parser.

Posted By Mike

Thanks Buddy

Community
  • 1
  • 1
Ronak Mehta
  • 5,971
  • 5
  • 42
  • 69