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格式。
json
{
"keywords": "检索关键词",
"city": "查询城市",
"location": "坐标,格式:lng,lat",
"types": "POI 过滤类型编码,多个用英文逗号分隔",
"show_fields": "返回结果扩展字段",
"city_limit": "是否限定城市,布尔值"
}请求示例
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": "状态码,整数",
"msg": "返回消息",
"trace_id": "请求追踪 ID",
"results": [
{
"name": "POI 名称",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"address": "地址",
"province": "省份",
"city": "城市",
"district": "行政区",
"adcode": "行政编码",
"address_all": "完整地址",
"distance": "距离,单位米",
"poi_id": "POI 唯一标识",
"type": "POI 类型编码",
"sub_poi_list": [
{
"poi_id": "子点 ID",
"name": "子点名称",
"address": "子点地址",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"type": "子点类型",
"select_tag": "子点热度标签"
}
]
}
]
}响应示例
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格式。
json
{
"keywords": "检索关键词",
"location": "坐标,格式:lng,lat",
"city": "城市名称",
"max_distance": "最大检索距离,单位米",
"sort_rule": "排序规则,如 distance/weight",
"types": "POI 过滤类型编码,多个用英文逗号分隔",
"show_fields": "返回结果扩展字段",
"city_limit": "是否限定城市,布尔值"
}请求示例
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": "状态码,整数",
"msg": "返回消息",
"trace_id": "请求追踪 ID",
"results": [
{
"name": "POI 名称",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"address": "地址",
"province": "省份",
"city": "城市",
"district": "行政区",
"adcode": "行政编码",
"address_all": "完整地址",
"distance": "距离,单位米",
"poi_id": "POI 唯一标识",
"type": "POI 类型编码",
"sub_poi_list": [
{
"poi_id": "子点 ID",
"name": "子点名称",
"address": "子点地址",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"type": "子点类型",
"select_tag": "子点热度标签"
}
]
}
]
}响应示例
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格式。
json
{
"keywords": "检索关键词",
"city": "查询城市",
"location": "坐标,格式:lng,lat",
"types": "POI 过滤类型编码,多个用英文逗号分隔",
"show_fields": "返回结果扩展字段",
"city_limit": "是否限定城市,布尔值"
}请求示例
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": "状态码,整数",
"msg": "返回消息",
"trace_id": "请求追踪 ID",
"results": [
{
"name": "POI 名称",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"address": "地址",
"province": "省份",
"city": "城市",
"district": "行政区",
"adcode": "行政编码",
"address_all": "完整地址",
"distance": "距离,单位米",
"poi_id": "POI 唯一标识",
"type": "POI 类型编码",
"sub_poi_list": [
{
"poi_id": "子点 ID",
"name": "子点名称",
"address": "子点地址",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"type": "子点类型",
"select_tag": "子点热度标签"
}
]
}
]
}响应示例
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",
}
]
}多边形检索 API
接口描述
根据关键词和矩形搜索POI信息。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/place/polygon | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | 鉴权用的 API Key | YOUR_API_KEY |
| keywords | 是 | string | 检索关键词 | 加油站 |
| polygons | 是 | string | 矩形数组,每个元素代表一个矩形,格式: ["左上经纬度;右下经纬度", ...],最多同时传 10 个矩形 | ["122.12482,37.4808;122.14271,37.46796", "119.44238,36.68486;119.47902,36.64199"] |
请求体参数(POST)
当使用POST方法时,请求体应为 PolygonSearchRequest 模型的JSON格式。
json
{
"keywords": "检索关键词",
"polygons": "矩形数组,每个元素代表一个矩形"
}请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/place/polygon?key=YOUR_API_KEY&keywords=加油站&polygons=%5B%22122.12482%2C37.4808%3B122.14271%2C37.46796%22%2C%22119.44238%2C36.68486%3B119.47902%2C36.64199%22%5D"POST
shell
curl -X POST 'https://lbs.xiaojukeji.com/api/v2/place/polygon?key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"keywords": "加油站",
"polygons": [
"122.12482,37.4808;122.14271,37.46796",
"119.44238,36.68486;119.47902,36.64199"
]
}'响应
成功响应为 PolygonSearchResponse 模型的JSON格式。
json
{
"status": "状态码,整数",
"msg": "返回消息",
"trace_id": "请求追踪 ID",
"results": [
{
"name": "POI 名称",
"location": {
"lng": "经度,浮点数",
"lat": "纬度,浮点数"
},
"address": "地址",
"province": "省份",
"city": "城市",
"district": "行政区",
"adcode": "行政编码",
"address_all": "完整地址",
"distance": "距离,单位米",
"poi_id": "POI 唯一标识",
"type": "POI 类型编码"
}
]
}响应示例
json
{
"status": 10000,
"msg": "OK",
"trace_id": "ac19743b69b941d0e0f0d213c7f46db0",
"results": [
{
"name": "中国石化加油站(威海石岛第44加油站)",
"location": {
"lng": 122.382574,
"lat": 36.931369
},
"address": "山东省威海市荣成市吴家村",
"province": "山东省",
"city": "威海市",
"district": "荣成市",
"adcode": "371082",
"address_all": "山东省威海市荣成市吴家村中国石化加油站(威海石岛第44加油站)",
"poi_id": "QSUa3erMXAIIjMX8WVOjSnHvvGAZ0F2OxOHOGYj86OU",
"type": "191000"
},
{
"name": "中化石油(长峰加油站)",
"location": {
"lng": 122.147658,
"lat": 37.437659
},
"address": "山东省威海市环翠区青岛中路76号",
"province": "山东省",
"city": "威海市",
"district": "环翠区",
"adcode": "371002",
"address_all": "山东省威海市环翠区青岛中路76号中化石油(长峰加油站)",
"poi_id": "YdJDCdVXivf6QtiLDjZjOqdYVFg7wfpR6TmGcCcBfRU",
"type": "191000"
}
]
}