城市公交线路数据API接口的使用

用的是haoservice这个网站的接口,部分接口是免费的,公交线路的接口首次申请赠送100次的免费使用次数,此后再使用就需要花钱了。需要注册申请APPKEY,网址http://www.haoservice.com/docs/23。

一、公交线路

接口地址: http://apis.haoservice.com/lifeservice/busline/linename

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

返回JSON内容:

{
    "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;120.635311, 31.125351;120.643647,31.125883;120.648947,31.126167;120.65164,31.1263;120.653158,31.126376;120.654354,31.126562;120.658258,31.127242;120.661196, 31.127802;120.663887,31.12831;120.66675,31.128817;120.667637,31.129075;120.668632,31.129479;120.669508,31.129765;120.670514,31.13016;120.669703, 31.131548;120.668892,31.132789;120.666691,31.135756;120.664276,31.139012;120.663865,31.138777;120.663433,31.138562;120.662613,31.13824;120.660714, 31.137743;120.65685,31.13675;120.6543,31.136114;120.651816,31.135478;120.651301,31.135348;120.650334,31.13812;120.649152,31.141221;120.648079, 31.143948;120.64757,31.145162;120.647497,31.145442;120.647508,31.145649;120.647726,31.146173;120.649003,31.148546;120.649175,31.148866;120.649237, 31.149006;120.649325,31.149203;120.64941,31.15032;120.649448,31.151239;120.649535,31.153319;120.649567,31.154884;120.648998,31.155163;120.647754, 31.155821;120.646638,31.156368;120.646574,31.156557;120.646531,31.156765;120.647046,31.158083;120.647368,31.158744;120.647538,31.158707;120.648783, 31.158157;120.651816,31.156812;120.652086,31.156825;120.652743,31.15703;120.654251,31.157778;120.655996,31.158654;120.659346,31.160398;120.659759, 31.160607;120.660248,31.160788;120.660757,31.160933;120.661331,31.161078;120.661588,31.161066;120.662489,31.161257;120.663079,31.161337;120.663669, 31.161392;120.663745,31.161399;120.667634,31.161418;120.678043,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": "4",
                "id": "BV20028302",
                "name": "长安花苑小学",
                "location": "120.654354,31.126562"
            },
            {
                "sequence": "5",
                "id": "BV20028271",
                "name": "长安站",
                "location": "120.658258,31.127242"
            },
            {......
            },
            {
                "sequence": "24",
                "id": "BV20028418",
                "name": "新城花园(吴江)",
                "location": "120.689331,31.15692"
            },
            {
                "sequence": "25",
                "id": "BV20028152",
                "name": "山湖东路口",
                "location": "120.689461,31.152195"
            }]
        }]
    }
}

二、公交站点

接口地址: http://apis.haoservice.com/lifeservice/busline/stopname

请求示例:http://apis.haoservice.com/lifeservice/busline/stopname?city=北京&keywords=动物园&key=您申请的APPKEY

返回JSON内容:

{
    "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"
            }]
        }]
    }
}

三、公交路线规划

接口地址: http://apis.haoservice.com/lifeservice/busline/planning

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

返回JSON内容:

{
    "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;120.635311, 31.125351;120.643647,31.125883;120.648947,31.126167;120.65164,31.1263;120.653158,31.126376;120.654354,31.126562;120.658258,31.127242;120.661196, 31.127802;120.663887,31.12831;120.66675,31.128817;120.667637,31.129075;120.668632,31.129479;120.669508,31.129765;120.670514,31.13016;120.669703, 31.131548;120.668892,31.132789;120.666691,31.135756;120.664276,31.139012;120.663865,31.138777;120.663433,31.138562;120.662613,31.13824;120.660714, 31.137743;120.65685,31.13675;120.6543,31.136114;120.651816,31.135478;120.651301,31.135348;120.650334,31.13812;120.649152,31.141221;120.648079, 31.143948;120.64757,31.145162;120.647497,31.145442;120.647508,31.145649;120.647726,31.146173;120.649003,31.148546;120.649175,31.148866;120.649237, 31.149006;120.649325,31.149203;120.64941,31.15032;120.649448,31.151239;120.649535,31.153319;120.649567,31.154884;120.648998,31.155163;120.647754, 31.155821;120.646638,31.156368;120.646574,31.156557;120.646531,31.156765;120.647046,31.158083;120.647368,31.158744;120.647538,31.158707;120.648783, 31.158157;120.651816,31.156812;120.652086,31.156825;120.652743,31.15703;120.654251,31.157778;120.655996,31.158654;120.659346,31.160398;120.659759, 31.160607;120.660248,31.160788;120.660757,31.160933;120.661331,31.161078;120.661588,31.161066;120.662489,31.161257;120.663079,31.161337;120.663669, 31.161392;120.663745,31.161399;120.667634,31.161418;120.678043,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": "4",
                "id": "BV20028302",
                "name": "长安花苑小学",
                "location": "120.654354,31.126562"
            },
            {
                "sequence": "5",
                "id": "BV20028271",
                "name": "长安站",
                "location": "120.658258,31.127242"
            },
            {......
            },
            {
                "sequence": "24",
                "id": "BV20028418",
                "name": "新城花园(吴江)",
                "location": "120.689331,31.15692"
            },
            {
                "sequence": "25",
                "id": "BV20028152",
                "name": "山湖东路口",
                "location": "120.689461,31.152195"
            }]
        }]
    }
}
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值