Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: PlacesService

Table of Contents

Class: PlacesService

H.service.PlacesService

new H.service.PlacesService (opt_options) Deprecated : since 3.1.14.0

This service is no longer being actively developed. The H.service.SearchService could be used instead.

This service implements a low-level Places REST API access. Please refer to Restful API documentation for providing parameters and handling response objects.

Entry point parameters are specified as key:value pairs which are transformed into URL parameters. Request headers can be specified along with entry point parameters.

It's not allowed to call the constructor directly (an IllegalOperationError is thrown). Instead an instance of this Service can be retrieved by calling the factory method H.service.Platform#getPlacesService on a platform instance.

Name Type Description
opt_options H.service.Options optional

Configuration options for places service

Throws:
Example
// Assumption: platform is instantiated
platform.getPlacesService().search({
  'at': '52.5044,13.3909',
  'q': 'pizza',
  'Accept-Language': 'de'
}, console.log, console.error);

Extends

Members

H.service.PlacesService.CONFIG_KEY string staticconstant

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

H.service.PlacesService.EntryPoint string static

This object contains a list of available entry points.

Properties:

Methods

addEventListener (type, handler, opt_capture, opt_scope) inherited

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

addOnDisposeCallback (callback, opt_scope) inherited

This method adds a callback which is triggered when the EventTarget object is being disposed.

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

around (aroundParams, onResult, onError)H.util.ICancelable

This method triggers the Places API 'around' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle

categories (categoriesParams, onResult, onError)H.util.ICancelable

This method triggers the Places API 'categories' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

explore (exploreParams, onResult, onError)H.util.ICancelable

This method triggers the Places API 'explore' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle

follow (hyperlink, onResult, onError, opt_additionalParameters)H.util.ICancelable

This method is used to follow hyperlinks in the results returned by discovery queries.

Returns:
Type Description
H.util.ICancelable A request handle
Example
// Assumption: the platform is instantiated
var places = platform.getPlacesService();
places.request(
  H.service.PlacesService.EntryPoint.SEARCH,
  {
    'at': '52.5044,13.3909',
    'q': 'pizza'
  }, (response) => {
    places.follow(response.results.items[0].href, console.log, console.error);
  }, console.error);

This method returns the configured service URL.

Returns:
Type Description
H.service.Url

here (hereParams, onResult, onError)H.util.ICancelable

This method triggers the Places API 'here' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle

removeEventListener (type, handler, opt_capture, opt_scope) inherited

This method removes a previously added listener from the EventTarget instance.

request (entryPoint, entryPointParams, onResult, onError)H.util.ICancelable

This method implements a generic means of querying the Places REST API.

Returns:
Type Description
H.util.ICancelable A request handle
Example
// Assumption: the platform is instantiated
platform.getPlacesService().request(
  H.service.PlacesService.EntryPoint.SEARCH,
  {'at': '52.5044,13.3909', 'q': 'pizza'},
  console.log,
  console.error);

This method triggers the Places API 'search' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle

suggest (suggestParams, onResult, onError)H.util.ICancelable

This method triggers the Places API 'suggestions' entry point. Please refer to documentation for parameter specification and response handling.

Returns:
Type Description
H.util.ICancelable A request handle
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert