博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
公交线路查询接口文档
阅读量:5307 次
发布时间:2019-06-14

本文共 4642 字,大约阅读时间需要 15 分钟。

公交路线查询

公交路线查询有很多网站都作了接口api,我使用的是haoservice的接口,需要您申请key()

haoservice提供的有公交站点的查询,公交线路的查询,还有公交路线的规划.

1.公交站点查询,该接口根据关键字查询周边公交站点 .

1.1.形式:

http://apis.haoservice.com/lifeservice/busline/stopname

例如:

http://apis.haoservice.com/lifeservice/busline/stopname?city=0512&keywords=生物纳米园西&key=您申请的APPKEY

1.2参数说明:

名称     类型 必须    说明

key        string 是   APP KEY

city        string 是   城市名称,如:苏州或0512

keywords       string 是   站点名称关键字。 如:生物纳米园西(支持模糊匹配)

1.3.返回示例:

{

    "error_code":0,

    "reason":"Success",

    "result":{

        "busstops":[{

            "adcode":320506,

            "citycode":"0512",                  /*城市区号*/

            "timestamp":null,

            "id":"BV20030270",

            "name":"生物纳米园西(公交站)",      /*站点名称*/

            "location":"120.727766,31.258087",  /*站点坐标*/

            "buslines":[{                       /*公交线路*/

                "start_stop":"启月街首末站",

                "end_stop":"星华街游客中心首末站",

                "id":"320500012825",

                "name":"176(启月街首末站--星华街游客中心首末站)",

                "location":"120.727766,31.258087"

            },{

                "start_stop":"启月街首末站",

                "end_stop":"星华街游客中心首末站",

                "id":"320500011036","name":"176路空调(启月街首末站--星华街游客中心首末站)",

                "location":"120.727766,31.258087"

            },{

                "start_stop":"星华街游客中心首末站",

                "end_stop":"启月街首末站",

                "id":"320500012826",

                "name":"176(星华街游客中心首末站--启月街首末站)",

                "location":"120.727677,31.258105"

            },{

                "start_stop":"星华街游客中心首末站",

                "end_stop":"启月街首末站",

                "id":"320500011038",

                "name":"176路空调(星华街游客中心首末站--启月街首末站)",

                "location":"120.727677,31.258105"

            }]

        }]

    }

}

2.公交线路查询,根据关键词可以查询某一路公交经过站点和时间等.

2..1.形式:

http://apis.haoservice.com/lifeservice/busline/linename

例如:

http://apis.haoservice.com/lifeservice/busline/linename?city=苏州&keywords=10&key=您申请的APPKEY

2.2.参数说明:

名称       类型 必须   说明

key       string 是   APP KEY

city       string 是   城市区号,如:苏州或0512

keywords      string 是   线路名称关键字。 如:110(支持模糊匹配)

2.3.返回示例:

{

    "error_code":0,

    "reason":"Success",

    "result":{

    "buslines":[{

        "id":"320500012746",

        "name":"松陵110(喜庆苑--山湖东路口)",    /*线路名称*/

        "type":"普通公交",        "polyline":"120.630445,31.119342;120.631847,31.119362;120.635081,31.11943;120.635129,31.120956;120.635173,31.12235;120.635237,31.123992;................ 

31.161515;120.680074,31.161533;120.688185,31.161606;120.68909,31.161595;120.689331,31.15692;120.689461,31.152195", /*途径线路坐标*/

        "citycode":"0512",                          /*城市区号*/

        "start_stop":"喜庆苑",                      /*始发站点*/

        "end_stop":"山湖东路口",                    /*终点站*/

        "start_time":"0620",                        /*始发时间*/

        "end_time":"1810",                          /*停运时间*/

        "company":"苏州吴江公共交通有限公司",       /*所属公司*/

        "distance":"14.96524",                      /*距离(单位:km*/

        "basic_price":1.0,                          /*票价(单位:圆)*/

        "bounds":"120.630445,31.119342;120.689461,31.161606", /*界限坐标*/

        "busstops":[{                               /*停靠站点*/

            "sequence":"1",                         /*站点序号*/

            "id":"BV20028197",

            "name":"喜庆苑",                        /*站点名称*/

            "location":"120.630445,31.119342"       /*站点坐标*/

        },{

            "sequence":"2",

            "id":"BV20028538",

            "name":"联杨小区东",

            "location":"120.635129,31.120956"

        },{

            "sequence":"3",

            "id":"BV20028433",

            "name":"联杨新村",

            "location":"120.635237,31.123992"

        },{

            ......

        },{

            "sequence":"24",

            "id":"BV20028418",

            "name":"新城花园(吴江)",

            "location":"120.689331,31.15692"

        },{

            "sequence":"25",

            "id":"BV20028152",

            "name":"山湖东路口",

            "location":"120.689461,31.152195"

        }]

    }]}

}

3.公交路线规划查询,起点和终点之间的换乘信息,(因名字重复难以辨别,故用经纬度)

3.1.形式:

http://apis.haoservice.com/lifeservice/busline/planning

例如:

http://apis.haoservice.com/lifeservice/busline/planning?origin=120.732446,31.255821&destination=120.73017,31.259022&city=苏州&key=您申请的APPKEY

3.2.参数说明:

名称          类型    必须   说明

key         string    是   APP KEY

city         string    是   城市区号,如:苏州或0512

origin         string    是   起始地坐标,如:120.73017,31.259022

destination string    是   目的地坐标,如120.73017,31.259022

3.3.返回示例:

{

    "error_code":0,

    "reason":"Success",

    "result":{

        "route":{

            "origin":"120.732446,31.255821",

            "destination":"120.730170,31.259022",

            "distance":"562",

            "taxi_cost":10.0,

            "transits":[{

                "cost":"1.0",

                "duration":917,

                "nightflag":0,

                "walking_distance":289,

                "segments":[{

                    "walking":{

                        "origin":"120.731995,31.255573",

                        "destination":"120.733253,31.253971",

                        "distance":"219",

                        "duration":"225",

                        "steps":[{

                            "instruction":"沿新平街步行219米到达腾飞创新园",

                            "road":"新平街",

                            "distance":"219",

                            "duration":"",

                            "polyline":"120.731995,31.255573;120.732407,31.255035;120.732445,

                                        31.254988;120.732559,31.254818;120.733078,31.254189;

                                        120.733253,31.253971",

                            "action":"",

                            "assistant_action":"到达腾飞创新园"

                    }]},...........

               

                            "walking":{

                                "origin":"120.730919,31.257700",

                                "destination":"120.730141,31.259102",

                                "distance":"194",

                                "duration":"199",

                                "steps":[{

                                    "instruction":"沿新平街步行170米左转",

                                    "road":"新平街",

                                    "distance":"170",

                                    "duration":"",

                                    "polyline":"120.730919,31.257700;120.730759,31.258121;

                                                120.730698,31.258255;120.730415,31.258963;

                                                120.730347,31.259157",

                                    "action":"左转",

                                    "assistant_action":""

                                },{

                                    "instruction":"步行24米到达目的地",

                                    "road":"",

                                    "distance":"24",

                                    "duration":"",

                                    "polyline":"120.730347,31.259157;120.730286,31.259146;

                                                120.730141,31.259102",

                                    "action":"",

                                    "assistant_action":"到达目的地"

                            }]},

                            "bus":{

                                "buslines":null

                            },

                            "entrance":null,

                            "exit":null

                    }]

            }]

        }

    }

}

备注说明

全国各大城市的公交线路查询,如北京、广州、上海、深圳等城市公交车查询,公交换乘查询等,提供近2000条公交线路,5万余公交站点数据查询

 

转载于:https://www.cnblogs.com/uyupai/p/4015494.html

你可能感兴趣的文章
中建项目环境迁移说明
查看>>
三.野指针和free
查看>>
activemq5.14+zookeeper3.4.9实现高可用
查看>>
TCP/IP详解学习笔记(3)IP协议ARP协议和RARP协议
查看>>
简单【用户输入验证】
查看>>
python tkinter GUI绘制,以及点击更新显示图片
查看>>
CS0103: The name ‘Scripts’ does not exist in the current context解决方法
查看>>
20130330java基础学习笔记-语句_for循环嵌套练习2
查看>>
Spring面试题
查看>>
窥视SP2010--第一章节--SP2010开发者路线图
查看>>
C语言栈的实现
查看>>
代码为什么需要重构
查看>>
TC SRM 593 DIV1 250
查看>>
SRM 628 DIV2
查看>>
2018-2019-2 20165314『网络对抗技术』Exp5:MSF基础应用
查看>>
Python-S9-Day127-Scrapy爬虫框架2
查看>>
SecureCRT的使用方法和技巧(详细使用教程)
查看>>
右侧导航栏(动态添加数据到list)
查看>>
81、iOS本地推送与远程推送详解
查看>>
虚拟DOM
查看>>