| 承载协议 | HTTPS GET |
|---|---|
| 接口方向 | 开发者服务器 -> 华为地图服务器 |
| 接口URL | https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile |
| 数据格式 | 响应消息:Content-Type: image/png 说明: mapType属性传入SATELLITE时返回图片格式为image/webp。 |
Request Header中的 Authorization 和Query String中的 key 至少需要存在一个。
Request Header
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| Content-Type | 是 | application/json | 请求消息的数据格式。 |
| Authorization | 否 | String | AT或者API Key,推荐用AT。 说明: |
Query String
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| key | 否 | String | 鉴权密钥,申请参见获取API密钥。 说明:
|
| x | 是 | Integer | X轴坐标。取值范围:[0, 1048576]。 |
| y | 是 | Integer | Y轴坐标。取值范围:[0, 1048576]。 |
| z | 是 | Integer | 缩放级别。取值范围:大于等于0。 |
| language | 否 | String | 图片显示语种,语言编码支持ISO 639-2 Code和BCP47。推荐使用BCP47,取值范围参见支持的语言。 |
| scale | 否 | int | 清晰度比较尺,图片缩放比例。默认为1,可用值为1和2。 |
| mapType | 否 | String | 地图类型。默认值为ROADMAP。
|
GET https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile?x=5&y=1&z=3&language=en&scale=2&key=API KEY
状态码为200时:
Response Header
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| Content-Type | 是 | image/png | 响应消息的数据格式。 |
Response Body
| 参数 | 参数类型 | 描述 |
|---|---|---|
| Body | String | 返回栅格瓦片字节流。 |
“AT认证” public class GetTileService { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile?x=5&y=1&z=3&language=en&scale=2") .addHeader("Authorization", "Bearer " + AT) .get() .build(); Response response = client.newCall(request).execute(); }
“API KEY认证” public class GetTileService { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile?x=5&y=1&z=3&language=en&scale=2&key=xxxx") .get() .build(); Response response = client.newCall(request).execute(); }