Map Tile API Developer's Guide

Metainfo with POIs

The user wants to make POIs on the map interactive; for example, by offering several options to have the map display additional information. This requires obtaining metadata information about an image showing a map tile that includes POIs.

Original Map Tile

This request obtains a map tile with a POI:

https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/16/53957/24812/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&pois

The response contains a POI - 3D Art Museum in Beijing:

Figure 1. Map Tile with POI

The following request obtains more information about this map tile:

Metainfo Tile Request

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/16/53957/24812/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&metadata=metaonly
&mgen=2
&pois

Processing Metainfo Tile Response

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.


  display([{
  "metadata": {
    "street labels": [...],
    "labels": [...],
    "city center labels": [],
    "buildings": [...],
    "transit stops": [],
    "POIs": [{
        "name": "3D美术馆 /\n知青博物馆",
        "geoposition": {
          "latitude": 39.990921,
          "longitude": 116.397786
        },
        "bounding boxes": [{
          "box 1": [139.50, 178.10, 13, 13]
        }, {
          "box 2": [119.76, 156.10, 52.48, 20.50]
        }],
        "info": [{
          "PLACE NAME": "3D美术馆",
          "PLACE PHONE NUMBER": "+(86)-1084371573",
          "PLACE CATEGORY": "Art Museum",
          "PLACE ID": "397686447"
        }]
      },
      ...,
    ]
  }
}]);

This information allows you to locate the icon and label of a POI in order to make them interactive. For this, you can use elements of the bounding boxes array: box 1 describes a bounding box for the icon, box 2 describes a bounding box for the text label.

The geoposition object of the metainfo JSON object provides the geocoordinates of the POI. These can be used to obtain the address of POI, for example for Reverse Geocoding:
http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.xml
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&gen=7
&prox=39.992505746685424, 116.39633674480126,100
&mode=retrieveAddresses
<Address>
<Label>中国北京</Label>
<Country>CHN</Country>
<City>北京</City>
<AdditionalData key="CountryName">中国</AdditionalData>
</Address>
It is possible to display additional information related to POIs (for example, by means of an info bubble). This information is provided by the info JSON object:
  • name (PLACE NAME attribute)
  • category (PLACE CATEGORY attribute)
  • phone number (PLACE PHONE NUMBER attribute)
  • place id (PLACE ID attribute)