Maps API for JavaScript Developer's Guide

Listing Categories for a Location

You can use Maps API for JavaScript searches to request lists of categories available at specified locations to allow users to select what they want to search for.

The example below follows the general implementation pattern, with the parameter object containing the location 52.5310,13.3848. The request object is H.places.Categories.

The code submits a request, which is then processed asynchronously.

          // Instantiate the Platform class:
var platform = new H.service.Platform({
  app_id: '{YOUR_APP_ID}',
  app_code: '{YOUR_APP_CODE}'

// Obtain a Categories object through which to submit search requests:
var categories = new H.places.Categories(platform.getPlacesService()),
  categoriesResponse, error;

// Define search parameters:
var params = {
//  Location context that indicates the search is in Berlin
  'at': '52.521,13.3807'
//  Headers object required by the request() method (empty):
  headers = {};

// Run a request for categories, using the parameters, headers, and
// callback functions:
categories.request(params, headers, onResult, onError);

// Success handler - fetch the first set of detailed place data from
// the response:
function onResult(data) {
  categoriesResponse = data;

// Define a callback to handle errors:
function onError(data) {
  error = data;