| 参数名称 | 是否必填 | 默认值 | 格式举例 | 说明 |
|---|---|---|---|---|
| params | 是 | json | json结构体示例(见下表) | |
| ak | 是 | String | 用户key | |
| callback | 否 | String | 回调函数 |
| 名称 | 描述 | 是否必需 | 格式 |
|---|---|---|---|
| keyword | 查询关键字,可以是行政区名称,或者行政区编码。如果该参数传入空串,又没有其它有意义的参数,则返回“省级行政区列表” | Y | string |
| subdistrict |
返回下级行政区的级数,0:不返回下级行政区,
1:返回下一级行政区,2:返回下两级行政区,
3:返回下三级行政区,不传入该参数则默认取值为0
|
N | int |
| filter_adcode | 按照指定行政区编码adcode的范围进行过滤,传入0表示不过滤, 如果传入有效行政区编码但keyword参数为空,则返回filter_adcode 对应的行政区信息 | N | int |
| return_polygon | 是否需要返回行政区边界多边形(只返回当前查询district的边界,不返回子节点的边界),不传入该参数则认为取值0,不返回多边形坐标 | N | int |
| adcode_type | 是否使用国标行政区编码,0-使用Careland编码,1-使用国标编码 | N | int |
| xytype | 坐标类型: 0:为凯立德坐标系(默认) 2:为国家加密坐标系 | N | int |
| 名称 | 描述 | 格式 | ||||
|---|---|---|---|---|---|---|
| results | ... | DistrictItem结构 | DistrictItem数组 | |||
| DistrictItem结构 | ||||||
| ... | ||||||
| errorCode | 错误编码 | int | ||||
| errorMessage | 错误消息 | string | ||||
| 名称 | 描述 | 格式 | ||
|---|---|---|---|---|
| adcode | 区域编码 | int | ||
| name | 行政区名称 | string | ||
| level | 行政区级别,1-省,2-市,3-区县,4-乡镇 | int | ||
| parent_code | 上级行政区编码 | int | ||
| x | 政府所在地坐标x | float | ||
| y | 政府所在地坐标y | float | ||
| coords | 范围多边形坐标,仅查询结果的第一级有该信息 | 坐标数组 数组:[[x,y],[x,y]] | ||
| ... | 坐标x | |||
| 坐标y | ||||
| districts | ... | 下级行政区列表 | DistrictItem数组 | |
({
"errorMessage": "ok",
"results": [{
"coords": [
[410293955, 82503720],
[410294340, 82501639],
...
[410292662, 82504008],
[410293955, 82503720]
],
"level": 2,
"name": "深圳市",
"districts": [{
"level": 3,
"name": "罗湖区",
"adcode": 440303,
"y": 81409529,
"x": 411207221,
"parent_code": 440300
}, {
"level": 3,
"name": "福田区",
"adcode": 440304,
"y": 81319824,
"x": 410931299,
"parent_code": 440300
},
…
{
"level": 3,
"name": "坪山区",
"adcode": 440310,
"y": 81989554,
"x": 411996672,
"parent_code": 440300
}, {
"level": 3,
"name": "光明区",
"adcode": 440311,
"y": 82132168,
"x": 410502942,
"parent_code": 440300
}],
"adcode": 440300,
"y": 81392087,
"x": 410942614,
"parent_code": 440000
}],
"errorCode": 0
});
| 功能 | URL样例 | 备注 | ||
|---|---|---|---|---|
| 1-查询广东省的下一级行政区信息 | https://api.careland.com.cn/api/v2/search/district?params={"keyword":"广东省","adcode_type":1,"return_polygon":0,"filter_adcode":0, "subdistrict":1,"xytype":0}&ak=<您的密钥> | |||
| 2-查询深圳市的国标编码 | https://api.careland.com.cn/api/v2/search/district?params={"keyword":"深圳市","adcode_type":1,"return_polygon":0,"filter_adcode":0, "subdistrict":0,"xytype":0}&ak=<您的密钥> | |||
| 3-查询440303的行政区名称和范围多边形坐标 | https://api.careland.com.cn/api/v2/search/district?params={"keyword":"440303","adcode_type":0,"return_polygon":1,"filter_adcode":0, "subdistrict":0,"xytype":0}&ak=<您的密钥> | |||