Map Tile API Developer's Guide

Metainfo with City Center Labels

The user wants to obtain metadata about an image, showing a map tile that includes city center labels in order to make them interactive and, for example, to offer the option to select additional information to be displayed on the map.

Original Map Tile

This request obtains a map tile with the desired city center labels.

https://2.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/5/5/10/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}

The response contains this image:

Figure 1. Map Tile with City Center Labels

This tile contains some city center labels: Calgary, Edmonton, Vancouver. The request below obtains the metadata for each of these labels.

Metainfo Tile Request

In this request, the query parameter metadata specifies that the response is to contain only metadata and the query parameter mgen specifies what metainfo is in the response.

https://2.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/5/5/10/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
&mgen=2

Processing Metainfo Tile Response

The response to the request delivers the following metainfo tile as a JSON object:

{
  "metadata": {
    "street labels":[  ],
    "labels":[ ... ],
    "city center labels":[
      {
        "name": "Calgary",
        "box 2":[ 165.64, 165, 52.36, 16.75 ],
        "box 1":[ 218, 178, 5, 5 ],
        "city center info": {
          "type":"OTHER", 
          "name": "Calgary", 
          "alternative names":[],
          "country code": "CAN",
          "position": {"latitude":51.064453, "longitude":-114.082031}, "population": 1096830 }
       },
      ... ],
    "buildings":[  ],
    "transit stops":[  ],
    "POIs":[  ]
  }
}
Note: Parts of the response are modified as described in the introduction to Examples in order to show only relevant city center data.

This information allows you to locate the city center's icon and label in order to make them interactive. box 1 specifies a bounding box for the icon and box 2 a bounding box for the text label.

The city center icon can be different depending on the particular city type. The information about a city type specified by the type attribute of the city center info JSON object can be:
  • NATIONAL CAPITAL
  • PROVINCIAL CAPITAL
  • OTHER

If the label is localized for several languages as with, for example, the label for Edmonton from the code example above, alternative names in the city center info JSON object specifies the relative information.

Additional information such as country code and population can be displayed, for example in an info bubble.

The position attribute of the city center JSON object specifies the geographical coordinates of a city.