针对系统传入的地址进行归一化处理后返回地址唯一ID用来作为地址唯一标识
该服务属于地址解析聚合的子功能,返回用户传入系统地址的唯一ID。
https://api.map.baidu.com/address_analyzer/v1?address=北京市海淀区信息路甲九号&confidence=30&&ret_coordtype=bd09ll&addr_unify=1&ak=您的ak
//GET请求
参数名称 | 参数含义 | 示例 | 参数类型 | 默认值 | 必填 | 备注 |
---|---|---|---|---|---|---|
addr_unify | 是否返回地址归一结果 多源地址归一 | addr_unify=0不使用 | int | 0 | 否 | 返回address_unify_id 注:该功能为高级付费服务,用户不能直接在官网付费入口中直接购买,如有采买需求,请反馈平台联系我们,将有商务与您取得联系 |
参数名 | 含义 | 备注 | 示例 | |
---|---|---|---|---|
address_unify_id | 归一id | addr_unify=1时返回 注:该功能为高级付费服务,用户不能直接在官网付费入口中直接购买,如有采买需求,请反馈平台联系我们,将有商务与您取得联系 | E6880F547A42C91137F75EB864B6719F |
输入AK可生成包含IP/SN校验方式的代码
<?php// 此处填写你在控制台-应用管理-创建应用后获取的AK$ak = '您的AK';// 发起一个http get请求,并返回请求的结果// $url字段为请求的地址// $param字段为请求的参数function request_get($url = '', $param = array()) {if (empty($url) || empty($param)) {return false;}$getUrl = $url . "?" . http_build_query($param);$curl = curl_init(); // 初始化curlcurl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在curl_setopt($curl, CURLOPT_URL, $getUrl); // 抓取指定网页curl_setopt($curl, CURLOPT_TIMEOUT, 1000); // 设置超时时间1秒curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // curl不直接输出到屏幕curl_setopt($curl, CURLOPT_HEADER, 0); // 设置header$data = curl_exec($curl); // 运行curlif (!$data) {print("an error occured in function request_get(): " . curl_error($curl) . "\n");}curl_close($curl);return $data;}// 请求地址$url = 'https://api.map.baidu.com/address_analyzer/v1';// 构造请求参数$param['address'] = '北京市海淀区信息路甲九号';$param['confidence'] = '30';$param['ret_coordtype'] = 'bd09ll';$param['addr_unify'] = '1';$param['ak'] = $ak;$res = request_get($url, $param);// 将原始返回的结果打印出来print("请求的原始返回结果为:\n");print($res . "\n");?>
{"status": 0,"address": "北京市海淀区信息路甲九号","result": {"province": "北京市","province_code": "110000","city": "北京市","city_code": "110100","county": "海淀区","county_code": "110108","town": "上地街道","town_code": "110108022","road": "信息路","road_code": "004014ba01afe8b63a221c4e","section": "信息路(上地六街到上地五街)","section_code": "ebc13ff6a4ddcd370b1cc7ca","poi": "奎科科技大厦","poi_code": "1a30c5f8cbb55eff71210b02","address_unify_id": "E6880F547A42C91137F75EB864B6719F"},"detail": {"poi_xy": [116.3127950393378, 40.04773119283188],"poi_tag": "房地产;写字楼","aoi_id": "1a30c5f8cbb55eff71210b02","aoi_name": "奎科科技大厦","aoi_tag": "房地产;写字楼","address_precise": 1,"address_confidence": 80,"address_comprehension": 100,"address_level": "门址","address_poi": "","address_xy": [116.31343400404705, 40.04769957219149],"format_address": "北京市北京市海淀区上地街道信息路"}}
参数 | 值 | 备注 | 必选 |
---|---|---|---|
address | 北京市海淀区信息路甲九号 | 是 | |
ret_coordtype | bd09ll | 否 | |
confidence | 30 | 建议填 | |
addr_unify | 1 | 选填 |
上一篇
下一篇
本篇文章对您是否有帮助?