Map Tile API Developer's Guide

POI Map Filtered for a Specific Category

The user wants to see a certain location in the center of Beijing showing the Forbidden City.

This request obtains a tile with the desired POI:

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

The response image shows the Forbidden City without a POI icon:

Figure 1. Center of Beijing in the location of the Forbidden City

In order to obtain the category of this site, the metadata parameter specifies a request for a metadata response.

https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/19/431659/198648/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&pois
&mgen=2
&metadata=metaonly

The result of the previous requests is a JSON object containing the information of the POIs of the tile.


    {
  "metadata": {
    "street labels": [],
    "labels": [{
      "name": "午门",
      "type": "TEXT",
      "bounding boxes": [{
        "box 2": [195, 3.12, 26, 13]
      }]
    }],
    "city center labels": [],
    "buildings": [{
        "id": "1568999455028946039",
        "vertices": [62, 33.91, 59.69, 0, 256, 0, 256, 82.12, 178, 82.12, 58, 87.34],
        "polygons": [
          [0, 1, 2, 3, 4, 5]
        ],
        "outlines": [
          [0, 1],
          [3, 4, 5, 0]
        ]
      },
      {
        "id": "1568999455028946737",
        "vertices": [29.18, 0, 31.58, 256, 0, 256, 0, 0],
        "polygons": [
          [0, 1, 2, 3]
        ],
        "outlines": [
          [0, 1]
        ]
      }
    ],
    "transit stops": [],
    "POIs": [{
        "name": "故宫博物院南门",
        "geoposition": {
          "latitude": 39.913502,
          "longitude": 116.397271
        },
        "bounding boxes": [{
          "box 1": [201, 210.72, 14, 14]
        }, {
          "box 2": [172, 198.72, 72, 10.50]
        }],
        "info": [{
          "PLACE NAME": "故宫博物院南门",
          "PLACE PHONE NUMBER": "+(86)-1065131892",
          "PLACE CATEGORY": "Tourist Attraction",
          "PLACE ID": "134796334"
        }]
      },
      {
        "name": "午门 /\n右掖门 /\n左掖门",
        "geoposition": {
          "latitude": 39.913588,
          "longitude": 116.397271
        },
        "bounding boxes": [{
          "box 1": [201, 169, 14, 14]
        }, {
          "box 2": [187.86, 137, 40.28, 30.50]
        }],
        "info": [{
          "PLACE NAME": "午门",
          "PLACE PHONE NUMBER": "+(86)-1085007519",
          "PLACE CATEGORY": "Tourist Attraction",
          "PLACE ID": "58741445"
        }]
      }
    ]
  }
}

The response provides the information that the Forbidden City has the category Tourist Attraction. According to the /meta/pois resource, pois specifies the hexadecimal bitmask that creates the filter.

Request

In this request pois specifies how to filter for the desired POI category:

https://2.base.maps.hereapi.cn/maptile/2.1/maptile/newest/normal.day/19/431659/198648/256/png8
  ?app_id={YOUR_APP_ID}
  &app_code={YOUR_APP_CODE}
  &pois=000000004

Response

This request results in the following image that contains the POI icon for the Forbidden City.

Figure 2. Center of Beijing showing the filtered POI Category