Maps API for JavaScript Developer's Guide

H.service.venues.Service

Class Summary

Implements: H.service.IConfigurable

Extends: H.util.EventTarget

This class encapsulates methods to call Venue Maps API endpoints.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

discover (serviceParams, onResult, onError)

This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response has arrived - providing a H.service.ServiceResult object, or the onError callback to be invoked on a communication error.

createTileLayer (opt_options) : {H.map.layer.TileLayer}

This method creates a tile layer which can be added to the map in order to see the venues. It uses the Interaction Tile endpoint of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html.

getState () : {H.service.venues.Service.State}

This method retrieves the current state of the service.

configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}

This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly.

Events Summary

Table 2. Events
Events

statechange : {H.util.Event}

This event is fired when the service state changes, see H.service.venues.Service#getState. If the state is H.service.venues.Service.State#ERROR, the fired event has an errorCode property.

Class Description

This class encapsulates methods to call Venue Maps API endpoints.

An instance of this class can be retrieved by calling the factory method on a platform instance, H.service.Platform#getVenueService.

Example

// Assumption: the platform is instantiated
var venueService = platform.getVenueService(),
  venueLayer = venueService.createTileLayer();
map.addLayer(venueLayer);

Constructor Details

H.service.venues.Service(opt_options)

Parameters:
 
opt_options:
{H.service.venues.Service.Options=} [optional]
 
An object containing service configuration parameters

Method Details

discover (serviceParams, onResult, onError)

This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response has arrived - providing a H.service.ServiceResult object, or the onError callback to be invoked on a communication error.

Please refer to the Venue Maps API Discovery endpoint http://developer.here.com/rest-apis/documentation/venue-maps/topics/request-constructing-discovery.html for information on available parameters and the response object structure.

Example

  // Assumption: the platform is instantiated
  venueService = platform.getVenueService();
  // Listen for the event when venue service is "ready"
  venueService.addEventListener('statechange', function() {
  if (venueService.getState() === H.service.venues.Service.State['READY']) {
    // Trigger "discovery" request to find out the venues in the specified bounding box
    venueService.discover({
    at: '48.103030448017215,-93.65234375000001,-3.3445330159738336,143.65234375'
    }, function(result) {
    console.log(result);
    }, function (err) {
    console.log(err);
    });
  }
  });
Parameters:
 
serviceParams:
{H.service.ServiceParameters}
 
The service parameters to be sent with the discovery request
onResult:
{function(H.service.ServiceResult)}
 
A function to be called once the Venue Maps API provides a response to the request
onError:
{function(string)}
 
A function to be called if a communication error occurs during the processing of the request, with the error type as an argument

createTileLayer (opt_options) : {H.map.layer.TileLayer}

This method creates a tile layer which can be added to the map in order to see the venues. It uses the Interaction Tile endpoint of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html.

Example

// Assumption: the platform is instantiated
venueService = platform.getVenueService();

// Create tile layer and pass function to style the spaces
customVenueLayer = venueService.createTileLayer({
  onSpaceCreated: function(space) {
  // Note that you can style spaces according to their category, venue category or id

  // Get existing default style of the space and override just the "fillColor" property
  space.setStyle(space.getStyle().getCopy({
    fillColor: 'rgba(100,140,156,0.6)'
  }));
  }
});

// Add layer to the map
map.addLayer(customVenueLayer);
Parameters:
 
opt_options:
{H.service.venues.TileProvider.Options=} [optional]
 
An object containing tile provider options
Returns:
 
{H.map.layer.TileLayer}
An object representing the tile layer

getState () : {H.service.venues.Service.State}

This method retrieves the current state of the service.

Returns:
 
{H.service.venues.Service.State}
a value indicating the state of the service

configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}

This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly.

Example

// assuming that the configurable object exists and the variable name is "configurable"
var platform = new H.service.Platform({
  'app_id': [your app_id],
  'app_code': [your app_code],
})
platform.configure(configurable);
Parameters:
 
appId:
{string}
 
The application ID to identify the client against the platform (mandatory)
appCode:
{string}
 
The application code to identify the client against the platform (mandatory)
useHTTPS:
{boolean}
 
The indicator whether secure communication is used (true), the default is false
useCIT:
{boolean}
 
A value indicating whether Customer Integration Testing ("CIT") is used (true), the default is false
opt_baseUrl:
{H.service.Url=} [optional]
 
The base URL of the platform, the default is http://api.here.com. Note that if the useHTTPS flag is set to true, the URL scheme specified in the opt_baseUrl is overridden to use HTTPS.
Returns:
 
{H.service.IConfigurable}
An instance of IConfigurable reflecting the new configuration

Event Details

statechange: {H.util.Event}

This event is fired when the service state changes, see H.service.venues.Service#getState. If the state is H.service.venues.Service.State#ERROR, the fired event has an errorCode property.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.