Map Tile API Developer's Guide

Metadata Generation Parameter

The user wants to obtain metadata information for an image showing a map tile for an area near Chaoyang in Beijing, China in order to know the position of the labels to enable interactivity.

Note: Two possible metainfo requests are shown as examples, using the mgen parameter. For more information about metainfo tile requests, see also Metainfo Tiles.

Original Map Tile

The tile that the user wants to find more information about is obtained by the following request:

https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/14/13492/6204/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}

The response to the request delivers the following image:

Figure 1. Map Tile

Request with Metadata Only

The code block below demonstrates a complete request for a metadata map tile.

https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/14/13492/6204/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
Note: Parts of the response have been modified as described in the introduction to Examples.

Response with Metadata Only

The response to the request delivers the following Meta Info Tile as a JSON object.


      
      {
  "metadata": {
    "street labels": [{
        "name": "北四环",
        "font size": "15",
        "vertices": [{
          "x": 83,
          "y": 12
        }, {
          "x": 118,
          "y": 43
        }]
      },
      ...
    ],
    "labels": [{
        "name": "太阳宫公园",
        "type": "TEXT",
        "bounding boxes": [{
          "left": -17,
          "top": 18,
          "width": 57,
          "height": 11.75
        }]
      },
      ...
    ],
    "city center labels": [{
      "name": "牛王庙村",
      "text box": {
        "left": 119,
        "top": 149,
        "width": 50,
        "height": 13
      },
      "city center info": {
        "type": "OTHER",
        "name": "牛王庙村",
        "alternative names": [
          ["CHI", "牛王庙村"],
          ["ENG", "Niuwangmiao Village"]
        ],
        "country code": "CHN",
        "position": {
          "latitude": 39.966888,
          "longitude": 116.467438
        },
        "population": 0
      }
    }]
  }
}

Request with mgen=2

In this request, the parameter mgen specifies that the response is to use a metadata map tile. This is a text based (JSON) tile with the relevant objects in it, such as street labels, city labels or icons. Each of these objects have certain properties, such as
  • positioning through bounding boxes
  • latitude and longitude
  • road icons with icon information, for example for highway signs
https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/14/13492/6204/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
&mgen=2

Response with mgen=2

The response to the request delivers the following Meta Info Tile as a JSON object:


      
      {
  "metadata": {
    "street labels": [{
        "name": "北四环",
        "font size": "15",
        "vertices": [83.89, 12.84, 118.29, 43.19]
      },
      ...
    ],
    "labels": [{
        "name": "太阳宫公园",
        "type": "TEXT",
        "bounding boxes": [{
          "box 2": [-16.38, 18.10, 57, 11.75]
        }]
      },
      ...
      {
        "name": "S12",
        "type": "ROADSIGN",
        "bounding boxes": [{
          "box 1": [134.69, 99.92, 25, 30]
        }],
        "region": "CHN",
        "category": 0,
        "route name": "S12",
        "route level": 1,
        "uri": "http://image.maps.api.here.com/mia/1.6/roadsign?category=0&region=CHN&label=S12&route_level=1&app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}"
      },
      ...
    ],
    "city center labels": [{
      "name": "牛王庙村",
      "box 1": [119, 149.55, 50, 13],
      "city center info": {
        "type": "OTHER",
        "name": "牛王庙村",
        "alternative names": [
          ["CHI", "牛王庙村"],
          ["ENG", "Niuwangmiao Village"]
        ],
        "country code": "CHN",
        "position": {
          "latitude": 39.966888,
          "longitude": 116.467438
        },
        "population": 0
      }
    }],
    "buildings": [],
    "transit stops": [],
    "POIs": []
  }
}
Note: Parts of the response are modified as described in the introduction to Examples.