Allows you to directly access and obtain grid map tile data through the URL parameter in the HTTP request. You can request independent map tiles to build a map layer, so that the map can be easily loaded to an existing map platform.
You can request independent map tiles to build a map layer, so that the map can be easily loaded to an existing map platform. For example, you can load the tiles to the QGIS or ArcGIS platform on the PC, or to the existing map as tile overlays in mobile apps.
Protocol | HTTPS GET |
|---|---|
Direction | Your server -> Map Kit server |
URL | https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile |
Data Format | Response: Content-Type: image/png |
At least one of Authorization in Request Header and key in Query String need to be set.
Request Header
Parameter | Mandatory | Type | Description |
|---|---|---|---|
Content-Type | Yes | application/json | Request data format. |
Authorization | No | String | Authentication mode. Access token (recommended) authentication and API key authentication are supported. NOTE: For access token authentication:
For API key authentication:
|
Query String
Parameter | Mandatory | Type | Description |
|---|---|---|---|
key | No | String | Authentication key. For details about how to obtain one, please refer to Obtaining the API Key. NOTE:
|
x | Yes | Integer | X coordinate. The value ranges from 0 to 1048576. |
y | Yes | Integer | Y coordinate. The value ranges from 0 to 1048576. |
z | Yes | Integer | Zoom level. The value is no less than 0. |
language | No | String | Map display language. The value is a language code complying with ISO 639-2 or BCP47. BCP47 is recommended. For details about the value range, please refer to Supported Languages. |
scale | No | int | Map scale. The options are 1 and 2. The default value is 1. |
GET https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile?x=5&y=1&z=3&language=en&scale=2&key=API KEY
When the status code is 200:
Response Header
Parameter | Mandatory | Type | Description |
|---|---|---|---|
Content-Type | Yes | image/png | Response data format. |
Response Body
Parameter | Type | Description |
|---|---|---|
Body | String | Byte stream of grid map tiles. |
Access token authentication 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 authentication 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(); }