Appearance
地点检索相关 API
滴滴拥有近6千万的兴趣点 (POI: Point of Interest) 数据,开发者使用相关的API,可以获得这些数据来满足相关的场景需求。
地点相关的检索服务,主要包含了3个主要能力:
- 兴趣点(POI)关键词检索,通过输入关键字,返回兴趣点的具体信息
- 周边搜索,通过输入一个坐标点,返回该坐标点附近的兴趣点信息
- 输入提示,提供POI关键字联想功能
对于返回结果中的相关分类信息,可参阅兴趣点(POI)分类表
关键词检索 API
接口描述
根据关键词搜索POI信息,可以指定城市范围。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/place/text | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | 鉴权用的 API Key | YOUR_API_KEY |
| keywords | 是 | string | 检索关键词 | 麦当劳 |
| city | 否 | string | 查询城市 | 北京市 |
| location | 否 | string | 坐标,经纬度,格式"lng,lat" | 116.424790,39.956953 |
| types | 否 | string | POI过滤类型(每个类型6位数字),支持传多个。全部POI编码参考POI分类表 | "101000,101020" |
| show_fields | 否 | string | 返回结果的扩展信息,sub_poi_list:返回子点数据, 不传则不返回子点数据 | "sub_poi_list" |
| city_limit | 否 | boolean | 是否限定在当前城市检索,默认false 不限定城市 | false |
请求体参数(POST)
当使用POST方法时,请求体应为 TextSearchRequest 模型的JSON格式。
请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/place/text?key=YOUR_API_KEY&city=北京市&keywords=麦当劳&location=117.147277,39.14752&show_fields=sub_poi_list"POST
shell
curl -X POST 'https://lbs.xiaojukeji.com/api/v2/place/text?key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"city": "北京市",
"keywords": "麦当劳",
"location": "117.147277,39.14752",
"show_fields": "sub_poi_list"
}'响应
成功响应为 TextSearchResponse 模型的JSON格式。
响应示例
json
{
"status": 10000,
"msg": "OK",
"trace_id": "0aaca55168944b79635f35a225026302",
"results": [
{
"name": "麦当劳(和平里东街店)",
"location": {
"lng": 116.42479,
"lat": 39.956953
},
"address": "东城区和平里街道和平里6区8号楼1层109-2号",
"province": "北京市",
"city": "北京市",
"district": "东城区",
"adcode": "110101",
"address_all": "东城区和平里街道和平里6区8号楼1层109-2号麦当劳(和平里东街店)",
"poi_id": "103409742580789801567430176012805351997",
"type": "102000",
"sub_poi_list": [
{
"poi_id": "179919584780088526038817699620865083590",
"name": "麦当劳-得来速窗口",
"address": "东城区和平里街道和平里6区8号楼1层109-2号",
"location": {
"lng": 116.42499,
"lat": 39.956953
},
"type": "050118",
"select_tag": ""
}
]
},
{
"name": "麦当劳(怡和阳光大厦店)",
"location": {
"lng": 116.433074,
"lat": 39.95398
},
"address": "朝阳区东土城路12号怡和阳光大厦A座F1层",
"province": "北京市",
"city": "北京市",
"district": "朝阳区",
"adcode": "0",
"address_all": "朝阳区东土城路12号怡和阳光大厦A座F1层麦当劳(怡和阳光大厦店)",
"poi_id": "135054836965285927377645549833201050501",
"type": "102000",
}
]
}周边搜索 API
接口描述
根据指定坐标位置,搜索周边的兴趣点,如餐厅、商店、景点等。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/place/around | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | 鉴权用的 API Key | YOUR_API_KEY |
| keywords | 否 | string | 检索关键词 (keywords和types参数至少填一个) | 麦当劳 |
| location | 否 | string | 坐标,经纬度,格式"lng,lat" | 116.424790,39.956953 |
| max_distance | 否 | string | 以 location 为中心的最大检索范围的半径,单位为米,范围为0-50000,默认值为5000 | "1000" |
| city | 否 | string | 用户选择的地点的city名字(城市名) | 北京市 |
| sort_rule | 否 | string | 规定返回结果的排序规则。distance:按距离排序; weight:综合排序。 默认值为weight | "distance" |
| types | 否 | string | POI过滤类型 (每个类型6位数字),支持传多个类型,全部POI编码参考POI分类表 。 (keywords和types参数至少填一个) | "101000,101020" |
| show_fields | 否 | string | 返回结果的扩展信息,sub_poi_list:返回子点数据, 不传则不返回子点数据 | "sub_poi_list" |
| city_limit | 否 | boolean | 是否限定在当前城市检索,默认false 不限定城市 | false |
请求体参数(POST)
当使用POST方法时,请求体应为 PlaceAroundRequest 模型的JSON格式。
请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/place/around?key=YOUR_API_KEY&keywords=麦当劳&location=116.424790,39.956953&max_distance=1000&types=100000&show_fields=sub_poi_list"POST
shell
curl -X POST 'https://lbs.xiaojukeji.com/api/v2/place/around?key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"keywords": "麦当劳",
"location": "116.424790,39.956953",
"max_distance": "1000",
"types": "100000",
"show_fields": "sub_poi_list"
}'响应
成功响应为 TextSearchResponse 模型的JSON格式。
响应示例
json
{
"status": 10000,
"msg": "OK",
"trace_id": "0aaca551689449b8592b358925433502",
"results": [
{
"name": "麦当劳(怡和阳光大厦店)",
"location": {
"lng": 116.433074,
"lat": 39.95398
},
"address": "朝阳区东土城路12号怡和阳光大厦A座F1层",
"province": "北京市",
"city": "北京市",
"district": "朝阳区",
"adcode": "0",
"address_all": "朝阳区东土城路12号怡和阳光大厦A座F1层麦当劳(怡和阳光大厦店)",
"distance": 781,
"poi_id": "135054836965285927377645549833201050501",
"type": "102000",
"sub_poi_list": [
{
"poi_id": "179919584780088526038817699620865083589",
"name": "麦当劳-得来速窗口",
"address": "朝阳区东土城路12号怡和阳光大厦A座F1层",
"location": {
"lng": 116.433174,
"lat": 39.95418
},
"type": "050118",
"select_tag": ""
}
]
},
{
"name": "麦当劳(和平里东街店)",
"location": {
"lng": 116.42479,
"lat": 39.956953
},
"address": "东城区和平里街道和平里6区8号楼1层109-2号",
"province": "北京市",
"city": "北京市",
"district": "东城区",
"adcode": "110101",
"address_all": "东城区和平里街道和平里6区8号楼1层109-2号麦当劳(和平里东街店)",
"poi_id": "103409742580789801567430176012805351997",
"type": "102000",
}
]
}输入提示 API
接口描述
根据用户输入的关键字提供候选地点信息,实现输入时的联想提示功能,提升用户搜索体验。当用户输入关键字时,可以动态获取匹配的POI信息列表。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/place/inputtips | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | 鉴权用的 API Key | YOUR_API_KEY |
| keywords | 是 | string | 搜索关键词 | 星巴 |
| location | 否 | string | 坐标,经纬度,格式"lng,lat" | 116.434091,39.90923 |
| city | 否 | string | 城市名称 | 北京市 |
| types | 否 | string | POI过滤类型(每个类型6位数字),支持传多个。全部POI编码参考POI分类表 | "101000,101020" |
| show_fields | 否 | string | 返回结果的扩展信息,sub_poi_list:返回子点数据, 不传则不返回子点数据 | "sub_poi_list" |
| city_limit | 否 | boolean | 是否限定在当前城市检索,默认false 不限定城市 | false |
请求体参数(POST)
当使用POST方法时,请求体应为 TextSearchRequest 模型的JSON格式。
请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/place/inputtips?key=YOUR_API_KEY&keywords=星巴&city=北京市&show_fields=sub_poi_list"POST
shell
curl -X POST 'https://lbs.xiaojukeji.com/api/v2/place/inputtips?key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"keywords": "星巴",
"city": "北京市",
"show_fields": "sub_poi_list"
}'响应
成功响应为 TextSearchResponse 模型的JSON格式,与文本搜索相同。
响应示例
json
{
"status": 10000,
"msg": "OK",
"trace_id": "0aab11f468944e1c158ddcb625549802",
"results": [
{
"name": "星巴克(民生金融中心店)",
"location": {
"lng": 116.419983,
"lat": 39.907182
},
"address": "东城区建国门内大街28号民生金融中心C座1层",
"province": "北京市",
"city": "北京市",
"district": "东城区",
"adcode": "110101",
"address_all": "东城区建国门内大街28号民生金融中心C座1层星巴克(民生金融中心店)",
"poi_id": "110285444198432687599225390710798409401",
"type": "161300",
"sub_poi_list": [
{
"poi_id": "179919584780088526038817699620865083591",
"name": "星巴克-户外座位区",
"address": "东城区建国门内大街28号民生金融中心C座1层",
"location": {
"lng": 116.419983,
"lat": 39.907282
},
"type": "050118",
"select_tag": ""
}
]
},
{
"name": "星巴克(北京新闻大厦店)",
"location": {
"lng": 116.42196,
"lat": 39.907482
},
"address": "东城区建国门内大街26号1号新闻大厦1层",
"province": "北京市",
"city": "北京市",
"district": "东城区",
"adcode": "110101",
"address_all": "东城区建国门内大街26号1号新闻大厦1层星巴克(北京新闻大厦店)",
"poi_id": "256535798603776763721612589994177088680",
"type": "161300",
}
]
}