刚过完春节没几天,有个客户提出要获取高德地图的数据。
我看了下,回复说:这不是很简单嘛,高德有公开的开放平台,有足够的API支持用户获取数据,开发自己基于高德数据库的应用。
客户回复说:他的要求并不是简单的要求获取地图数据,以及某个POI(高德名词:信息点 -> Point Of Interest)的详细信息,客户要求基于高德地图的充电地图功能获取汽车充电站即时的充电枪信息,包括充电站位置、充电枪功率、目前是否在用等信息。
嗯,研究一下吧!
一、高德API已经提供了足够多的功能,包括关键词搜索、POI地点搜索,而且这些功能高德已经更新迭代,同时放在开放平台上,支持用户调用。
比如搜索:北京/东城区/医院的信息,高德API会给出非常详尽的信息。
(信息已经经过我的代码解析,响应的json信息非常地全面)
再比如搜索:第一条信息,北京协和医院东单院区的详细信息:
{
"count": "1",
"infocode": "10000",
"pois": [
{
"parent": "",
"address": "帅府园1号",
"business": {
"opentime_today": "08:00-17:00",
"keytag": "三甲医院",
"business_area": "王府井",
"alias": "协和医院东院|协和医院东单院区|北京协和医院东院",
"tel": "010-69156114",
"rectag": "三甲医院",
"opentime_week": "周一至周五08:00-17:00;周六至周日08:00-12:00;抽血截止时间:09:00"
},
"distance": "",
"pcode": "110000",
"adcode": "110101",
"pname": "北京市",
"cityname": "北京市",
"type": "医疗保健服务;综合医院;三级甲等医院",
"typecode": "090101",
"updateflag": "0",
"adname": "东城区",
"citycode": "010",
"children": [
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 南门 ",
"name": "北京协和医院东单院区(南门)",
"location": "116.415795,39.910767",
"id": "B0FFF3UGUW"
},
{
"typecode": "991401",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 东门 ",
"name": "北京协和医院东单院区(东门)",
"location": "116.417690,39.913490",
"id": "B0FFJ2P1C9"
},
{
"typecode": "991400",
"address": "北京市 东城区 帅府园一号",
"subtype": "门",
"sname": " 西北门 ",
"name": "北京协和医院东单院区(西北门)",
"location": "116.414091,39.912861",
"id": "B0FFFEFRZM"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 东北门 ",
"name": "北京协和医院东单院区(东北门)",
"location": "116.417592,39.914057",
"id": "B0FFFFYBXG"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 东3门 ",
"name": "北京协和医院东单院区(东3门)",
"location": "116.417795,39.911466",
"id": "B0HUASZ7GU"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 北门 ",
"name": "北京协和医院东单院区(北门)",
"location": "116.415772,39.914042",
"id": "B0FFIUI54A"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 西门 ",
"name": "北京协和医院东单院区(西门)",
"location": "116.414070,39.912124",
"id": "B0FFF9UO7Z"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 东2门 ",
"name": "北京协和医院东单院区(东2门)",
"location": "116.417812,39.912119",
"id": "B0J0U764PP"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 北3门 ",
"name": "北京协和医院东单院区(北3门)",
"location": "116.416445,39.914022",
"id": "B0FFITE3Y1"
},
{
"typecode": "991400",
"address": "帅府园1号北京协和医院东单院区",
"subtype": "门",
"sname": " 北2门 ",
"name": "北京协和医院东单院区(北2门)",
"location": "116.415233,39.914044",
"id": "B0FFL3PHBD"
}
],
"navi": {
"navi_poiid": "J50F002020_337922;482620",
"entr_location": "116.417824,39.914129",
"gridcode": "5916639310"
},
"name": "北京协和医院东单院区",
"indoor": {
"indoor_map": "0"
},
"location": "116.415768,39.912682",
"id": "B000A82Z2N"
}
],
"status": "1",
"info": "OK"
}
可见信息也是非常详尽的。
二、关于客户的需求。
因为客户要求获取高德地图上更多的详尽信息。我发现这部分数据,并没有在开放平台公开的API中体现。而想要获取这部分数据,就有些难度了。
好消息是目前已经有了一定的进展。
在研究之余,我也封装了一些高德开放平台的API接口,桌面软件也可以调用。算是对自己高德应用开发的一个开始吧。