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: Route

Table of Contents

Class: Route

H.venues.Route

new H.venues.Route (routeData, opt_styleCallback) Deprecated : since 3.1.30.15

This class encapsulates all H.map.Group, H.map.Marker and H.map.Polyline objects representing given route data. The example shows usage of style callback in order to to apply styles to markers and lines objects created for the given route.

Name Type Description
routeData Object

The route from the service response.

opt_styleCallback function | undefined

The callback that can be used to style route segments. It accepts 3 parameters:

     - {number} index The index of the current route section
     - {array} sections All route sections
     - {H.venues.Route.ObjectType} objectType Segment object type
 Based on the given input, the callback should return style (H.map.Icon or H.map.SpatialStyle) or undefined.
 If it returns undefined then map object won't be created (allows to skip start/finish markers, for example).
 
Example
// Create route objects using route response data
const route = new H.venues.Route(result.routes[0]);

// Link route map objects with venue levels for automatic visibility updates:
const indoorObjects = route.getIndoorObjects();
for (let venueId in indoorObjects) {
  for (let levelIndex in indoorObjects[venueId]) {
    const venue = venuesProvider.getVenue(venueId);
    const objectGroup = indoorObjects[venueId][levelIndex];
    map.addObject(objectGroup);
    venue.setMapObjects(objectGroup.getObjects(), levelIndex);
  }
}

// Get H.map.Group that contains map objects representing outdoor segments:
const outdoorObjects = route.getOutdoorObjects();
map.addObject(outdoorObjects);

Members

H.venues.Route.ObjectType number staticconstant

This object defines types used when creating a route object using H.venues.Route

Properties:

Methods

getIndoorObjects ()Object

Get indoor objects for calculated route representing indoor segments. Objects are grouped by venue ID and level index:

 {
   25556: {0: H.map.Group, 1: H.map.Group, ...},
   25557: {0: H.map.Group, 1: H.map.Group, 2: H.map.Group, ...},
 }
Returns:
Type Description
Object Map objects grouped by venue and level

getOutdoorObjects ()H.map.Group

Get outdoor objects for calculated route

Returns:
Type Description
H.map.Group Outdoor objects representing the route
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert