android搜索附近的巴士站谷歌api

时间:2016-12-17 13:36:43

标签: java android

我有搜索附近公交车站的android项目我有这个网址: http://travelplanner.mobiliteit.lu/hafas/query.exe/dot?performLocating=2&tpl=stop2csv&stationProxy=yes&look_maxdist=250&look_x=6112550&look_y=49610700

我在代码中写道

  StringBuilder sb = newStringBuilder("http://travelplanner.mobiliteit.lu/hafas/query.exe/dot?performLocating=2&tpl=stop2csv&stationProxy=yes &");
                   sb.append("look_maxdist=250");sb.append("look_x="+mLatitude");sb.append("look_y="+mLongitude");

其中mLatitude和mLongitude用于当前用户位置

现在响应不是json而是http响应

6,113204;49,610280;200403005;Belair, Sacré-Coeur;http://travelplanner.mobiliteit.lu/hafas/stboard.exe/dn?L=vs_stb&input=200403005&start 

6,112260;49,612644;200403002;Belair, Archiducs;http://travelplanner.mobiliteit.lu/hafas/stboard.exe/dn?L=vs_stb&input=200403002&start 

或链接可能

id=A=1@O=Belair, Sacré-Coeur@X=6,113204@Y=49,610280@U=82@L=200403005@B=1@p=1481807866; 

id=A=1@O=Belair, Archiducs@X=6,112260@Y=49,612644@U=82@L=200403002@B=1@p=1481807866; 

问题是如何将此结果继续到ge坐标(6,113204,49,610280)并将标记放在地图上 链接在这里 https://data.public.lu/en/datasets/arrets-de-transport-public-et-departs-en-temps-reel/

1 个答案:

答案 0 :(得分:0)

通过此网址,您可以获得请求的ID。

http://travelplanner.mobiliteit.lu/hafas/query.exe/dot?performLocating=2&tpl=stop2csv&stationProxy=yes& look_maxdist = 250& look_x = 6112550& look_y = 49610700

现在您收到的回复如下:

  

ID = A = 1 @ O =绿悠,%20Sacré-心@ X = 6,113204 @ Y = 49,610279 @ U = 82 @ L = 200403005 @ B = 1 @ p值= 1459856195

现在,使用以下网址附加收到的回复,您将在json中收到回复。

http://travelplanner.mobiliteit.lu/restproxy/departureBoard?accessId=cdt&format=json&

例如:

http://travelplanner.mobiliteit.lu/restproxy/departureBoard?accessId=cdt&format=json&id=A=1@O=Belair,%20Sacré-Coeur@X=6,113204@Y=49,610279@U=82@L=200403005@B=1@p=1459856195