Map Tile API Developer's Guide

Metainfo Tiles with Road Signs

This article shows example usage of matainfo tile for displaying and interaction with road signs.

User story

In order to make road signs on the map interactive (display additional info upon selection, etc.) user obtains metadata information about an image, showing a map tile that includes road sign.

Original map tile

Given the following request:

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/13/4410/2694/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 with road sign

This tile contains road sign for route A12 in Germany. When the user wants to find out more information they can use the following request:

Metainfo Tile Request

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

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/13/4410/2694/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 (response is suppressed to show only relevant road signs data):

{
  "metadata": {
    "street labels": [],
    "labels": [
      {
        "name": "12",
        "type": "ROADSIGN",
        "bounding boxes": [ { "box 1":[ 41.62, 71.52, 24, 18 ] } ],
        "region": "DEU",
        "category": 0,
        "route name": "A12",
        "route level": 2,
        "uri": "http://image.maps.api.here.com/mia/1.6/roadsign?category=0&region=DEU&label=A12&route_level=2&app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}"
      }
    ],
    "city center labels":[],
    "buildings": [],
    "transit stops": [],
    "POIs": []
  }
}

This information allows to locate road sign in order to make it interactive.

Road sign labels belong to "labels" array of metadata JSON object and have a "type" equals "ROADSINGN". Metainfo provides "icon box" array for road signs in the following format: [x, y, width, height], representing road sign's bounding box.

There is also some additional information for road signs provided:

  • country region
  • road sign category
  • route name
  • route level

You can also retrieve road sign icon using "url" attribute of a label, e.g.:

http://image.maps.api.here.com/mia/1.6/roadsign
?category=0
&region=DEU
&label=A12
&route_level=2
&app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
Figure 2. Road sign icon

Filter Only Metainfo for Road Signs

There is also an option to filter only mateinfo for road sign labels (exclude all other kinds of labels from JSON response). E.g. for tile that contains a lot of different labels:

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/11/1102/673/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
Figure 3. Tile with several labels

Metainfo tile will contain a lot of city center labels. Using additional request parameter "filter=1" one can request only roadsign labels for current tile:

https://2.base.maps.cit.api.here.com
/maptile/2.1/maptile/newest/normal.day/11/1102/673/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
&mgen=2
&filter=1
{
  "metadata": {
    "labels": [
      {
        "name": "12",
        "type":"ROADSIGN",
        "bounding boxes": [ { "box 1":[ 46.38, 110.68, 22, 16 ] } ],
        "region": "DEU",
        "category": 0,
        "route name": "A12",
        "route level": 2,
        "uri": "http://image.maps.api.here.com/mia/1.6/roadsign?category=0&region=DEU&label=A12&route_level=2&app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}"
      },
      {
        "name": "10",
        "type":"ROADSIGN",
        "bounding boxes": [ { "box 1":[ 7, 115.18, 22, 16 ] } ],
        "region": "DEU",
        "category": 0,
        "route name": "A10",
        "route level": 2,
        "uri": "http://image.maps.api.here.com/mia/1.6/roadsign?category=0&region=DEU&label=A10&route_level=2&app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}"
      }
    ]
  }
}