Maps API for JavaScript

Maps API for JavaScript
Developer's Guide
Version 3.0.10.0
Maps API for JavaScript Developer's Guide
► Contents
2
Contents
Legal Notices..........................................................................................................................................................4
Document Information.................................................................................................................................... 5
Chapter 1: Overview................................................................................................................................. 6
What is the Maps API for JavaScript?........................................................................................................7
Why use the Maps API for JavaScript?...................................................................................................... 7
Browser Support............................................................................................................................................. 8
HERE Maps API for JavaScript Modules.....................................................................................................8
Chapter 2: Quick Start........................................................................................................................ 10
Use Case......................................................................................................................................................... 11
Loading the API Code Libraries.................................................................................................................11
Initialize Communication with Back-end Services................................................................................ 12
Initialize the Map.......................................................................................................................................... 12
Complete HTML Example Page................................................................................................................. 13
Chapter 3: Guide....................................................................................................................................... 15
Acquiring Credentials...................................................................................................................................16
API versions................................................................................................................................................... 16
Map Types...................................................................................................................................................... 17
Map Events..................................................................................................................................................... 23
Map Objects................................................................................................................................................... 26
Marker Objects................................................................................................................................. 28
Geo Shapes........................................................................................................................................34
StreetLevel..................................................................................................................................................... 40
Map Controls and UI.................................................................................................................................... 44
Geocoding...................................................................................................................................................... 51
Routing............................................................................................................................................................ 58
Maps API for JavaScript Developer's Guide
► Contents
3
Traffic.............................................................................................................................................................. 65
Clustering....................................................................................................................................................... 68
Metainfo.......................................................................................................................................................... 74
Venues............................................................................................................................................................. 76
KML Support.................................................................................................................................................. 83
Best Practices................................................................................................................................................85
Service Support............................................................................................................................................ 89
Chapter 4: API reference.................................................................................................................. 90
H........................................................................................................................................................................91
Map...................................................................................................................................................... 91
clustering......................................................................................................................................... 111
data................................................................................................................................................... 131
geo.....................................................................................................................................................151
lang.................................................................................................................................................... 187
map................................................................................................................................................... 190
mapevents....................................................................................................................................... 517
math.................................................................................................................................................. 538
places................................................................................................................................................ 550
service.............................................................................................................................................. 565
ui........................................................................................................................................................ 657
util...................................................................................................................................................... 803
Maps API for JavaScript Developer's Guide
► Legal Notices
4
Legal Notices
© 2015 HERE. All rights reserved.
This material, including documentation and any related computer programs, is protected by
copyright controlled by HERE. All rights are reserved. Copying, including reproducing, storing,
adapting or translating, any or all of this material requires the prior written consent of HERE. This
material also contains confidential information, which may not be disclosed to others without the
prior written consent of HERE.
Trademark Acknowledgements
HERE and Nokia are trademarks or registered trademarks of Nokia Corporation in the United States
and other countries.
Other trade names are trademarks or registered trademarks of their owners.
Disclaimer
This content is provided "as-is" and without warranties of any kind, either express or implied,
including, but not limited to, the implied warranties of merchantability, fitness for a particular
purpose, satisfactory quality and non-infringement. Nokia does not warrant that the content is error
free and Nokia does not warrant or make any representations regarding the quality, correctness,
accuracy, or reliability of the content. You should therefore verify any information contained in the
content before acting on it.
To the furthest extent permitted by law, under no circumstances, including without limitation Nokia's
negligence, shall Nokia be liable for any damages, including, without limitation, direct, special,
indirect, punitive, consequential, exemplary and/ or incidental damages that result from the use or
application of this content, even if Nokia or an authorized representative has been advised of the
possibility of such damages.
Maps API for JavaScript Developer's Guide
► Document Information
Document Information
Product
Name:
Maps API for JavaScript
Version:
Version 3.0.10.0
Document
Name:
Maps API for JavaScript Developer's Guide
Id:
ac4c0b3-1426837230
Status:
FINAL
Date:
2015-Mar-20, 7:42 (GMT)
5
Maps API for JavaScript Developer's Guide
► Overview
6
Chapter
1
Overview
Topics:
This documentation introduces the HERE Maps API for JavaScript,
offers a quick start guide, followed by a developer's guide with
•
What is the Maps API for
JavaScript?
•
Why use the Maps API for
JavaScript?
•
Browser Support
The overview (this chapter):
•
HERE Maps API for JavaScript
Modules
•
•
•
articles showing the implementation of typical use cases, and ends
with a detailed API reference.
defines the API
outlines the key benefits of the API for developers
explains the modular organization of the API
Maps API for JavaScript Developer's Guide
► Overview
7
What is the Maps API for JavaScript?
The HERE Maps API for JavaScript (also referred to as the Maps API in the following text) is a set
of programming interfaces that enable developers to build Web applications with feature rich,
interactive HERE Maps at their center. The API consists of libraries of classes and methods with
which to implement the functionality of an interactive application.
Why use the Maps API for JavaScript?
The Maps API for JavaScript offers the following high level features and benefits to developers of
Web applications with maps as a core element:
Table 1: Main features of the HERE Maps API for JavaScript
Feature
Description
Efficient map rendering The API is built for HTML5-capable environments to maximize map and map object rendering
efficiency on mobile devices and desktops. It also includes support for high-DPI devices to show the
best maps wherever possible.
HERE Maps map data
The API provides full access to world-leading map data and map images, with a choice of view
modes and customization options, including three main map types: map, terrain and hybrid.
Geocoding
The API provides full access to geocoding and reverse geocoding services.
Routing
The API supports route calculation and display, with a variety of customization options such as
public transport routing and others.
Enterprise routing
The API supports advanced enterprise routing use cases such as isoline routing or truck routing.
Custom map objects
The API supports the creation of both interactive and non-interactive map objects:
•
markers with SVG, HTML or bitmap images
•
geo shapes, including polygons, polylines, circles and rectangles
Mouse and touch
The API (via an events extension) supports mouse and touch interaction with the map, including
interaction
pan, zoom and pinch-to-zoom on a broad range of devices.
Pre-built UI controls
The API offers pre-built, customizable UI controls that allow users to change the base map, zoom in
and out smoothly, and display the current map scale. In addition, info bubbles with arbitrary HTML
content and SVG images can be placed on the map.
Integrated HERE
Thorough integration with HERE StreetLevel imagery, the API offers access to interactive 360°
StreetLevel
panoramas in covered areas.
Maps API for JavaScript Developer's Guide
► Overview
8
Browser Support
The Maps API is built specifically for modern browsers that support HTML5 on desktop as well as
mobile environments. Although it is optimized for certain browsers and environments, we do our
utmost to ensure the API can be used on a wide variety of platforms and browsers.
Below is a list showing support (with and without optimizations) in the Maps API for different
browsers and environments:
Table 2: Browser support in HERE Maps API for JavaScript
Support Level
Browser
Environment
Supported with optimizations:
Internet Explorer 10+
desktop, Windows Phone 8+
Firefox (latest)
desktop
Google Chrome (latest)
desktop, Android 4.4+ on mobile/tablet
Apple Safari 6+
desktop, iOS 6+ on mobile/tablet
Internet Explorer 9
desktop
Android default browser / WebView
Android 2.2+ on mobile/tablet [1]
iOS WebView
iOS 6+
Supported without optimizations:
Not supported:
Opera
Internet Explorer <= 8
[1] Support does not extend to all multi-touch gestures as Android 2.x does not expose multitouch events
HERE Maps API for JavaScript Modules
The Maps API for JavaScript is organized into a number of modules. Developers can therefore use the
API efficiently by selecting only the modules which their applications require.
The table below outlines the selectable modules of the Maps API for JavaScript.
Maps API for JavaScript Developer's Guide
► Overview
9
Table 3: Modules of the HEREMaps API for JavaScript
Module name
Module
Description
dependencies
core (mapsjs-core.js)
none
This module contains the core functionality for rendering maps, map
layers and map objects as well as utilities used in other modules. This
module forms the core of the API and is a dependency of all other
modules.
service (mapsjs-
core
This module supports map tile retrieval, routing, geocoding, etc.
core
This module provides functionality to enable user-interaction with the
service.js)
mapevents (mapsjs-
map, including map panning and pinch-to-zoom. The module normalizes
mapevents.js)
various browser event systems (mouse events, touch events, pointer
events) to offer unified events that can be used across desktop and
mobile environments.
ui (mapsjs-ui.js +
core
This module provides a set of pre-built cross-browser UI components
(such as base map settings, zoom control, map scale) that can be added
mapsjs-ui.css)
to the map. It also provides functionality to display location-specific info
bubbles with arbitrary HTML content on the map.
core
This module provides functionality for marker clustering.
data (mapsjs-data.js)
core
This module provides set of classes for display of KML and GeoJSON data.
places (mapsjs-
core, service
This module simplifies the use of REST places API.
core, service
This module provides access to HERE StreetLevel imagery on WebGL-
clustering (mapsjsclustering.js)
places.js)
pano (mapsjs-pano.js)
enabled devices. It supports switching the map to the StreetLevel
rendering mode and navigation through StreetLevel panoramas.
Maps API for JavaScript Developer's Guide
► Quick Start
Chapter
2
Quick Start
Topics:
•
Use Case
•
Loading the API Code Libraries
•
Initialize Communication with Backend Services
•
Initialize the Map
•
Complete HTML Example Page
This article shows the implementation of a basic use case to
demonstrate how to start using the Maps API for JavaScript.
10
Maps API for JavaScript Developer's Guide
► Quick Start
11
Use Case
The use case is to create an application that displays a default map, which is non-interactive.
Its implementation uses JavaScript code to display the map in an HTML page and consists of the
following steps:
1.
Load the Maps API code libraries.
2.
Initialize communication with HERE back-end services (to request map image tiles).
3.
Initialize a map object, displaying the map.
Below, we explain these steps in detail.
Loading the API Code Libraries
The first step for any application based on the HERE Maps API for JavaScript is to load the necessary
code libraries or modules. The implementation of our basic use case requires two modules: core and
service (see also HERE Maps API for JavaScript Modules on page 8).
To load the modules, add the following <script> elements to the <head> of the HTML document:
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
The URL in the "src" attribute contains a version number that reflects the latest major release of
the API. Note that this version number changes with each new release, which may break backwardscompatibility – for more information, see API versions on page 16.
To ensure optimum performance on mobile devices, add the following meta-tag to the <head>
section of the HTML page:
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
Here is the complete <head> element that loads the core and service modules and ensures
optimum performance on mobile devices.
<!DOCTYPE html>
<html>
<head>
...
<meta name="viewport" content="initial-scale=1.0,
width=device-width" />
Maps API for JavaScript Developer's Guide
► Quick Start
12
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
...
</head>
Initialize Communication with Back-end Services
An essential part of creating a working application with the HERE Maps API for JavaScript is to
establish communication with the back-end services provided by HERE REST APIs. In our scenario, the
back-end services process requests for map images and deliver them to the application for display.
To make this possible, initialize a Platform object with the app_id and app_code you received on
registration (please see Acquiring Credentials on page 16 ):
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
It is important to initialize a Platform object not only to effect authentication and authorization,
but also to use the Customer Integration Testing instance of the HERE Platform and/or to use secure
HTTP (HTTPS) when communicating with the back end. Furthermore, the object provides methods
that allow for easy creation of fully working service stubs, such as map tile service stubs, routing
service stubs, etc.
Initialize the Map
The application in our scenario is to display a non-interactive map centered on a predefined location
at a fixed zoom level. To implement this:
1.
Create an HTML container element in which the map can be rendered (for example, a div).
2.
Instantiate an H.Map object, specifying:
•
•
•
•
the map container element
the map type to use
the zoom level at which to display the map
the geographic coordinates of the point on which to center the map
Maps API for JavaScript Developer's Guide
► Quick Start
13
The implemenation JavaScript code shown below sets up a Map object, specifying the normal map
type, zoom level 10, and the map center as a location near Berlin, Germany, given by latitude 52.5
and longitude 13.4:
// Obtain the default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate (and display) a map object:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.5, lng: 13.4 }
});
The implementation displays the following map image:
Figure 1: A basic non-interactive map
The next section shows the solution, including the complete HTML code of the page.
Complete HTML Example Page
Below you can find the complete source code that implements the basic scenario:
<html>
<head>
Maps API for JavaScript Developer's Guide
► Quick Start
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div style="width: 640px; height: 480px" id="mapContainer"></div>
<script>
// Initialize the platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Obtain the default map types from the platform object
var maptypes = platform.createDefaultLayers();
// Instantiate (and display) a map object:
var map = new H.Map(
document.getElementById('mapContainer'),
maptypes.normal.map,
{
zoom: 10,
center: { lng: 13.4, lat: 52.51 }
});
</script>
</body>
</html>
14
Maps API for JavaScript Developer's Guide
► Guide
15
Chapter
3
Guide
Topics:
The Maps API for JavaScript has been designed to meet the
challenges of modern Web application development. The articles
•
Acquiring Credentials
•
API versions
•
Map Types
•
Map Events
•
Map Objects
•
StreetLevel
•
Map Controls and UI
Note:
•
Geocoding
•
Routing
The code examples use demo authorization and
•
Traffic
•
Clustering
•
Metainfo
•
Venues
authentication credentials. These are acceptable for testing
purposes, but must be replaced with application-specific
credentials in real life applications (please see also Acquiring
Credentials on page 16).
•
KML Support
•
Note:
Best Practices
•
Service Support
that follow describe various aspects of the API, including a number
of state-of-the-art development patterns it supports.
The text is illustrated with examples of real code and with images
to show the effects of executing the code.
To communicate with the HERE back-end services (REST
APIs), the examples are configured to use the Customer
Integration Testing (CIT) environment.
Maps API for JavaScript Developer's Guide
► Guide
16
Acquiring Credentials
All users of HERE APIs must obtain authentication and authorization credentials and provide them as
values for the parameters app_id and app_code. The credentials are assigned per application.
To obtain the credentials for an application, please visit http://developer.here.com/get-started for
more details.
API versions
Version numbers
Version 3 of the HERE Maps API for JavaScript introduces a new way we release the API and a new
versioning scheme. Developers using version 2 of the Maps API will remember that each deployment
to the CDN was accompanied by a new version number and a new directory within the CDN structure.
This, in turn, meant that after each bug-fix release, we needed to ask all customers to switch to the
latest version. The new scheme makes this unnecessary.
The new version scheme uses a four-digit version number, where:
•
•
The first digit is the product version (i.e. 3) – remains unchanged over the lifespan of the Maps API
for JavaScript v3
The subsequent three digits represent (in this order):
◦
◦
◦
major version – changes when the functionality of the API is changed in non-backwards
compatible way
minor version – is incremented with each release that adds features in a backwardscompatible manner
patch version – is incremented with each fully backwards-compatible bug-fix release
Thus, for example, a complete version string of "3.0.1.2", means that the product version is "3", the
major version is "0", the minor version "1", and finally the patch version is "2". A version string like
this, indicates a bug fix release, with no new features.
Versions on the CDN
Although the download path includes the version number, we want to ensure that developers using
the API receive backwards-compatible changes as soon as possible, without the need to switch to
a new URL. For this reason, the version number in the download path is restricted to the product
version and major version only.
Maps API for JavaScript Developer's Guide
► Guide
17
Below you can see an example of the Maps API download path:
http://js.api.here.com/v3/3.0/mapsjs-core.js
The version number string in this download path is "3.0" (the product version is "3", the major
version "0"). It will change only when a release breaks backwards-compatibility with version 3.0. Until
then, bug fixes and feature additions will continue to be delivered under the same download URL.
Map Types
The underlying service to the HERE Maps API for JavaScript is the HERE Map Tile API, which provides
map images in a large choice of styles. In this respect, the Maps API for JavaScript acts as a flexible
access facilitator, giving you, as a developer, not only a means to retrieve the basic map tile sets, but
also the full selection of all the possible map styles provided by the HERE Map Tile API.
Basic map types
To set the map style for a map easily, you can use the method createDefaultLayers() defined
on the Platform class. The method returns an object that holds three different map types (normal,
satellite and terrain), each containing a set of named layers (map, base, xbase, traffic, panorama,
labels). The named layers represent different styles of the map type and can be directly assigned as
base layers to the map.
The table below shows a list of the default map layers for each map type:
Table 4: Default map types provided by the HEREMaps API for JavaScript
Layer
map
<---------------------------------------------- Map Type ---------------------------------------------->
normal
satellite
terrain
Maps API for JavaScript Developer's Guide
► Guide
Layer
<---------------------------------------------- Map Type ---------------------------------------------->
normal
satellite
terrain
traffic
panorama
N/A
transit
xbase
18
N/A
Maps API for JavaScript Developer's Guide
► Guide
Layer
19
<---------------------------------------------- Map Type ---------------------------------------------->
normal
satellite
terrain
base
labels
Additionally the default map types object holds venues and traffic incidents overlays shown below
Table 5: Additional overlays provided by the HEREMaps API for JavaScript
incidents
venues
A map type layer can be referenced, using the standard JavaScript dot notation.
For example, to indicate a transit map (layer) on a terrain map (type), you can write
layers.terrain.transit, where layers is the name of a variable holding the return value from
Platform.createDefaultLayers().
Maps API for JavaScript Developer's Guide
► Guide
20
The following example brings together what we have said about map types. It first obtains an object
holding the default (map types and) layers, uses them to initialize a Map instance and, finally, changes
the map base layer by calling the method setBaseLayer() on the map object.
// Create a Platform object (one per application):
var platform = new H.service.Platform({ 'app_id': '<your app id>',
'app_code': '<your app code>' });
// Get an object containing the default map layers:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map using the normal map as the base layer:
var map = new H.Map(document.getElementById('mapContainer',
defaultLayers.normal.map);
// Change the map base layer to the satellite map with traffic information:
map.setBaseLayer(defaultLayers.satellite.traffic);
The image below shows the effect of executing this code.
Figure 2: The map after changing the base layer
Maps API for JavaScript Developer's Guide
► Guide
21
Custom Map Styles
In addition to the basic map styles/layers, the HERE Map Tile API provides a number of styles that
were created to meet the requirements of specific customers. These include:
•
alps (the legacy map style used before July 2014)
•
fleet (a map style optimized for fleet tracking display)
To obtain a map tile in any one of these styles, you need to access the HERE Map Tile API via an
instance of MapTileService, specifying the custom style.
The code below is an example that demonstrates how to get a fleet map. It creates a layer object and
uses that object to request a map tile (layer) in fleet style. The last line sets the newly obtained map
layer as the base layer on the map object.
// Create a MapTileService instance to request base tiles (i.e.
// base.map.api.here.com):
var mapTileService = platform.getMapTileService({ 'type': 'base' });
// Create a tile layer which requests map tiles with an additional 'style'
// URL parameter set to 'fleet':
var fleetStyleLayer = mapTileService.createTileLayer(
'maptile',
'normal.day',
256,
'png8',
{ 'style': 'fleet' });
// Set the new fleet style layer as a base layer on the map:
map.setBaseLayer(fleetStyleLayer);
The equivalent direct request to the Map Tile API, looks like this:
http://[1-4].base.map.api.here.com/maptile/2.1/maptile/newest/normal.day/[z]/[x]/[y]/256/
png8?style=fleet
Maps API for JavaScript Developer's Guide
► Guide
The image below shows the result.
Figure 3: The map after changing the base layer to the fleet style layer
22
Maps API for JavaScript Developer's Guide
► Guide
23
Map Events
Quick Start on page 10 shows an example that displays a default non-interactive map. The map is a
static picture, the viewer cannot drag it to see a different area, it does not respond to mouse clicks or
taps. Map interaction can be implemented, using the events supported by modern web browsers, but
the solution would be either browser-specific or otherwise very complex and would require testing
in different browsing environments. The Maps API for JavaScript offers help by providing a module
named events that acts as an abstraction layer, hiding browser-specific details (and quirks).
The Event System
The events module (mapsjs-events.js) normalizes different browser event systems in a wrapper
event system to make it easy to develop interactive cross-browser and cross-platform applications.
It draws on the terminology used in Microsoft's pointer events specification, providing a clear
abstraction from input devices such as mouse, touch or stylus, but note that it does not implement
the Microsoft specification.
The table below presents an overview of the events which the map dispatches when the events
module is enabled:
Table 6: Events in Maps API for JavaScript
Event
Description
pointerdown
Signals that a pointer (mouse, stylus, touch) has reached the map surface or map object;
equivalent to the event types mousedown, touchstart, pointerdown
pointerup
Signals that a pointer (mouse, stylus, touch) has left the map surface or map object; equivalent to
the event types mouseup, touchend, pointerup
pointermove
Signals that a pointer (mouse, stylus, touch) is moved across the map surface or map object;
equivalent to the event types mousemove, touchmove, pointermove
pointerenter
Signals that a pointer (mouse, stylus, touch) has entered the map object area; equivalent to the
event types mouseenter, touchenter, pointerenter
pointerleave
Signals that a pointer (mouse, stylus, touch) has left the map object area; equivalent to the event
types mouseleave, touchleave, pointerleave
pointercancel
Signals that an ongoing pointer (mouse, stylus, touch) action was cancelled by the browser;
equivalent to the event types: touchcancel, pointercancel
dragstart
Signals that a pointer (mouse, stylus, touch) drag operation started on the map or a map object
drag
Signals that a pointer (mouse, stylus, touch) drag operation on the map or a map object is ongoing
Maps API for JavaScript Developer's Guide
► Guide
Event
Description
dragend
Signals that a pointer (mouse, stylus, touch) drag operation on the map or a map object has
24
finished
Signals that a pointer (mouse, stylus, touch) has briefly touched the map surface or a map object;
tap
equivalent to the event types click and tap
dbltap
Signals that two tap events with the same pointer were executed in short succession
dbltap
Signals that a pointerdown event has occurred on a pointer target, no pointerup was triggered
and the pointer stayed in place for a longer period of time
A Map with Event Handling
To make a map event aware and allow it to respond to events:
1.
Load the module mapjs-events.js.
2.
Create a map object.
3.
Instantiate the MapEvents class.
4.
Add an events listener to the map.
The following code shows how to load the events module:
<!DOCTYPE html>
<html>
<head>
...
<meta name="viewport" content="initial-scale=1.0, width=device-width"/>
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-mapevents.js"
type="text/javascript" charset="utf-8"></script>
...
</head>
The code block below demonstrates the remaining steps, starting with creating a map object, then
instantiating H.mapevents.MapEvents, and finally adding a listener for tap events to the map. The
listener simply logs the event properties in the browser's JavaScript console.
// Initialize the map:
var map = new H.Map(...);
// Enable the event system on the map instance:
var mapEvents = new H.mapevents.MapEvents(map);
// Add event listener:
map.addEventListener('tap', function(evt) {
// Log 'tap' and 'mouse' events:
console.log(evt.type, evt.currentPointer.type);
});
Maps API for JavaScript Developer's Guide
► Guide
25
Structure of a Pointer Event
Like normal browser events, the pointer events are identified by their type property. Also, they
expose the target object on which they were dispatched and the original event that triggered them
(the property originalEvent).
Furthermore, a pointer event contains the following details of pointers:
•
pointers that are currently on the screen (mouse, stylus or touch)
•
pointers that have changed as a result of the current event
•
pointers that are on the (event) target
•
the pointer that triggered the current event
Note that if an application needs to distinguish between mouse and touch input, each pointer object
provides a type property which specifies the input method.
Event Propagation
The event system supports event propagation. Each map object that dispatches events propagates
them through the object hierarchy. This means that, for example, event listeners attached to the map
are triggered when interaction with a map object occurs – and the event's target correctly points to
the map object.
Enabling Default Map Behavior
The Maps API mapevents module provides full support for map interactions such as pan, zoom and
pinch-to-zoom. The implementation resides in the class H.mapevents.Behavior and makes use of
the event system abstraction.
Enabling map interactions is easily achieved by adding another line of code to our last example:
// Initialize the map:
var map = new H.Map(...);
// Enable the event system on the map instance:
var mapEvents = new H.mapevents.MapEvents(map);
// Add event listeners:
map.addEventListener('tap', function(evt) {
// Log 'tap' and 'mouse' events:
console.log(evt.type, evt.currentPointer.type);
});
// Instantiate the default behavior, providing the mapEvents object:
var behavior = new H.mapevents.Behavior(mapEvents);
The above code ensures that the map reacts to mouse, stylus and touch input.
Maps API for JavaScript Developer's Guide
► Guide
26
Map Objects
Types of Map Objects
The Maps API comes with an object model, which provides a convenient means to organize objects
on the map. The API distinguishes between three different types of objects: markers, spatials and
groups.
Markers are objects that visually indicate locations on the map, therefore each marker is defined
by the geographical point (latitude and longitude) to which it is anchored, and it includes an icon.
Panning the map changes the position of the marker on the screen, but the size of the marker icon
remains constant when you change the map zoom level (if you zoom in or out).
The API offers two types of markers to cater to different scenarios:
•
normal marker (H.map.Marker)
•
DOM marker (H.map.DomMarker)
For furher details, please see Marker Objects on page 28.
Spatials (spatial objects, also referred to as geo shapes in this guide) are circles, rectangles, polylines
and polygons and can be used to mark areas on the map. A spatial object is defined by a set of
geographical points. The points are translated and scaled as the map is panned and zoomed so that
the position of the shape on the display faithfully reflects its geographic location. A spatial object
includes styling information, which determines how to trace its outlines and how to fill it (if it is a
closed shape).
The Maps API offers the following classes that represent spatial objects:
•
Polylines (H.map.Polyline)
•
Polygons (H.map.Polygon)
•
Circles (H.map.Circle)
•
Rectangles (H.map.Rect).
For more information, please see Geo Shapes on page 34.
Groups are logical containers which can hold a collection of child objects (markers or spatials, but
also sub-groups). Groups make it easy to add, remove, show or hide whole sets of map objects in
an atomic operation, without the need to manipulate each object individually. In addition, a group
allows you to calculate a bounding box enclosing all the objects it contains and to listen for events
dispatched by the group's child objects.
Maps API for JavaScript Developer's Guide
► Guide
27
Adding and Removing Objects
Each map object type corresponds to a class in the API. A newly created instance of such a class does
not automatically appear on the map, but, like a node in the HTML document object model (DOM),
must be added to the root. This means that to make an object appear on the map, it must be added
to the map's root group through a call to the map object's method addObject(). Conversely, to
remove an object from the map, a call to the map object's method removeObject() is required.
Groups have their own addObject() and removeObject() methods and behave like container
elements in the HTML document object model. It is possible to add an empty group to the map and
add individual objects later.
The code below demonstrates how to create an empty group, add it to the map, then create a marker
and make it a member of the group.
// Create a group that can hold map objects:
group = new H.map.Group();
// Add the group to the map object (created earlier):
map.addObject(group);
// Create a marker:
marker = new H.map.Marker(map.getCenter());
// Add the marker to the group (which causes
// it to be displayed on the map)
group.addObject(marker);
Rendering Order
The 2D rendering engine in the HERE Maps API for JavaScript evaluates map objects and then renders
spatial objects, markers and DOM markers in separate passes. This means that spatials, markers
and DOM markers cannot be intermixed. Spatial objects are rendered into tiles and are painted like
normal map layers. After rendering all map layers, the Maps API renders all Markers (normal markers)
and finally all DomMarkers.
Maps API for JavaScript Developer's Guide
► Guide
28
Marker Objects
One of the most common use cases for a mapping application is to show points of interest (POIs) on
the map. The HERE Maps API for JavaScript, makes the implementation very easy by allowing you to
represent POIs as markers.
The Maps API offers two sorts of markers:
Table 7: Marker Types in HEREMaps API for JavaScript
Marker type
Class
Description
Marker
H.map.Marker
A "normal" marker that uses a static image as an icon. Large numbers
of markers of this types can be added to the map very quickly and
efficiently.
DOM marker
H.map.DomMarker
A marker which supports HTML (and SVG) content, which can be
dynamic. Markers of this type are best displayed individually or in
small sets.
A marker of either type consists of a geographical point defined by its latitude and longitude and a
visual representation, which is an icon. Marker icons are rendered in screen-space, meaning that their
size never changes regardless of the zoom level of the map.
Maker and DomMarker require different icon types. A Marker object accepts Icon instances
(H.map.Icon) and a DomMarker needs an instance of DomIcon (H.map.DomIcon). This scheme
allows icons to be reused in multiple marker objects.
It is also important to note that Markers and DomMarkers are rendered in separate rendering steps.
Markers are rendered onto the map canvas and therefore appear behind any DomMarkers, which are
rendered in an overlay on top of the map.
Marker with a Static SVG Icon
The code below shows how to instantiate a marker with an SVG icon.
// Create a map:
var map = new H.Map(...);
// Define a variable holding SVG mark-up that defines an icon image:
var svgMarkup = '<svg width="24" height="24" ' +
'xmlns="http://www.w3.org/2000/svg">' +
'<rect stroke="white" fill="#1b468d" x="1" y="1" width="22" ' +
'height="22" />' <text x="12" y="18" font-size="12pt" ' +
'font-family="Arial" font-weight="bold" text-anchor="middle "' +
'fill="white">H</text></svg>';
// Create an icon, an object holding the latitude and longitude, and a marker:
var icon = new H.map.Icon(svgMarkup),
coords = {lat: 52.53075, lng: 13.3851},
Maps API for JavaScript Developer's Guide
► Guide
marker = new H.map.Marker(coords, {icon: myIcon});
// Add the marker to the map and center the map at the location of the marker:
map.addObject(marker);
map.setCenter(coords);
The code creates:
1.
A map object (see also Quick Start on page 10).
2.
An SVG icon image (as a string).
3.
An object containing the geographic coordinates of a location, and a "normal" marker.
The last line of code adds the newly created marker to the map.
The resulting map centered on the location of the marker is shown in the image below.
Note: It is crucial to reuse icons between the markers to achieve better performance.
Figure 4: The map after adding the SVG marker
29
Maps API for JavaScript Developer's Guide
► Guide
Marker with a Static Image
The following code snippet shows how to instantiate an icon and a marker from an image URL.
The code creates:
1.
A map object (see also Quick Start on page 10)
2.
An icon using the URL of a bitmap (PNG image)
3.
A "normal" marker initialized with the bitmap.
The last line of the code adds the marker to the map.
// Create a map:
var map = new H.Map(...);
// Create a marker icon from an image URL:
var icon = new H.map.Icon('graphics/markerHouse.png');
// Create a marker using the previously instantiated icon:
var marker = new H.map.Marker({ lat: 52.5, lng: 13.4 }, { icon: icon });
// Add the marker to the map:
map.addObject(marker);
30
Maps API for JavaScript Developer's Guide
► Guide
31
The image below shows the map centered on the location of the marker that uses a bitmap icon.
Figure 5: Map with a bitmap marker
This example uses a basic set of parameters to create a marker with a custom image icon. However,
icons and markers provide further customization options, which can be passed to the constructors
as parameters. These options include, for example, custom hit-areas and anchors for image icons.
Please see the API Reference for the full documentation.
Note that the icon property of a marker is one of the optional parameters as well. The API provides a
default icon for markers to which a custom icon has not been assigned.
Marker with HTML / SVG content
Image markers are a good way to highlight points of interest on a map with static graphical content.
In certain use-cases, it is desirable to provide markers with interactive or animated HTML content (for
example animated GIFs, animated SVGs or hover effects), rather than pre-rendered images. The Maps
API provides the DomMarker class for such use-cases.
Maps API for JavaScript Developer's Guide
► Guide
32
The following example shows how a DomMarker can be used to create a marker with animated SVG
content. In this case, the animated marker icon is a bouncing ball.
The code creates:
1.
A map object (see also Quick Start on page 10).
2.
A variable that holds the definition of an animated SVG image.
3.
An icon (initialized with the SVG image.
4.
An object containing the geographic coordinates of a location.
5.
A "normal" marker.
The last two lines add the marker to the map and center the map, using the object holding the
geographic coordinates.
// Create a map object:
var map = new H.Map(...);
// Define a variable holding SVG mark-up that defines an animated icon image:
var animatedSvg =
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" ' +
'y="0px" style="margin:-112px 0 0 -32px" width="136px"' +
'height="150px" viewBox="0 0 136 150"><ellipse fill="#000" ' +
'cx="32" cy="128" rx="36" ry="4"><animate attributeName="cx" ' +
'from="32" to="32" begin="0s" dur="1.5s" values="96;32;96" ' +
'keySplines=".6 .1 .8 .1; .1 .8 .1 1" keyTimes="0;0.4;1"' +
'calcMode="spline" repeatCount="indefinite"/>' +
'<animate attributeName="rx" from="36" to="36" begin="0s"' +
'dur="1.5s" values="36;10;36" keySplines=".6 .0 .8 .0; .0 .8 .0 1"' +
'keyTimes="0;0.4;1" calcMode="spline" repeatCount="indefinite"/>' +
'<animate attributeName="opacity" from=".2" to=".2" begin="0s" ' +
' dur="1.5s" values=".1;.7;.1" keySplines=" .6.0 .8 .0; .0 .8 .0 1" ' +
'keyTimes=" 0;0.4;1" calcMode="spline" ' +
'repeatCount="indefinite"/></ellipse><ellipse fill="#1b468d" ' +
'cx="26" cy="20" rx="16" ry="12"><animate attributeName="cy" ' +
'from="20" to="20" begin="0s" dur="1.5s" values="20;112;20" ' +
'keySplines=".6 .1 .8 .1; .1 .8 .1 1" keyTimes=" 0;0.4;1" ' +
'calcMode="spline" repeatCount="indefinite"/> ' +
'<animate attributeName="ry" from="16" to="16" begin="0s" ' +
'dur="1.5s" values="16;12;16" keySplines=".6 .0 .8 .0; .0 .8 .0 1" ' +
'keyTimes="0;0.4;1" calcMode="spline" ' +
'repeatCount="indefinite"/></ellipse></svg>';
// Create an icon object, an object with geographic coordinates and a marker:
var icon = new H.map.DomIcon(animatedSvg),
coords = {lat: -22.8906, lng: -43.2283},
marker = new H.map.DomMarker(coords, {icon: icon});
// Set map center and zoom, add the marker to the map:
map.setCenter(coords);
map.setZoom(18);
map.addObject(marker);
Maps API for JavaScript Developer's Guide
► Guide
The image below shows the map with a marker that uses an animated icon.
Figure 6: Map with an animated marker
33
Maps API for JavaScript Developer's Guide
► Guide
34
Geo Shapes
The HERE Maps API for JavaScript provides an easy means of highlighting and demarcating areas on
the map with circles, rectangles, polylines and polygons (spatials for short). You can draw them on
an on-line map just as you can on a paper one with a pencil or pen, but with much greater flexibility,
because the API allows you to determine not only of each shape, its color(s), and line thickness, but
also the transparency and, more importantly, you can position the shape with pinpoint geographic
accuracy.
A polyline (H.map.Polyline) is a line on the map defined in terms of a set of points (represented in
the API as a geo.Strip) and a style, which defines the way the Maps API traces the line on the map.
A polyline can be used for drawing paths similar to routes. A polygon (H.map.Polygon) is similar to
a polyline, but it is a closed shape, therefore it can be used to show or highlight an area on the map.
Unlike a polyline, a polygon is traced with an optional outline and can be filled with an arbitrary color.
Rectangles (H.map.Rect) and circles (H.map.Circle) are extensions of polygons.
To display a geo shape, you must instantiate the corresponding API class and add the resulting object
to the Map object.
Adding a Circle to the Map
The example below demonstrates how to add a circle to the map.
The code creates a map object (see also Quick Start on page 10), instantiates a circle, providing the
latitude and longitude of its center and the radius, and finally adds the circle to the map.
// Instantiate a map object:
var map = new H.Map(...);
// Instantiate a circle object (using the default style):
var circle = new H.map.Circle({lat: 52.51, lng: 13.4}, 8000);
// Add the circle to the map:
map.addObject(circle);
Maps API for JavaScript Developer's Guide
► Guide
The image below shows the result.
Figure 7: Map with a circle
Styling Geo Shapes
The Maps API allows you to customize the visual appearance of geo shapes through styling. The
customization options include:
Style property
Description
strokeColor
The color of a shapes outline
lineWidth
The width of the outline in pixels
fillColor
The color with which a shape's area will be filled (ignored for polylines)
lineCap
The rendering style of outline endings
lineJoin
The rendering style for vertices within the outline
35
Maps API for JavaScript Developer's Guide
► Guide
36
The following example shows how to apply custom styling to a rectangle object.
The code creates:
1.
A map object (see also Quick Start on page 10)
2.
An object holding the details of the styling such as the stroke and fill color and line properties
3.
An instance of a rectangle, specifying the geographic coordinates of its corners and providing
the style object
The last two function calls add the rectangle to the map and set the map view bounds to ensure that
the entire rectangle is displayed.
// Create a map similarly to the example in quick-start guide:
var map = new H.Map(...);
// Create a style object:
var customStyle = {
strokeColor: 'black',
fillColor: 'rgba(255, 255, 255, 0.5',
lineWidth: 10,
lineCap: 'square',
lineJoin: 'bevel'
};
// Create a rectangle and pass the custom style as an options parameter:
var rect = new H.map.Rect(new H.geo.Rect(53.5, 12.5, 51.5, 14.5),
{ style: customStyle });
// Add the rectangle to the map:
map.addObject(rect);
// Zoom the map to fit the rectangle:
map.setViewBounds(rect.getBounds());
Maps API for JavaScript Developer's Guide
► Guide
37
The image below shows the resulting map view.
Figure 8: Map with a custom-style rectangle
Shapes from Arbitrary Geographic Points
The above examples make use of pre-defined shapes to put a circle and a rectangle on the map,
respectively. However, in most cases, map shapes are created from different arbitrary sources such
as GPS traces or routing information.
The following example converts arbitrary geographical points into a polyline. First, it creates a
map object (see also Quick Start on page 10), then an array of points defined by their latitude and
longitude. In the next step, the code converts the points to a Strip object (H.geo.Strip) which
represents an ordered set of points. This Strip instance is a point source for the polyline.
The example ends by adding the polyline to the map and setting the view bounds so that the entire
shape is visible.
// Create a map object:
var map = new H.Map(...);
Maps API for JavaScript Developer's Guide
► Guide
// Define points to represent the vertices of a short route in Berlin, Germany:
var points = [
{ lat: 52.5309825, lng: 13.3845921 },
{ lat: 52.5311923, lng: 13.3853495 },
{ lat: 52.5313532, lng: 13.3861756 },
{ lat: 52.5315142, lng: 13.3872163 },
{ lat: 52.5316215, lng: 13.3885574 },
{ lat: 52.5320399, lng: 13.3925807 },
{ lat: 52.5321472, lng: 13.3935785 },
{ lat: 52.5323832, lng: 13.395499 },
{ lat: 52.5324261, lng: 13.3959818 },
{ lat: 52.5325012, lng: 13.397795 },
{ lat: 52.5325656, lng: 13.3986318 },
{ lat: 52.5326192, lng: 13.3989215 },
{ lat: 52.5325119, lng: 13.3989751 },
{ lat: 52.5323081, lng: 13.3991039 },
{ lat: 52.5318789, lng: 13.3994472 },
{ lat: 52.5301194, lng: 13.4009278 },
{ lat: 52.5297546, lng: 13.4012604 },
{ lat: 52.5296152, lng: 13.4014106 },
{ lat: 52.5289822, lng: 13.4018934 },
{ lat: 52.5276947, lng: 13.4029663 },
{ lat: 52.5271797, lng: 13.4033203 },
{ lat: 52.5269973, lng: 13.4033954 },
{ lat: 52.5265145, lng: 13.4035349 },
{ lat: 52.5260746, lng: 13.4036851 },
{ lat: 52.5260103, lng: 13.4038353 },
{ lat: 52.5256562, lng: 13.40464
},
{ lat: 52.5253022, lng: 13.4053588 },
{ lat: 52.5250447, lng: 13.4059381 },
{ lat: 52.5249588, lng: 13.4062278 },
{ lat: 52.5249267, lng: 13.4064317 },
{ lat: 52.5249052, lng: 13.406775 },
{ lat: 52.5248623, lng: 13.4069574 },
{ lat: 52.5241864, lng: 13.4089208 },
{ lat: 52.5241327, lng: 13.4091246 },
{ lat: 52.5240898, lng: 13.409307 },
{ lat: 52.5240040, lng: 13.4096611 },
{ lat: 52.5239503, lng: 13.4101653 },
{ lat: 52.5239289, lng: 13.4110343 },
{ lat: 52.5238967, lng: 13.4117103 },
{ lat: 52.5238752, lng: 13.4120321 },
{ lat: 52.5236285, lng: 13.4126866 },
{ lat: 52.5231242, lng: 13.4139311 },
{ lat: 52.5227809, lng: 13.4146714 },
{ lat: 52.5224799, lng: 13.4152412 }
];
// Initialize a strip and add all the points to it:
var strip = new H.geo.Strip();
points.forEach(function(point) {
strip.pushPoint(point);
});
// Initialize a polyline with the strip:
var polyline = new H.map.Polyline(strip, { style: { lineWidth: 10 }});
// Add the polyline to the map:
map.addObject(polyline);
// Zoom the map to make sure the whole polyline is visible:
map.setViewBounds(polyline.getBounds());
38
Maps API for JavaScript Developer's Guide
► Guide
The following image shows a map with the polyline created by this code.
Figure 9: Map with a polyline
39
Maps API for JavaScript Developer's Guide
► Guide
40
StreetLevel
The HERE Maps API for JavaScript includes a StreetLevel module (mapsjs-pano.js), which enables
navigation between panoramic views available at different locations along streets, squares and other
public places. This article describes how to access and use the StreetLevel functionality.
Configuring and Setting the StreetLevel Engine.
To access the StreetLevel functionality, add a <script> element referencing the module mapsjspano.js in the <head> of the HTML page:
<!DOCTYPE html>
<html>
<head>
...
<meta name="viewport" content="initial-scale=1.0, width=device-width"/>
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-pano.js"
type="text/javascript" charset="utf-8"></script>
...
</head>
Next, configure the StreetLevel engine through the Platform object, supplying your application
credentials. Please see also H.service.Platform for information about the Platform object.
To display a panorama in the map view port, you need to set the engine type on the map object. If
you know the location of a StreetLevel panorama at map instantiation time, you can set the engine
type directly through the map constructor options property engineType as in the code example
below:
<script type="text/javascript" charset="utf-8">
// Create a Platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Configure panorama with platform credentials:
platform.configure(H.map.render.panorama.RenderEngine)
// Instantiate a map, giving the constructor the engine type to use:
map = new mapsjs.Map(mapElement, someBaseLayer, {
center: {lat: 48.8733641244471, lng: 2.294754032045603},
zoom: 19,
engineType: H.Map.EngineType.PANORAMA
});
</script>
Maps API for JavaScript Developer's Guide
► Guide
41
The following image shows the resulting panorama display:
Figure 10: A StreetLevel panorama
Note that to implement user interaction with a StreetLevel panorama, you need to load the mapsjsevents.js component of the API and add event listeners to the map, with the appropriate handler
functions.
Checking Coverage and Entering StreetLevel
If you do not know the location for which a street level panorama is available in advance, you can
use a static method on the StreetLevel engine to enable panorama discovery around a point defined
in terms of latitude and longitude. The method allows you to access both the exact location of the
available panoramas and their identifiers.
The panorama map type layer (see also Map Types on page 17) shows areas on the map covered by
StreetLevel.
The following code demonstrates how to retrieve the panoramas in the vicinity of a known
geographic location. A callback function receives the panoramas as an array. The callback in the
example checks if the array contains any elements and, if so, displays the first of them by setting the
map engine type.
<script type="text/javascript" charset="utf-8">
// Assuming that engine was configured and map exists,
Maps API for JavaScript Developer's Guide
► Guide
42
// get panoramas near a location:
H.map.render.panorama.RenderEngine.getClosestPanoramas(
{lat:51.51, lng: -0.07}, function(panoramaData) {
if (panoramaData.length) {
// Set map center to the location of the first available panorama:
map.setCenter(panoramaData[0].position);
// Switch to to the panorama engine to show the panorama:
map.setEngineType(H.Map.EngineType.PANORAMA);
}
});
</script>
StreetLevel UI
The HERE Maps API for JavaScript ui module (see also Map Controls and UI on page 44) provides
a default StreetLevel user interface control. When StreetLevel is enabled, the map viewport displays
the control as an icon showing a human figure in a black circle. The default StreetLevel control
enables panorama discovery by setting panorama as a map base layer. If a panorama is available, the
application user can view it (enter StreetLevel) by clicking on the map. The code below contains the
essential part of the implementation:
<script type="text/javascript" charset="utf-8">
// Assuming that platform was instantiated, get default map layers:
var maptypes = platform.createDefaultLayers()
// Create the StreetLevel UI element:
var ui = new H.ui.UI(map, {
panorama: {
// Provide panorama coverage layer:
mapTypes: maptypes
}
});
</script>
Maps API for JavaScript Developer's Guide
► Guide
The following image shows the map user interface with the street level control in the top-right
corner.
Figure 11: Map display with the StreetLevel UI
43
Maps API for JavaScript Developer's Guide
► Guide
44
Map Controls and UI
The HERE Maps API for JavaScript provides a set of ready-made map controls through the UI module
(mapsjs-ui.js). In addition, the module supports the creation of info bubbles.
The UI allows you to add the following default components to the map:
•
MapSettingsControl – allows the user to change the base map
•
ZoomControl – allows the user to change the map zoom level
•
Scalebar – shows the current map scale
•
Pano – shows a button to enter and leave StreetLevel
Adding UI Components to the Map
The following example demonstrates how to add UI components to the map.
The first step is to add a <script> tag to the <head> element of the page to load the API's UI
module and a link to the CSS file as shown in the code below:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0,
width=device-width" />
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-ui.js"
type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css"
href="http://js.api.here.com/v3/3.0/mapsjs-ui.css" />
</head>
Next, create a map object with the default map types in the script section for the application logic.
Note that the default UI requires a map instance as well as a collection containing the default map
layers.
<script type="text/javascript" charset="utf-8">
//Initialize the Platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Get the default map types from the Platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
Maps API for JavaScript Developer's Guide
► Guide
45
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lng: 13.4, lat: 52.51 }
});
// Create the default UI:
var ui = H.ui.UI.createDefault(map, defaultLayers);
</script>
In the image below, the resulting map shows the default controls (the scale bar at the bottom, the
zoom control on the right, and the map selector in the bottom right corner).
Figure 12: Map with the default controls
Note, that the Pano control does appear in the map user interface shown above. The UI detects
whether the StreetLevel module (mapsjs-pano.js) has been loaded and makes the corresponding
UI control visible only when the module is available.
Maps API for JavaScript Developer's Guide
► Guide
46
The following example shows the default UI when the StreetLevel module is loaded in the containing
HTML page.
Figure 13: Map with the default controls (with Pano visible)
When you create the default UI, an instance of each control is added to the UI object. The controls
can be enabled or disabled (removed) individually via calls to the method getControl() defined on
the H.ui.UI class. To identify the control you wish to manipulate, you must use the appropriate key:
•
•
•
•
'mapsettings' – identifies the MapSettingsControl
'zoom' – identifies the ZoomControl
'scalebar' – identifies the ScaleBar
'panorama' – identifies Pano (StreetLevel)
The code below shows how to use the method getControl() and a control identifier to disable the
zoom control:
ui.getControl('zoom').setEnabled(false)
Maps API for JavaScript Developer's Guide
► Guide
Changing the UI Language
The UI module comes with localizations for the following languages:
•
•
•
•
•
•
•
•
•
•
•
•
•
en-US – English (United States)
de-DE – German
es-ES – Spanish
fi-FI – Finnish
fr-FR – French
it-IT – Italian
nl-NL – Dutch
pl-PL – Polish
pt-BR – Portuguese (Brazil)
pt-PT – Portuguese (Portugal)
ru-RU – Russian
tr-TR – Turkish
zh-CN – Chinese (China)
The code that follows uses a language identifier to present the map user interface in German.
<script type="text/javascript" charset="utf-8">
//Initialize the Platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Get the default map types from the Platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lng: 13.4, lat: 52.51 }
});
// Create the default UI:
var ui = H.ui.UI.createDefault(map, defaultLayers, 'de-DE');
</script>
47
Maps API for JavaScript Developer's Guide
► Guide
48
The image below shows the effect of this code as seen by the application user.
Figure 14: All UI controls localized in German
Managing the Position of UI Controls
A further option supported by the Maps API allows you to change the position of the UI controls. In
the following example, all map controls are moved to the top-left corner of the map viewport.
The code extends the previous example by obtaining an instance of each of the default UI controls
and then setting alignment on the controls to the top-left corner.
var
var
var
var
mapSettings = ui.getControl('mapsettings');
zoom = ui.getControl('zoom');
scalebar = ui.getControl('scalebar');
panorama = ui.getControl('panorama');
panorama.setAlignment('top-left');
mapSettings.setAlignment('top-left');
zoom.setAlignment('top-left');
scalebar.setAlignment('top-left');
Maps API for JavaScript Developer's Guide
► Guide
49
The image below shows the results of executing this code.
Figure 15: All UI controls aligned top-left
Info Bubbles
In addition to map controls, the UI module supports info bubbles. An info bubble allows you literally
to show a 'bubble' containing HTML content on the map, for example text or images.
The code below extends the first example in this article by adding an info bubble to the map display.
It creates an instance of InfoBubble, specifying the geographic coordinates of the location at which
it should appear, and the HTML content, which in this case is the text string "Hello World!" in bold.
The last line adds the info bubble object to the UI instance.
// Create an info bubble object at a specific geographic location:
var bubble = new H.ui.InfoBubble({ lng: 13.4, lat: 52.51 }, {
content: '<b>Hello World!</b>'
});
// Add info bubble to the UI:
ui.addBubble(bubble);
Maps API for JavaScript Developer's Guide
► Guide
The image below shows the results of executing the code.
Figure 16: Opening an info bubble
50
Maps API for JavaScript Developer's Guide
► Guide
51
Geocoding
Resolving addresses to geo-coordinates and vice-versa are common requirements for locationbased applications. The HERE Geocoder API provides a REST service to perform geocoding (matching
an address to its correct location on the map), reverse geocoding (obtaining a street address
that corresponds to a set of geo-coordinates) as well as landmark geocoding (finding airports or
landmarks classified as nationally important).
All these features can be accessed through the Map API's service module (mapsjs-service.js) for
easy integration into a map application.
Displaying geocoding results on a map
The following example shows how to geocode the address 200 S Mathilda Ave, Sunnyvale, CA and
place a marker at the returned location on the map.
The code submits a geocoding request, providing callback functions to handle the results. The
request uses a geocodingParameters object literal whose members match the parameters names
supported by the HERE Geocoder API. The contents of geocodingParams are converted by the
Maps API to URL parameters. The parameter object can include any parameters recognized by the
Geocoder API, offering complete flexibility in defining a route calculation request.
The request is processed asynchronously, which is why the callbacks are needed. The callback
function invoked on success places the marker on the map, while the error callback simply displays an
alert.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the target element for the map:
var targetElement = document.getElementById('mapContainer');
// Get default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.51, lng: 13.4 }
});
// Create the parameters for the geocoding request:
var geocodingParams = {
searchText: '200 S Mathilda Ave, Sunnyvale, CA'
};
Maps API for JavaScript Developer's Guide
► Guide
// Define a callback function to process the geocoding response:
var onResult = function(result) {
var locations = result.Response.View[0].Result,
position,
marker;
// Add a marker for each location found
for (i = 0; i < locations.length; i++) {
position = {
lat: locations[i].Location.DisplayPosition.Latitude,
lng: locations[i].Location.DisplayPosition.Longitude
};
marker = new H.map.Marker(position);
map.addObject(marker);
}
};
// Get an instance of the geocoding service:
var geocoder = platform.getGeocodingService();
// Call the geocode method with the geocoding parameters,
// the callback and an error callback function (called if a
// communication error occurs):
geocoder.geocode(geocodingParams, onResult, function(e) {
alert(e);
});
52
Maps API for JavaScript Developer's Guide
► Guide
53
A successful geocoding request allows the code to display a marker for each location found as shown
in the image below:
Figure 17: The map after retrieving the geo-coordinates for the address
Reverse geocoding map locations
The following example shows how to retrieve the first address within a radius of 150 meters of a
location in Berlin, Germany (52.5309°N 13.3847°E). The result is displayed on the map with an info
bubble marking the location of the retrieved address.
The code places the details of the request in the object named reverseGeocodingParameters
and defines callbacks to process both a success and an error response. The success callback creates
an info bubble, populates it with the reverse geocoding result and displays the info bubble on the
map.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the target element for the map:
Maps API for JavaScript Developer's Guide
► Guide
var targetElement = document.getElementById('mapContainer');
// Get default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.51, lng: 13.4 }
});
// Create the parameters for the reverse geocoding request:
var reverseGeocodingParameters = {
prox: '52.5309,13.3847,150',
mode: 'retrieveAddresses',
maxresults: 1
};
// Define a callback function to process the response:
function onSuccess(result) {
var location = result.Response.View[0].Result[0];
// Create an InfoBubble at the returned location with
// the address as its contents:
ui.addBubble(new H.ui.InfoBubble({
lat: location.Location.DisplayPosition.Latitude,
lng: location.Location.DisplayPosition.Longitude
}, { content: location.Location.Address.Label }));
};
// Get an instance of the geocoding service:
var geocoder = platform.getGeocodingService();
// Call the geocode method with the geocoding parameters,
// the callback and an error callback function (called if a
// communication error occurs):
geocoder..reverseGeocode(
reverseGeocodingParameters,
onSuccess,
54
Maps API for JavaScript Developer's Guide
► Guide
55
function(e) { alert(e); });
Figure 18: The map showing the retrieved address of a location
Landmark search
Landmark geocoding is a combination of geocoding, landmark search, and reverse geocoding.
It supports search for airports, well known landmarks such as the Eiffel Tower or landmarks
classified as nationally important. The result is a list of ranked locations including street addresses,
administrative areas, or landmarks.
The following example shows how to search for Chicago O'Hare International Airport (ORD) using
the landmark search. The object landmarkSearchParameters is used to convey the parameters
defining the request to the back end, and the callback methods handle the success and error
responses.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the target element for the map:
Maps API for JavaScript Developer's Guide
► Guide
var targetElement = document.getElementById('mapContainer');
// Get default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.51, lng: 13.4 }
});
// Create the parameters for the landmark search request:
var landmarkSearchParameters = {
searchText: 'ORD'
};
// Define a callback function to process the search response:
var onResult = function(result) {
function onSuccess(result) {
var location = result.Response.View[0].Result[0].Place.Locations[0];
// Create an info bubble at the retrieved location with the
// location's name as contents:
ui.addBubble(new H.ui.InfoBubble({
lat: location.DisplayPosition.Latitude,
lng: location.DisplayPosition.Longitude
}, { content: location.Name }));
};
};
// Get an instance of the geocoding service:
var geocoder = platform.getGeocodingService();
// Call the geocode method with the search parameters,
// the callback and an error callback function (called if a
// communication error occurs):
geocoder.search(landmarkSearchParameters, onResult, function(e) {
alert(e);
});
56
Maps API for JavaScript Developer's Guide
► Guide
When the request is successful, the callback function displays an info bubble on the map:
Figure 19: The map after retrieving landmark information
57
Maps API for JavaScript Developer's Guide
► Guide
58
Routing
Route planning and navigation are the most commonly used applications of location-based services.
With the Maps API, you can calculate optimal routes that match your own calculation criteria, are
based on up-to-date map data, and take into account real-time traffic information.
The API offers global coverage of streets and highways, allowing you to create routes that reflect
customizable modes such as fastest, shortest, avoiding toll roads or avoiding ferries, etc. There is also
support for utilizing historical speed patterns as an optimization for routes depending on the time of
day.
Through the service module (mapsjs-service.js), the Maps API provides direct access to the
HERE Routing API to retrieve route information, including route shapes. Route information returned
by the HERE Routing API can be used in a many different ways to suit the requirements of an
application, although the examples below confine themselves to basic scenarios.
Displaying a Route on the Map
The following example shows how to obtain a route from Frankfurt to Berlin and display the result on
a map.
The code:
1.
Obtains a Platform object, supplying the authentication and authorization credentials.
2.
Instantiates the map, specifying the map type, zoom and the location of the center.
3.
Defines a set of routing parameters to be used by the back end service when it calculates the
route – the parameters indicate the fastest route, the start point and end points as geographical
coordinates, and the representation mode 'display'.
4.
Defines a callback function to be called if the routing request is successful – it receives the route
object as a parameter, retrieves from it the vertices of the route and converts them to a Strip
object, creates a polyline to represent the route, creates markers to indicate the start and end
point of the route, adds the polyline and the markers to the map, and finally adjusts the map view
bounds to ensure the entire route is visible.
5.
Obtains an object representing the routing service stub.
6.
Calls the method calculateRoute() on the routing service, passing to it the parameter object
and the callback functions.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the target element for the map:
Maps API for JavaScript Developer's Guide
► Guide
var targetElement = document.getElementById('mapContainer');
// Get the default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.51, lng: 13.4 }
});
// Create the parameters for the routing request:
var routingParameters = {
// The routing mode:
'mode': 'fastest;car',
// The start point of the route:
'waypoint0': 'geo!50.1120423728813,8.68340740740811',
// The end point of the route:
'waypoint1': 'geo!52.5309916298853,13.3846220493377',
// To retrieve the shape of the route we choose the route
// representation mode 'display'
'representation': 'display'
};
// Define a callback function to process the routing response:
var onResult = function(result) {
var route,
routeShape,
startPoint,
endPoint,
strip;
if(result.response.route) {
// Pick the first route from the response:
route = result.response.route[0];
// Pick the route's shape:
routeShape = route.shape;
// Create a strip to use as a point source for the route line
strip = new H.geo.Strip();
// Push all the points in the shape into the strip:
routeShape.forEach(function(point) {
var parts = point.split(',');
strip.pushLatLngAlt(parts[0], parts[1]);
});
// Retrieve the mapped positions of the requested waypoints:
startPoint = route.waypoint[0].mappedPosition;
endPoint = route.waypoint[1].mappedPosition;
// Create a polyline to display the route:
var routeLine = new H.map.Polyline(strip, {
style: { strokeColor: 'blue', lineWidth: 10 }
});
// Create a marker for the start point:
var startMarker = new H.map.Marker({
lat: startPoint.latitude,
lng: startPoint.longitude
});
// Create a marker for the end point:
var endMarker = new H.map.Marker({
lat: endPoint.latitude,
lng: endPoint.longitude
});
59
Maps API for JavaScript Developer's Guide
► Guide
60
// Add the route polyline and the two markers to the map:
map.addObjects([routeLine, startMarker, endMarker]);
// Set the map's viewport to make the whole route visible:
map.setViewBounds(routeLine.getBounds());
}
};
// Get an instance of the routing service:
var router = platform.getRoutingService();
// Call calculateRoute() with the routing parameters,
// the callback and an error callback function (called if a
// communication error occurs):
router.calculateRoute(routingParameters, onResult,
function(error) {
alert(error.message);
});
Note that the member elements of the routingParameters object literal directly map to the URL
parameters required by the HERE Routing API. The parameter object can include any parameters
recognized by the Routing API, offering complete flexibility in defining a route calculation request.
Maps API for JavaScript Developer's Guide
► Guide
61
The map below shows the result of the route calculation, with the start and end of the route from
Frankfurt am Main to Berlin in Germany indicated by markers with default icons, and the route itself
shown as a green polyline.
Figure 20: The map after calculating the route
Showing Route Direction Arrows
The API offers a way to render arrows on the route polyline to indicate the direction of travel. The
code below enhances the onResult callback from the previous example by providing an arrows
object to the Polyline constructor.
//Within the onResult callback:
// Create a polyline to display the route
routeLine = new H.map.Polyline(strip, {
style: { lineWidth: 10 },
arrows: { fillColor: 'white', frequency: 2, width: 0.8, length: 0.7 }
});
Maps API for JavaScript Developer's Guide
► Guide
62
The following image shows how the route appears on the map.
Figure 21: The map after adding a route line with arrows
Note that arrow styles can also be set after the instantiation of a polyline by calling the method
setArrows() on a polyline instance.
Enterprise Routing Use Cases
In the routing examples we have shown so far, the routing requests are submitted to the HERE
Routing API. For enterprise-related use cases, such as truck routing or isoline routing, the HERE
Platform offers the Enterprise Routing API, which can also be accessed through the JavaScript
API. Both services (routing and enterprise routing) can be used side-by-side depending on the
requirements placed on the application.
The following example shows how to calculate an isoline representing points that lie no further
than a 15 minutes' car journey from the center of Berlin (in fact, the isoline describes an area – any
destination in that area can be reached by car from the center of Berlin in 15 minutes or less). The
example uses the EnterpriseRoutingService class to obtain the isoline.
Maps API for JavaScript Developer's Guide
► Guide
63
In summary, the code:
1.
Creates a map instance showing the area around Berlin, Germany.
2.
Defines a routingParams object that specifies that the fastest routes for a car are to be
calculated, sets the starting point and the time.
3.
Defines a callback to be invoked when the results of the routing request become available – the
callback function creates a polygon, using the points of the calculated isoline, adds the polygon
and a marker at the center of the isoline polygon to the map, sets the map view port so that the
entire isoline is visible.
4.
Instantiates the Enterprise Routing Service.
5.
Calls the Enterprise Routing Service method calculateIsoline(), passing to it the parameter
object and the success and error callbacks.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the target element for the map:
var targetElement = document.getElementById('mapContainer');
// Get the default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 10,
center: { lat: 52.51, lng: 13.4 }
});
// Create the parameters for the routing request:
var routingParams = {
'mode': 'fastest;car',
'start': 'geo!52.5,13.4',
'time': 'PT0H15M'
};
// Define a callback function to process the isoline response.
var onResult = function(result) {
var center = new H.geo.Point(
result.Response.Center.Latitude,
result.Response.Center.Longitude),
isolineCoords = result.Response.isolines[0].value,
strip = new H.geo.Strip(),
isolinePolygon,
isolineCenter;
// Add the returned isoline coordinates to a strip:
isolineCoords.forEach(function(coords) {
strip.pushLatLngAlt.apply(strip, coords.split(','));
});
// Create a polygon and a marker representing the isoline:
isolinePolygon = new H.map.Polygon(strip);
isolineCenter = new H.map.Marker(center);
Maps API for JavaScript Developer's Guide
► Guide
64
// Add the polygon and marker to the map:
map.addObjects([isolineCenter, isolinePolygon]);
// Center and zoom the map so that the whole isoline polygon is
// in the viewport:
map.setViewBounds(isolinePolygon.getBounds());
};
// Get an instance of the enterprise routing service:
var enterpriseRouter = platform.getEnterpriseRoutingService();
// Call the Enterprise Routing API to calculate an isoline:
enterpriseRouter.calculateIsoline(
routingParams,
onResult,
function(error) {
alert(error.message);
});
The resulting isoline is shown in the map image below:
Figure 22: The map after adding the isoline polygon
For additional information regarding the features and use of the Enterprise Routing API, please refer
to the online documentation on developer.here.com.
Maps API for JavaScript Developer's Guide
► Guide
65
Traffic
The Maps API provides a means of retrieving and displaying traffic data on the map for major urban
areas around the globe.
Showing Traffic Flow on the Map
The example below uses the traffic component in the Maps API to show a map of part of Germany,
indicating the traffic conditions. Roads where traffic flows freely are marked in green, roads where
congestion is moderate are in orange, while those that are congested are shown in red.
The API provides access to map tiles with traffic information through the HERE Map Tile API. It
automatically adds layers using traffic map tiles to the default layer collection (accessed through
the method createDefaultLayers() on the H.service.Platform instance). The application
Maps API for JavaScript Developer's Guide
► Guide
66
user can switch the traffic flow information display on and off for the available map types via the
MapSettingsControl.
Figure 23: Map showing traffic flow data
Showing Traffic Incidents on the Map
In addition to traffic flow, the API integrates traffic incident data by providing a marker overlay that
can be added to the map.
The code below adds to the map the pre-configured traffic incidents marker layer available in the
default layer collection to show traffic incidents.
map.addLayer(defaultLayers.incidents);
This code assumes that map is a previously instantiated and initialized instance of H.Map.
Maps API for JavaScript Developer's Guide
► Guide
67
The MapSettingsControl includes an entry for switching traffic incidents display on and off if the
traffic incident layer is detected in the collection of layers passed to the UI.
Figure 24: Map showing traffic data
Maps API for JavaScript Developer's Guide
► Guide
68
Clustering
Sometimes, the need arises to display a large set of data on the map, for example several thousand
points. There are two potential problems you may encounter: one is a possible performance
degradation when all the points (markers) are visible at lower zoom levels, the other is the fact that
the markers located in close geographic proximity to one another may visibly overlap and even hide
one another at lower zoom levels. A solution to both these problems is offered by clustering.
A clustering algorithm groups data points by collapsing two or more points positioned close to one
another on the screen into a single cluster point. All other (not collapsed) points are still visible on
map as noise points. The image below illustrates this. It shows the noise points as blue dots and
clusters as green and orange markers, each showing the cumulative weight of the data points they
combine.
Figure 25: A Map with Clusters and Noise Points
Setting up Clustering
To be able to use clustering in the Maps API, the prerequisite is to include the clustering extension
script in the <head> section of the HTML page:
<!DOCTYPE html>
<html>
<head>
...
<meta name="viewport" content="initial-scale=1.0, width=device-width"/>
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js"
Maps API for JavaScript Developer's Guide
► Guide
69
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js"
type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-clustering.js"
type="text/javascript" charset="utf-8"></script>
...
</head>
Creating a Data Set
To show data as clusters on the map, prepare a data set and create a clustering provider
that can support a map layer with clustered data. The data set is represented by an array of
H.clustering.DataPoint objects as in example below.
var dataPoints = [];
dataPoints.push(new H.clustering.DataPoint(51.01,
dataPoints.push(new H.clustering.DataPoint(50.04,
dataPoints.push(new H.clustering.DataPoint(51.45,
dataPoints.push(new H.clustering.DataPoint(51.01,
0.01));
1.01));
1.01));
2.01));
Displaying Data on the Map
To display the newly created data set on the map:
1.
Create an H.clustering.Provider object that runs the clustering algorithm and groups data
points, depending on their screen density
2.
Use H.map.layer.ObjectLayer to add the clustered objects on the map.
The code below implements both steps:
/**
* Assuming that 'dataPoints' and 'map'
* is initialized and available, create a data provider:
*/
var clusteredDataProvider = new H.clustering.Provider(dataPoints);
// Create a layer that includes the data provider and its data points:
var layer = new H.map.layer.ObjectLayer(clusteredDataProvider);
// Add the layer to the map:
map.addLayer(layer);
Maps API for JavaScript Developer's Guide
► Guide
70
When executed, this code produces the effect shown in the map image below: a green marker
indicating a cluster that combines two data points is placed south east of London and two blue noise
points can be seen close to the southern side of the English Channel.
Figure 26: Clustering (initial view)
Zooming out causes all the data points to collapse into the single cluster point:
Figure 27: Clustering at lower zoom
The configurable options on H.clustering.Provider allow you to fine-tune cluster creation. The
class contains properties that determine the visual representation of clusters and noise points, the
Maps API for JavaScript Developer's Guide
► Guide
71
maximum radius within which data points are considered as part of a cluster and the minimum weight
required to form a cluster.
The following example shows a cluster provider initialized with the parameters eps and minWeight.
eps holds the value of the radius within which data points are considered for clustering, while
minWeight holds the cumulative weight that points lying close to another must reach or exceed to
be clustered. The value of minWeight is 3 in the example, which means that three points, each with
the weight of one or two data points with the weight of 2 and 1, respectively, form a cluster.
var clusteredDataProvider = new H.clustering.Provider(dataPoints, {
min: 4,
max: 10,
clusteringOptions: {
eps: 32,
minWeight: 3
}
});
Theming
Clusters and noise points are represented on the map by markers. Unless otherwise configured,
the clustering provider uses the default bitmap markers theme with weight information to display
clusters and noise points on the map. You can define your own custom theme and pass it to the
provider as the theme property. A custom theme is defined in an object that implements the
interface H.clustering.ITheme as demonstrated by the code bellow.
// SVG template to use for noise icons
var noiseSvg = '<svg xmlns="http://www.w3.org/2000/svg" height="20px" width="20px"><circle
cx="5px" cy="5px" r="5px" fill="green" /></svg>';
// Create an icon to represent the noise points
// Note that same icon will be used for all noise points
var noiseIcon = new H.map.Icon(noiseSvg, {
size: { w: 20, h: 20 },
anchor: { x: 10, y: 10},
});
// SVG template to use for cluster icons
var clusterSvgTemplate = '<svg xmlns="http://www.w3.org/2000/svg" height="{diameter}"
width="{diameter}">' +
'<circle cx="{radius}px" cy="{radius}px" r="{radius}px" fill="red" />' +
'</svg>';
// Create a clustered data provider and a theme implementation
var clusteredDataProvider = new H.clustering.Provider(dataPoints, {
theme: {
getClusterPresentation: function(cluster) {
// Use cluster weight to change the icon size
var weight = cluster.getWeight(),
// Calculate circle size
radius = weight * 5,
diameter = radius * 2,
// Replace variables in the icon template
svgString = clusterSvgTemplate.replace(/\{radius\}/g, radius).replace(/\{diameter
\}/g, diameter);
// Create an icon
Maps API for JavaScript Developer's Guide
► Guide
// Note that we create a different icon depending from the weight of the cluster
clusterIcon = new H.map.Icon(svgString, {
size: {w: diameter, h: diameter},
anchor: {x: radius, y: radius}
}),
// Create a marker for the cluster
clusterMarker = new H.map.Marker(cluster.getPosition(), {
icon: clusterIcon,
// Set min/max zoom with values from the cluster, otherwise
// clusters will be shown at all zoom levels
min: cluster.getMinZoom(),
max: cluster.getMaxZoom()
});
// Bind cluster data to the marker
clusterMarker.setData(cluster);
return clusterMarker;
},
getNoisePresentation: function(noisePoint) {
// Create a marker for noise points:
var noiseMarker = new H.map.Marker(noisePoint.getPosition(), {
icon: noiseIcon,
// Use min zoom from a noise point to show it correctly at certain zoom levels
min: noisePoint.getMinZoom()
});
// Bind noise point data to the marker:
noiseMarker.setData(noisePoint);
return noiseMarker;
}
}
});
The result of providing a custom theme for four data points used in previous examples is shown in
the following image, where cluster markers are red circles and noise points are green:
Figure 28: Clustering custom theme
72
Maps API for JavaScript Developer's Guide
► Guide
73
Interacting with markers
It is possible to interact with markers representing clusters and noise points and access cluster or
noise point data on demand by using map events. To achieve that, add an event listener for the
event type you would like it to process to the clustering provider. In the following code, the listener
is registered to handle tap events, and because it is added to the clustering provider, it receives
only the tap events whose targets are the points in the provider's data set, including clusters. (The
code assumes that the map has been initialized and that map events – Map Events on page 23 – are
enabled).
var clusteredDataProvider = new H.clustering.Provider(dataPoints);
var layer = new H.map.layer.ObjectLayer(clusteredDataProvider);
map.addLayer(layer);
// Add an event listener to the Provider - this listener is called when a maker
// has been tapped:
clusteredDataProvider.addEventListener('tap', function(event) {
// Log data bound to the marker that has been tapped:
console.log(event.target.getData())
});
Maps API for JavaScript Developer's Guide
► Guide
74
Metainfo
HERE Maps API for JavaScript provides a Metainfo layer that provides information about objects
visible on the map, for example, buildings, stations, labels, etc. The Metainfo layer can be used to
enrich the map experience by highlighting buildings or street names, or displaying the names of POIs.
The metaInfo layer uses the Map Tile API.
The code example below implements a simple use case involving the Mapinfo layer in which the map
user can cap on map objects to view information about them. The code:
1.
Adds the Metainfo layer to the map.
2.
Registers a tap event listener with the tile provider responsible for the MetaInfo layer.
The listener is a callback function to be invoked when the map user taps on a map (spatial) object, for
example a marker. It retrieves the object from the event passed to it and outputs information about
the object to the console.
Please bear in mind that all objects are transparent by default, but they remain interactive.
/**
* Assuming that "map" and "platform" are already initialized
*/
// Create default map layers:
var defaultLayers = platform.createDefaultLayers();
// Add metaInfo layer to the map:
map.addLayer(defaultLayers.normal.metaInfo);
// Store a reference to the metaInfo TileProvider:
var tileProvider = defaultLayers.normal.metaInfo.getProvider();
// Subscribe to tap events on all objects of the metaInfo provider:
tileProvider.addEventListener('tap', function (e) {
// Save a reference to the clicked spatial object:
var spatial = e.target;
// Output meta data for the spatial object to the console:
console.log(spatial.getData());
});
The example above uses the Metainfo layer with default settings that filter out building outlines.
However, the API allows you to change the filter settings and make use of buildings data (including
building outlines). The code below extends the initial steps from the previous examples by:
1.
Obtaining a service object for the Metainfo layer.
2.
Using the service to create a tile layer that defines:
•
•
the required map tile size
the tile pixel ration
Maps API for JavaScript Developer's Guide
► Guide
•
75
an array of information category names to be excluded – in this case the array is empty to
indicate that all information is to be included
/**
* Assuming that "map" and "platform" are already initialized
*/
// Get the Metainfo service object from the platform:
var metainfoService = platform.getMetaInfoService();
// Create a tile layer with an empty array (this means all categories are included filtered
out categories:
var metainfoLayer = metainfoService.createTileLayer(/**tile size*/256,
/** tile pixel ratio*/1, []);
// Add the Metainfo layer to the map:
map.addLayer(metainfoLayer);
Additionally, the base map and the corresponding Metainfo layer can be configured to provide
information about points of interest (POIs) such as banks, restaurants, government buildings, etc.
The following code shows how to configure map layers to fetch this data and to display the POI name
in an info bubble. The code:
1.
Creates the default map layers, including the POI layer.
2.
Adds the Metainfo layer to the map.
3.
Obtains the tile provider object and adds a listener function for pointerdown events to it.
The listener function:
1.
Retrieves the spatial object on which the map user clicked.
2.
Gets the meta data associated with the spatial object.
3.
Obtains the geographic coordinates of the object (converts screen coordinates to latitude and
longitude).
4.
Displays an info bubble with the name of the object on the screen at the location on which the
map user clicked.
/**
* Assuming that "map", "ui" and "platform" are already initialized
*/
// Create default map layers with POIs present:
maptypes = platform.createDefaultLayers(256, 320, false, false, null, /*pois*/ true);
// Add metainfo layer to the map:
map.addLayer(maptypes.normal.metaInfo);
// Store a reference to the metaInfo TileProvider:
var tileProvider = defaultLayers.normal.metaInfo.getProvider();
// Add a listener for pointerdown events -- it displays an info bubble with the POI
// name when the map user clicks on the POI:
tileProvider.addEventListener('pointerdown', function(e) {
// Get the spatial object on which the user clicked:
var spatial = e.target,
// Get the meta data for the object:
metadata = spatial.getData(),
Maps API for JavaScript Developer's Guide
► Guide
76
// Translate the screen coordinates of the click to lat/lon:
coord = map.screenToGeo(e.currentPointer.viewportX, e.currentPointer.viewportY);
// Display an info bubble with the name of the object at the location of the click:
if (metadata.category === 'POIs') {
var bubble = new H.ui.InfoBubble(coord, {content : metadata.name});
ui.addBubble(bubble);
}
});
The image below shows the observable effects of this code on the map.
Figure 29: Map with POIs and additional data fetched by the MetaInfo layer.
Venues
When you plan a trip or arrange to meet with friends, there is a good chance that your destination is
indoors. For example, it could be in a large multi-storey shopping mall, with shops, movie theaters
and restaurants. Once there, you may want to know what else is there and how to find it. A map of the
location could save a lot of time, and it would be nice to share it .
Maps API for JavaScript Developer's Guide
► Guide
77
The HERE Venue Maps API provides access to more than 10,000 venues around the world through
PNG/JS tiles including floor levels or full JSON models, including polygons/geometry, connectors
(elevators/escalators), access points (entry/exit doorways) and store/POI information.
All these features can be accessed through the service module (mapsjs-service.js) in the Maps
API for JavaScript for easy integration into a map application.
The simple example below shows how to display the venue layer on the map. The code:
1.
Obtains an instance of Platform.
2.
Gets the HTML element that acts as the map container.
3.
Obtains the an object with the default map layers.
4.
Instantiates the map, with the default layers and setting the map zoom and center.
5.
Adds the venue layer to the map.
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Retrieve the map container (map target element):
var targetElement = document.getElementById('mapContainer');
// Get the default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map:
var map = new H.Map(
document.getElementById('mapContainer'),
defaultLayers.normal.map,
{
zoom: 19,
center: { lat: 51.513807, lng: -0.127183 }
});
// Add the venue layer to the map:
map.addLayer(defaultLayers.venues);
Maps API for JavaScript Developer's Guide
► Guide
The image below shows the result of executing this code.
Figure 30: Venues layer on a map
Object Hierarchy
The venue layer displayed on the map encapsulates a hierarchy of objects with information about
venues.
78
Maps API for JavaScript Developer's Guide
► Guide
79
The root is Venue. It contains one or more Buildings, which hold Floors.
Each Floor holds raw data associated with it that can be retrieved by calling the method
getData(). For more details, see HERE Venue Maps API documentation, specifically Floor
IATileMember.
A Floor contains one or more Space objects. Each Space holds raw data associated with that space
that can be retrieved by calling the method getData(). For more details on data format see HERE
Venue Maps API documentation about Space IATileMember.
The figure below represents this hierarchy graphically.
Figure 31: Venues Object Hierarchy
Each floor has a special space called "floor space", which represents the footprint of the floor. It can
be retrieved by calling the method getFloorSpace(). You can use it to style the areas of the floor
not covered by other spaces.
Space inherits from H.map.Object, therefore you can use the methods setVisibility() or
setStyle() as with any other map objects.
Venue, Building and Floor inherit from the H.map.Group.
Maps API for JavaScript Developer's Guide
► Guide
80
It is possible to attach event listeners to the map in order to handle user interaction with Space
instances. For example, you can implement specific behavior in response to tap and hover events
related to a Space. This is shown in the code below, which defines:
•
A tap listener – outputs Space-related data to the console
•
A pointermove listener – highlights a floor by putting a black border around it when the (mouse)
pointer moves over it
// We assume that map was properly initalized and venue layer was added
// Log space information on "tap" event:
map.addEventListener('tap', function(e) {
// Make sure we are dealing with Space objects:
if (e.target instanceof H.service.venues.Space) {
console.log(e.target.getData());
}
});
// Highlight the space on "pointermove"
map.addEventListener('pointermove', function(e) {
var space = e.target;
// Make sure we are dealing with Space objects:
if (space instanceof H.service.venues.Space) {
// Highlight the space by showing 2px black outline
// Calling "getCopy" is necessary as long as we want to keep the
// original styling properties such as fillColor untouched:
space.setStyle(space.getStyle().getCopy({
lineWidth: 2,
strokeColor: 'rgba(0,0,0,0.5)'
}));
}
});
Changing Colors and Getting Venue Information
The Maps API for JavaScript allows you to apply different visual styles to floor spaces, depending, for
example, on category or id. You can see this in the code below, which:
•
•
•
Instantiates the Platform class.
Obtains an instance of the Venue service.
Creates a Venue tile layer with a callback that, for each new space:
•
•
sets the color for a space identified as "Consumer Electronics Store"
◦
highlights a 'target shop' by changing the color of its label
◦
Adds the tile layer to the map.
Obtains a venue provider and uses it to change the floor level (and thus moves to the next floor).
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Get an instance of the venue service:
var venueService = platform.getVenueService();
Maps API for JavaScript Developer's Guide
► Guide
81
// Create venue layer with desired customizations:
var customVenueLayer = venueService.createTileLayer({
// This callback is called each time space is created on the map:
onSpaceCreated: function(space) {
// Note that you can style spaces according to their category,
// venue category or id
var id = space.getFloor().getBuilding().getId(),
spaceData = space.getData(),
categoryId = spaceData && spaceData.category && spaceData.category.id;
// If space has a category "Consumer Electronics Store"
// See http://developer.here.com/rest-apis/documentation/venue-maps/topics/resourcecategories.html
if (categoryId === '9987') {
// 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)'
}));
}
// Change the label color of desired shop:
if (id === 'MY_SHOP_ID') {
space.initLabelStyle({
fillColor: 'rgba(41,165,74,0.8)'
});
}
}
});
// Add custom venue layer to the map:
map.addLayer(customVenueLayer);
// Get TileProvider from our custom venue layer:
var venueProvider = customVenueLayer.getProvider();
// Increment floor level:
venueProvider.setCurrentLevel(venueProvider.getCurrentLevel() + 1);
Changing the Floor Level
The code in the previous section demonstrated not just how to apply different styles to floor spaces,
but also how to move to the next floor level. Of course, you can also, simply set the floor level, which
mean "move to a specific floor" in a venue. This is shown in the following code:
// Instantiate a map and platform object:
var platform = new H.service.Platform({
'app_id': '<your app id>',
'app_code': '<your app code>'
});
// Get default map types from the platform object:
var defaultLayers = platform.createDefaultLayers();
// Add venue layer to the map:
map.addLayer(defaultLayers.venues);
// Get TileProvider from the venue layer:
var venueProvider = defaultLayers.venues.getProvider();
// Set floor level:
Maps API for JavaScript Developer's Guide
► Guide
82
venueProvider.setCurrentLevel(-1);
Figure 32: Parking level of the Alexa shopping center in Berlin
Note that when you set the floor level, the value applies to the venue provider object, in other words,
to all the venues on the map and not for each building specifically. Therefore, if you set the floor level
to 10 and a building on the map has levels from -2 to 5, level 10 is not be visible, because it cannot
be shown.
You can show venue locations on the map as markers regardless of the current selected floor level
by using the discovery service. For more details, see HERE Venue Maps API documentation about
Discovery Service.
Maps API for JavaScript Developer's Guide
► Guide
83
KML Support
Because creating content on top of a map is time consuming, most developers look to standards to
help them transfer content between platforms seamlessly. They typically use KML, which captures
data in XML. For further information, please visit the KML page of the Open Geospatial Consortium.
The KML specification supports a variety of objects, such as Placemarks, images and Polygons. Many
KML objects have counterparts in the HERE Maps API for JavaScript. To translate KML objects to map
objects, use the data module in the Maps API (mapsjs-data.js).
The Reader class in the data module loads KML from a file and parses it. Further, the class has a
utility method that creates a map layer, using the parsed KML data. The layer can be added directly
to the map. All map objects receive regular map events (see Map Events on page 23) and can contain
additional data, such as name and description (if the data are present in the KML document).
<script type="text/javascript" charset="utf-8">
// Create reader object initializing it with a document:
var reader = new H.data.kml.Reader('path/to/kml/file.kml'),
// Parse the document:
reader.parse();
// Get KML layer from the reader object and add it to the map:
layer = reader.getLayer();
map.addLayer(layer);
// KML objects receive regular map events, so add an event listener to the
// KML layer:
layer.getProvider().addEventListener('tap', function(ev) {
// Log map object data. They contain name, description (if present in
// KML) and the KML node itself.
console.log(ev.target.getData());
});
</script>
The HERE Maps API supports the import of KML files and data sets compliant with versions 2.1 and
2.2 of the KML standard. There are only a small number of features that the Maps API does not as yet
support, for example, 3D buildings. The imported data are interpreted in the best way possible and
any unsupported features in the KML data structure are ignored.
Maps API for JavaScript Developer's Guide
► Guide
The image below shows data imported from KML and rendered on a satellite map by the Maps API.
Figure 33: KML data rendered on a satellite map
84
Maps API for JavaScript Developer's Guide
► Guide
85
Best Practices
The article outlines a number best-practises aiming to help you use the HERE Maps API for JavaScript
in the most efficient way and implement the optimal map responsiveness.
Icon Reuse
Maps API for JavaScript The H.map.Icon class represents a reusable visual map marker. To optimize
map performance, reuse an icon instance in as many marker objects as possible, instead of creating a
new H.map.Icon instance for each marker.
The following code creates a new icon object for each new marker – this is the practise to avoid:
// Array of anchor points for markers
var points = [...],
markers = [];
for (var i = 0; i < points.length; i++) {
markers.push(new H.map.Marker(points[i], {
// A new identical Icon instance is created at each iteration
// of the loop - do not do this:
icon: new H.map.Icon('graphics/markerHouse.png')
}));
}
A more efficient way to accomplish the same task is to reuse the single H.map.Icon instance across
all H.map.Marker instances as shown in this code:
// Array of anchor points for markers
var points = [...],
markers = [],
// Create single Icon instance
icon = new H.map.Icon('graphics/markerHouse.png');
for (var i = 0; i < points.length; i++) {
markers.push(new H.map.Marker(points[i], {
// Reuse the Icon instance:
icon: icon
}));
}
The approach demonstrated above offers better performance and a lower memory footprint.
Note: When you need to display a large number of map markers, consider marker clustering.
Keep onAttach and onDetach Callbacks Simple
When using DomMarker, you may wish to pass onAttach and onDetach options to the DomIcon
constructor to add event listeners for all DomMarkers utilizing the DomIcon instance.
Maps API for JavaScript Developer's Guide
► Guide
86
Keep in mind that those callbacks are called each time the DomMarker appears on the map or
disappears from the map viewport. For this reason, it is crucial not to perform any expensive
computations in those callbacks, otherwise map panning and zooming performance may noticeably
degrade. The example below uses code that causes such performance degradation – this is the
practise to avoid:
// Assume that domElement is an already defined DOM element
// and contains a large number of children:
var domIcon = new H.map.DomIcon(domElement, {
onAttach: function(clonedElement, domIcon, domMarker) {
// Avoid expensive computation inside onAttach
// Such as quering the DOM:
var defaultButton = clonedElement.querySelector('.btn-default');
var infoButton = clonedElement.querySelector('.btn-info');
defaultButton.addEventListener('click', onDefaultClick);
infoButton.addEventListener('click', onInfoClick);
},
onDetach: function(clonedElement, domIcon, domMarker) {
// Avoid expensive computation inside onDetach
// such as quering the DOM
var defaultButton = clonedElement.querySelector('.btn-default');
var infoButton = clonedElement.querySelector('.btn-info');
defaultButton.removeEventListener('click', onDefaultClick);
infoButton.removeEventListener('click', onInfoClick);
}
});
Make sure you compute all the required assets beforehand, or offload the computation from
onAttach()/onDetach() to event callbacks by using techniques such as event delegation
demonstrated in this code:
// Use event bubbling to handle all events on the parent node itself,
// and perform computations only when needed.
function onMarkerClick(e) {
var targetClassName = e.target.className;
if (targetClassName === 'btn-default') {
onDefaultClick(e);
} else if (targetClassName === 'btn-info') {
onInfoClick(e);
}
}
var domIcon = new H.map.DomIcon(domElement, {
onAttach: function(clonedElement, domIcon, domMarker) {
// Simply subscribe to the event:
domElement.addEventListener('click', onMarkerClick);
},
onDetach: function(clonedElement, domIcon, domMarker) {
// Simply unsubscribe from the event:
domElement.removeEventListener('click', onMarkerClick);
}
});
Prefer mapviewchangeend Event to mapviewchange
The events mapviewchange and mapviewchangeend seem similar – both can be used for handling
changes to the map viewport – but they are not the same. mapviewchange is called on each
Maps API for JavaScript Developer's Guide
► Guide
87
animation step in the process of changing a state of the viewport. In many cases, this appears to be
excessive. For example, updating a UI element with the current zoom level twenty times each time
the user double-clicks on the map is inefficient.
// Displays current zoom level to the end user:
function displayZoomLevel() {...}
// A listener updates the map zoom level on each map view change
// -- this occurs more than 20 times on a double-click on the map,
// inefficient and to be avoided:
map.addEventListener('mapviewchange', function () {
var zoom = map.getZoom();
// This function is called more than 20 times on a double-click on the map!
displayZoomLevel(zoom);
});
mapviewchangeend on the other hand is called only once, when the viewport change is complete,
therefore it is a better event on which to implement an update:
/*
Displays current zoom level to the end user
*/
function displayZoomLevel() {...}
// A listener updates the map zoom level -- it is called once when the map
// view change is complete.
map.addEventListener('mapviewchangeend', function () {
var zoom = map.getZoom();
// The function that displays the zoom level is called only once,
// after zoom level changed
displayZoomLevel(zoom);
});
mapviewchangeend event is a 'debounced' version of the mapviewchange, so, as a rule, it is more
efficient to use mapviewchangeend.
Use Built-in Animation Capabilities
If you need to animate a transition between different map states, for example a transition resulting
from a map center change, a zoom change or both, always try to use built-in animation capabilities in
the map engine.
Map instance methods such as setZoom(), setCenter() and setViewBounds() all accept a
second argument, which indicates weather animated transition should be applied.
So instead of animating zoom change on your own as in this code:
// Assumption: 'map' is initialized and available.
var currentZoom = map.getZoom();
var endZoom = currentZoom + 3;
// Update zoom level on each animation frame,
// till we reach endZoom:
function step() {
currentZoom += 0.05;
Maps API for JavaScript Developer's Guide
► Guide
88
map.setZoom(currentZoom);
(currentZoom < endZoom) && requestAnimationFrame(step);
}
// Start zoom animation
step();
... call the method setZoom() with an optional second parameter to perform an animation as
demonstrated by the code below:
/**
* Assumption: 'map' is initialized and available
*/
// Call getZoom() with an optional second parameter,
// indicating that an animation is to be performed:
map.setZoom(map.getZoom() + 3, true);
SpatialStyle Is Read Only
Instances of SpatialStyle are intended to be used as read-only objects. Modifying their properties
is not safe and may lead to visual inconsistencies.
Consider an example of reusing SpatialStyle of one Spatial object on another, which is
absolutely valid, because we do not modify it.
// Assumption: 'spatial1' and 'spatial2' are initialized and available.
// Get current style of the first spatial:
var style = spatial1.setStyle();
// Reusing an existing SpatialStyle object is fine,
// because we are not modifying it:
spatial2.setStyle(style);
Now lets imagine that we want to reuse a style from one Spatial on another, but with a single
fillColor modification. Modifying an object returned by getStyle method can have nondeterministic result on a visual representation of the first spatial.
// Assumption: 'spatial1' and 'spatial2' are initialized and available.
// Get current style of the first spatial:
var style = spatial1.getStyle();
// Modification of a SpatialStyle object -- never do this
style.fillColor = 'red';
// If we now apply the modified style to the second spatial, the results may be
// inconsistent -- sometimes the fillColor change takes effect, but not always!
spatial2.setStyle(style);
The correct way is to change the style, is to create a new SpatialStyle object or to use the method
getCopy() method on an existing object as shown in this code example:
/**
* Assumption: 'spatial1' and 'spatial2' are initialized and available.
*/
// Get the current style of the first spatial and get an extended version
Maps API for JavaScript Developer's Guide
► Guide
89
// by calling getCopy() method on it
var style = spatial1.setStyle().getCopy({
fillColor: 'red'
});
// Now changing the style of the second class is completely safe and
// produces the expected results consistently:
spatial2.setStyle(style);
So the general rule is, it is safe and to reuse an existing SpatialStyle object multiple times, but if
you need to modify it, use getCopy() or construct a new one.
Service Support
If you need assistance with this or other HERE products, please contact your HERE representative or
Technical Customer Support.
Maps API for JavaScript Developer's Guide
► API Reference
90
Chapter
4
API Reference
Topics:
•
Namespace: H
This section provides descriptions of the resources, parameters,
return types and error codes of the HERE Maps API for JavaScript.
Maps API for JavaScript Developer's Guide
► API Reference
91
Namespace: H
Namespace Summary
HERE Maps for Javascript
Namespace Description
HERE Maps for Javascript
Class: Map
This class is a member of the namespace
H .
Class Summary
Extends: H.util.EventTarget
Map class defines map instance in the application. By creating this object you will initialize a visible
map object which is attached to the provided dom element. Map class is an entry point to all
operations related to layers, map objects and geo-screen transformations. By specifying options you
can initialize map with predefined view.
[ For full details, see the Class Details ]
Method Summary
Table 8: Methods
Methods
getElement () : {Element}
This method returns the map root html element
setCenter (center, opt_animate) : {H.Map}
This method sets the new center on a map.
getCenter () : {H.geo.Point}
This method returns currently rendered center of the map.
setZoom (zoom, opt_animate) : {H.Map}
Maps API for JavaScript Developer's Guide
► API Reference
92
Methods
This method sets the zoom level on the map. Every zoom level represents different scale i.e map at zoom level 2 is twice as
large as the map at zoom level 1.
getZoom () : {number}
This method returns currently rendered zoom level.
zoomAt (zoom, x, y)
This method changes the map zoom while keeping target screen coordinates specified as x,y at the same place where they
were before.
setViewBounds (boundingRect, opt_animate) : {H.Map}
This method sets the bounding rect to be displayed by the map. Maps display the bounding rect in a way that it fits entirely in
the current viewport.
getViewBounds () : {H.geo.Rect}
This method returns bounding rect for the current map view. Returned bounding rect defines entire currently viewable area
on the screen.
getCameraDataForBounds (rect) : {H.map.ViewModel.CameraData}
Calculates the best CameraModel to show the provided bounding rectangle
getViewPort () : {H.map.ViewPort}
This method returns current map viewport. Viewport can be used to modify padding and margin which will reflect the
position of the viewport center and the amount of extra data loaded (for margin)
getViewModel () : {H.map.ViewModel}
This method returns current view model. View model can be used to modify the current view or camera. H.map.ViewModel
getLayers () : {H.map.DataModel}
This method returns the map's current layer collection.
getImprint () : {H.map.Imprint}
This method returns the imprint object for this map.
capture (callback, opt_capturables, opt_x1, opt_y1, opt_x2, opt_y2)
This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. Origin of
coordinate system for capturing is in the top left corner of the viewport.
setEngineType (type) : {H.Map}
This method sets the rendering engine type for the map. Rendering engine is responsible for displaying i.e tiles and data on
the map.
addLayer (layer, opt_idx) : {H.Map}
This method adds a layer to the map.
Maps API for JavaScript Developer's Guide
► API Reference
93
Methods
removeLayer (layer) : {H.Map}
This method removes layer from the map.
setBaseLayer (layer) : {H.Map}
This method will set provided layer as base map. The layer will be inserted as the bottom most layer in the map.
getBaseLayer () : {?H.map.layer.Layer}
To get the current base map layer.
geoToScreen (geoPoint) : {H.math.Point}
Returns the screen coordinates according to the given geographical coordinates. This method returns a screen pixel
coordinates for the provided geo point.
screenToGeo (x, y) : {H.geo.Point}
Returns the geographical coordinates according to the given screen coordinates.
screenToCameraData (x, y) : {H.map.ViewModel.CameraData}
Returns the camera data according to the given screen coordinates. Method converts screen pixel coordinates to correct
camera data object
addObject (mapObject) : {!H.map.Object}
This method adds an map object to the map. Map object can be a marker or a spatial object like polygon or polyline.
removeObject (mapObject) : {!H.map.Object}
This method removes previously added map object from the map.
getObjects () : {Array<H.map.Object>}
This method retrieves the list of all objects which have been added to the map.
addObjects (mapObjects) : {H.Map}
This method adds an array of objects or an object group to the map.
removeObjects (mapObjects) : {H.Map}
This method removes an array of object or an object group from the map.
getObjectAt (x, y) : {?H.map.Object}
Returns the top most z-ordered map object found under the specific screen coordinates. Coordinates are viewport pixel
coordinates starting from top left corner as (0, 0) point.
getObjectsAt (x, y) : {Array<!H.map.Object>}
Returns a list of map objects in descending z-order found under the specific screen coordinates. Coordinates are viewport
pixel coordinates starting from top left corner as (0, 0) point.
onceEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
94
Methods
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 9: Events
Events
mapviewchangestart : {H.util.Event}
Fired when changes of this map's view are starting
mapviewchange : {H.map.ChangeEvent}
Fired when changes of this map's view are ongoing
mapviewchangeend : {H.util.Event}
Fired when changes of this map's view are ending
baselayerchange : {H.util.ChangeEvent}
Fired when this map's base layer changes
enginechange : {H.util.ChangeEvent}
Fired when this map's engine changes i.e when entering panorama. Event holds references to old and new engine type.
Class Description
Map class defines map instance in the application. By creating this object you will initialize a visible
map object which is attached to the provided dom element. Map class is an entry point to all
Maps API for JavaScript Developer's Guide
► API Reference
95
operations related to layers, map objects and geo-screen transformations. By specifying options you
can initialize map with predefined view.
Example
var platform = new H.service.Platform({
app_id: "{your app id}",
app_code: "{your app code}"
});
var maptypes = platform.createDefaultLayers();
var map = new H.Map(document.getElementById('mapdiv'),
maptypes.normal.map, {
center: new H.geo.Point(0, 51),
zoom: 8
});
Constructor Details
H.Map(element, baseLayer, opt_options)
Parameters:
element:
{Element}
html element into which the map will be rendered
baseLayer:
{H.map.layer.Layer}
The layer to be used as the base (bottom most) layer.
opt_options:
{H.Map.Options=} [optional]
additional map options
Method Details
getElement () : {Element}
This method returns the map root html element
Returns:
{Element}
setCenter (center, opt_animate) : {H.Map}
This method sets the new center on a map.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
center:
{H.geo.IPoint}
requested center to be set
opt_animate:
{boolean=} [optional]
parameter indicates if animated transition should be applied, default is
96
false
Returns:
{H.Map}
the instance itself
getCenter () : {H.geo.Point}
This method returns currently rendered center of the map.
Returns:
{H.geo.Point}
setZoom (zoom, opt_animate) : {H.Map}
This method sets the zoom level on the map. Every zoom level represents different scale i.e map at
zoom level 2 is twice as large as the map at zoom level 1.
Parameters:
zoom:
{number}
requested zoom level
opt_animate:
{boolean=} [optional]
parameter indicates if animated transition should be applied, default is
false
Returns:
{H.Map}
the instance itself
getZoom () : {number}
Maps API for JavaScript Developer's Guide
► API Reference
97
This method returns currently rendered zoom level.
Returns:
{number}
zoomAt (zoom, x, y)
This method changes the map zoom while keeping target screen coordinates specified as x,y at the
same place where they were before.
Parameters:
zoom:
{number}
new zoom level
x:
{number}
map viewport x-axis pixel coordinate
y:
{number}
map viewport y-axis pixel coordinate
setViewBounds (boundingRect, opt_animate) : {H.Map}
This method sets the bounding rect to be displayed by the map. Maps display the bounding rect in a
way that it fits entirely in the current viewport.
Parameters:
boundingRect:
{H.geo.Rect}
view bound which should be shown on map
opt_animate:
{boolean=} [optional]
parameter indicates if animated transition should be applied, default is
false
Returns:
{H.Map}
the instance itself
getViewBounds () : {H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
98
This method returns bounding rect for the current map view. Returned bounding rect defines entire
currently viewable area on the screen.
Returns:
{H.geo.Rect}
getCameraDataForBounds (rect) : {H.map.ViewModel.CameraData}
Calculates the best CameraModel to show the provided bounding rectangle
Parameters:
rect:
{H.geo.Rect}
The geographical bounding rectangle to use
Returns:
{H.map.ViewModel.CameraData}
The result, represented by the properties zoom (number) and position
(geo.Point)
getViewPort () : {H.map.ViewPort}
This method returns current map viewport. Viewport can be used to modify padding and margin
which will reflect the position of the viewport center and the amount of extra data loaded (for margin)
Returns:
{H.map.ViewPort}
getViewModel () : {H.map.ViewModel}
This method returns current view model. View model can be used to modify the current view or
camera. H.map.ViewModel
Returns:
{H.map.ViewModel}
getLayers () : {H.map.DataModel}
This method returns the map's current layer collection.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
99
{H.map.DataModel}
getImprint () : {H.map.Imprint}
This method returns the imprint object for this map.
Returns:
{H.map.Imprint}
capture (callback, opt_capturables, opt_x1, opt_y1, opt_x2, opt_y2)
This method captures desired region of the map and objects on it. Result is returned as an HTML5
Canvas element. Origin of coordinate system for capturing is in the top left corner of the viewport.
In order to see the "capturable" UI controls in the output, pass in a reference to H.ui.UI object. At the
moment only H.ui.ScaleBar ui element supports the feature.
Note, that instances of H.map.Icon will taint the output canvas if images from different origin were
used. For cases when image source sets CORS headers H.map.Icon supports flag that enables
image loading with cross origin parameters. Internet Explorer always taints the canvas element when
svg images are used. CORS support for images starts only from IE11.
Example
var map = new H.Map(mapContainer, defaultLayers.normal.map, {
center: {lat: -40, lng: 178},
zoom: 2
});
var ui = H.ui.UI.createDefault(map, defaultLayers);
map.capture(function(canvas) {
// Here we've got the canvas with desired area of the map,
// (from top left (0,0) corner to the bottom right (100,100) corner)
}, [ui], 0, 0, 100, 100);
Parameters:
callback:
{function(HTMLCanvasElement=)}
Callback function to call once result of the capturing is ready
opt_capturables:
{Array<H.util.ICapturable>=} [optional]
Collection of "capturable" element(s) to draw into the resulting canvas
opt_x1:
{number=} [optional]
The X coordinate of the left edge of the capturing rectangle defaults to 0
Maps API for JavaScript Developer's Guide
► API Reference
100
opt_y1:
{number=} [optional]
The Y coordinate of the top edge of the capturing rectangle defaults to 0
opt_x2:
{number=} [optional]
The X coordinate of the right edge of the capturing rectangle defaults to
viewport width
opt_y2:
{number=} [optional]
The Y coordinate of the bottom edge of the capturing rectangle defaults to
viewport height
setEngineType (type) : {H.Map}
This method sets the rendering engine type for the map. Rendering engine is responsible for
displaying i.e tiles and data on the map.
Parameters:
type:
{H.Map.EngineType}
Returns:
{H.Map}
the map itself
addLayer (layer, opt_idx) : {H.Map}
This method adds a layer to the map.
Parameters:
layer:
{H.map.layer.Layer}
The map layer to be added
opt_idx:
{number=} [optional]
index at which the new layer should be inserted
Returns:
{H.Map}
current map instance
Maps API for JavaScript Developer's Guide
► API Reference
101
removeLayer (layer) : {H.Map}
This method removes layer from the map.
Parameters:
layer:
{H.map.layer.Layer}
The map layer to be removed
Returns:
{H.Map}
current map instance
setBaseLayer (layer) : {H.Map}
This method will set provided layer as base map. The layer will be inserted as the bottom most layer
in the map.
Parameters:
layer:
{H.map.layer.Layer}
The layer to use as base map
Returns:
{H.Map}
the instance itself
getBaseLayer () : {?H.map.layer.Layer}
To get the current base map layer.
Returns:
{?H.map.layer.Layer}
geoToScreen (geoPoint) : {H.math.Point}
Returns the screen coordinates according to the given geographical coordinates. This method
returns a screen pixel coordinates for the provided geo point.
Parameters:
geoPoint:
{H.geo.IPoint}
Maps API for JavaScript Developer's Guide
► API Reference
point on the map
Returns:
102
{H.math.Point}
screenToGeo (x, y) : {H.geo.Point}
Returns the geographical coordinates according to the given screen coordinates.
Parameters:
x:
{number}
map viewport x-axis pixel coordinate
y:
{number}
map viewport y-axis pixel coordinate
Returns:
{H.geo.Point}
screenToCameraData (x, y) : {H.map.ViewModel.CameraData}
Returns the camera data according to the given screen coordinates. Method converts screen pixel
coordinates to correct camera data object
Parameters:
x:
{number}
map viewport x-axis pixel coordinate
y:
{number}
map viewport y-axis pixel coordinate
Returns:
{H.map.ViewModel.CameraData}
addObject (mapObject) : {!H.map.Object}
This method adds an map object to the map. Map object can be a marker or a spatial object like
polygon or polyline.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
mapObject:
{!H.map.Object}
The map object to add
Returns:
103
{!H.map.Object}
the added map object
removeObject (mapObject) : {!H.map.Object}
This method removes previously added map object from the map.
Parameters:
mapObject:
{!H.map.Object}
The map object to remove
Returns:
{!H.map.Object}
the removed map object
getObjects () : {Array<H.map.Object>}
This method retrieves the list of all objects which have been added to the map.
Note: The returned list should be used for read access only. Modifying the list directly can destroy
the integrity of this map's object model. Please use the map's addObject/addObjects and
removeObject/removeObjects methods.
Returns:
{Array<H.map.Object>}
the list of all use objects which are currently on the map.
addObjects (mapObjects) : {H.Map}
This method adds an array of objects or an object group to the map.
Note: Objects which were added to the map previously will not be added again.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
mapObjects:
{Array<!H.map.Object>}
Returns:
{H.Map}
the map instance
removeObjects (mapObjects) : {H.Map}
This method removes an array of object or an object group from the map.
Parameters:
mapObjects:
{(Array<H.map.Object> | H.map.Group)}
Returns:
{H.Map}
the map instance
getObjectAt (x, y) : {?H.map.Object}
Returns the top most z-ordered map object found under the specific screen coordinates.
Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point.
Parameters:
x:
{number}
map viewport x-axis pixel coordinate
y:
{number}
map viewport y-axis pixel coordinate
Returns:
{?H.map.Object}
the encountered top most map object or null if no object found
getObjectsAt (x, y) : {Array<!H.map.Object>}
104
Maps API for JavaScript Developer's Guide
► API Reference
Returns a list of map objects in descending z-order found under the specific screen coordinates.
Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point.
Parameters:
x:
{number}
map viewport x-axis pixel coordinate
y:
{number}
map viewport y-axis pixel coordinate
Returns:
{Array<!H.map.Object>}
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
105
Maps API for JavaScript Developer's Guide
► API Reference
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
106
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
107
opt_scope:
{Object=} [optional]
Event Details
mapviewchangestart: {H.util.Event}
Fired when changes of this map's view are starting
mapviewchange: {H.map.ChangeEvent}
Fired when changes of this map's view are ongoing
mapviewchangeend: {H.util.Event}
Fired when changes of this map's view are ending
baselayerchange: {H.util.ChangeEvent}
Fired when this map's base layer changes
enginechange: {H.util.ChangeEvent}
Fired when this map's engine changes i.e when entering panorama. Event holds references to old and
new engine type.
Type definition: BackgroundRange
This type definition is a member of the class
H.Map .
Type Definition Summary
It defines the number of lower and higher zoom levels, where cached content of the base map
is rendered while content of the current zoom level is still loading. Example: if range was set to
{lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached
tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12.
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
108
Property Summary
Table 10: Properties
Properties
lower
The number of lower zoom levels to take into account, default is 0
higher
The number of higher zoom levels to take into account, default is 0
Type Definition Description
It defines the number of lower and higher zoom levels, where cached content of the base map
is rendered while content of the current zoom level is still loading. Example: if range was set to
{lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached
tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12.
Property Details
lower: {number}
The number of lower zoom levels to take into account, default is 0
higher: {number}
The number of higher zoom levels to take into account, default is 0
Enumeration: EngineType
This enumeration is a member of the class
H.Map .
Enumeration Summary
Types of engines
[ For full details, see the Enumeration Details ]
Maps API for JavaScript Developer's Guide
► API Reference
109
Enumeration Constants Summary
Table 11: Constants
Constants
static
P2D
static
PANORAMA
Enumeration Details
Types of engines
Enumeration Constants Details
static P2D
static PANORAMA
Type definition: Options
This type definition is a member of the class
H.Map .
Type Definition Summary
This type defines options which can be used to initialize the map.
[ For full details, see the Type Definition Details ]
Property Summary
Table 12: Properties
Properties
center
The initial center of the map, default is {lat:0, lng: 0}
zoom
The initial zoom level of the map, default is 0 respectively the minimal zoom level of the base map
bounds
The view bounds to be displayed on the map. If provided, it takes precedence over center and zoom. and zoom if provided)
Maps API for JavaScript Developer's Guide
► API Reference
110
Properties
layers
A list of layers to render on top of the base map
engineType
The initial engine type to use, default is P2D
pixelRatio
The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1
imprint
The imprint options or null to suppress the imprint
renderBaseBackground
Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading.
Example: {lower: 3, higher: 2}
autoColor
Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the
copyright style will be adjusted. See H.map.layer.Layer.Options#dark
margin
The size in pixel of the supplemental area to render for each side of the map
padding
The padding in pixels for each side of the map
fixedCenter
Indicates whether the center of the map should remain unchanged if the viewport's size or padding has been changed,
default is true
Type Definition Description
This type defines options which can be used to initialize the map.
Property Details
center: {H.geo.IPoint=} [optional]
The initial center of the map, default is {lat:0, lng: 0}
zoom: {number=} [optional]
The initial zoom level of the map, default is 0 respectively the minimal zoom level of the base map
Maps API for JavaScript Developer's Guide
► API Reference
111
bounds: {H.geo.Rect=} [optional]
The view bounds to be displayed on the map. If provided, it takes precedence over center and zoom.
and zoom if provided)
layers: {Array<H.map.layer.Layer>=} [optional]
A list of layers to render on top of the base map
engineType: {H.Map.EngineType=} [optional]
The initial engine type to use, default is P2D
pixelRatio: {number}
The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1
imprint: {?H.map.Imprint.Options=} [optional]
The imprint options or null to suppress the imprint
renderBaseBackground: {H.Map.BackgroundRange=} [optional]
Object describes how many cached zoom levels should be used as a base map background while base
map tiles are loading. Example: {lower: 3, higher: 2}
autoColor: {boolean=} [optional]
Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up
to now only the copyright style will be adjusted. See H.map.layer.Layer.Options#dark
margin: {number=} [optional]
The size in pixel of the supplemental area to render for each side of the map
padding: {H.map.ViewPort.Padding=} [optional]
The padding in pixels for each side of the map
fixedCenter: {boolean=} [optional]
Indicates whether the center of the map should remain unchanged if the viewport's size or padding
has been changed, default is true
Namespace: clustering
Namespace Summary
This namespace contains classes and functionality to enable marker clustering.
Maps API for JavaScript Developer's Guide
► API Reference
Namespace Description
This namespace contains classes and functionality to enable marker clustering.
Class: DataPoint
This class is a member of the namespace
H.clustering .
Class Summary
Implements: H.geo.IPoint
This class represents the input data structure for data points to be clustered.
[ For full details, see the Class Details ]
Property Summary
Table 13: Properties
Properties
lat : {H.geo.Latitude}
The latitude coordinate of the data point's position
lng : {H.geo.Longitude}
The longitude coordinate of the data point's position
wt : {number}
The weight of the data point
data : {*}
Data associated with this data point
Class Description
This class represents the input data structure for data points to be clustered.
Constructor Details
H.clustering.DataPoint(lat, lng, opt_weight, opt_data)
Parameters:
lat:
{H.geo.Latitude}
112
Maps API for JavaScript Developer's Guide
► API Reference
113
The latitude coordinate of the data point's position
lng:
{H.geo.Longitude}
The longitude coordinate of the data point's position
opt_weight:
{number=} [optional]
The weight of the data point as a positive number > 0. If not specified it ,
default is 1.
opt_data:
{*=} [optional]
Optional data, which will be associated with this DataPoint
Property Details
lat: {H.geo.Latitude}
The latitude coordinate of the data point's position
lng: {H.geo.Longitude}
The longitude coordinate of the data point's position
wt: {number}
The weight of the data point
data: {*}
Data associated with this data point
Interface: ICluster
This interface is a member of the namespace
H.clustering .
Interface Summary
This interface describes a cluster of data points, which fulfill the clustering specification (i.e. data
points are within the epsilon and there are enough points to form a cluster).
[ For full details, see the Interface Details ]
Maps API for JavaScript Developer's Guide
► API Reference
114
Method Summary
Table 14: Methods
Methods
getMaxZoom () : {number}
Returns the maximum zoom level where this cluster doesn't fall apart into sub clusters and/or noise poinst
getBounds () : {H.geo.Rect}
Returns the bounding rectangle of this cluster.
forEachEntry (callback)
Invokes the specified callback for each "entry" of the cluster. That "entry" can be either a cluster which implements
H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface.
forEachDataPoint (callback)
Invokes the specified callback for each data point which is part of this cluster, even indirectly.
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
getWeight () : {number}
Returns the weight of this cluster result.
isCluster () : {boolean}
To indicate whether this cluster result is a cluster or noise point
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
Interface Description
This interface describes a cluster of data points, which fulfill the clustering specification (i.e. data
points are within the epsilon and there are enough points to form a cluster).
We can make an analogue with a Tree). In that case given cluster is a node in a tree, children of that
node are sub-clusters and leafs of that sub-tree are the noise points.
Sub-clusters of a cluster can be seen on a map when changing a zoom level, that time parent cluster
splits into smaller clusters and possible noise points.
Method Details
getMaxZoom () : {number}
Maps API for JavaScript Developer's Guide
► API Reference
115
Returns the maximum zoom level where this cluster doesn't fall apart into sub clusters and/or noise
poinst
Returns:
{number}
getBounds () : {H.geo.Rect}
Returns the bounding rectangle of this cluster.
Returns:
{H.geo.Rect}
forEachEntry (callback)
Invokes the specified callback for each "entry" of the cluster. That "entry" can be either a
cluster which implements H.clustering.ICluster interface or a noise point which implements
H.clustering.INoisePoint interface.
In analogue example from this class description, method traverses through all nodes of the tree
beside the root.
Parameters:
callback:
{function(H.clustering.IResult)}
The callback gets the currently traversed entry as an argument, which is
cluster or noise point.
forEachDataPoint (callback)
Invokes the specified callback for each data point which is part of this cluster, even indirectly.
In analogue example from this class description, method traverses only through leaf nodes of the
tree.
Parameters:
callback:
{function(H.clustering.INoisePoint)}
The callback gets the currently traversed noise point as argument.
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.geo.Point}
getWeight () : {number}
Returns the weight of this cluster result.
Returns:
{number}
isCluster () : {boolean}
To indicate whether this cluster result is a cluster or noise point
Returns:
{boolean}
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
Returns:
{number}
Interface: INoisePoint
This interface is a member of the namespace
H.clustering .
Interface Summary
This interface represents a data point which does not belong to a cluster.
[ For full details, see the Interface Details ]
Method Summary
Table 15: Methods
Methods
getData () : {*}
116
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This method returns data which coresponds to this noise point.
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
getWeight () : {number}
Returns the weight of this cluster result.
isCluster () : {boolean}
To indicate whether this cluster result is a cluster or noise point
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
Interface Description
This interface represents a data point which does not belong to a cluster.
Method Details
getData () : {*}
This method returns data which coresponds to this noise point.
Returns:
{*}
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
Returns:
{H.geo.Point}
getWeight () : {number}
Returns the weight of this cluster result.
Returns:
{number}
isCluster () : {boolean}
117
Maps API for JavaScript Developer's Guide
► API Reference
To indicate whether this cluster result is a cluster or noise point
Returns:
{boolean}
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
Returns:
{number}
Interface: IResult
This interface is a member of the namespace
H.clustering .
Interface Summary
This interface represents the result item of a clustering operation.
[ For full details, see the Interface Details ]
Method Summary
Table 16: Methods
Methods
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
getWeight () : {number}
Returns the weight of this cluster result.
isCluster () : {boolean}
To indicate whether this cluster result is a cluster or noise point
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
118
Maps API for JavaScript Developer's Guide
► API Reference
Interface Description
This interface represents the result item of a clustering operation.
Method Details
getPosition () : {H.geo.Point}
Returns the geographical position of this cluster result.
Returns:
{H.geo.Point}
getWeight () : {number}
Returns the weight of this cluster result.
Returns:
{number}
isCluster () : {boolean}
To indicate whether this cluster result is a cluster or noise point
Returns:
{boolean}
getMinZoom () : {number}
Returns the minimum zoom level where this item is not part of another cluster
Returns:
{number}
Interface: ITheme
This interface is a member of the namespace
H.clustering .
Interface Summary
Interface which specifies the methods a theme must implement.
119
Maps API for JavaScript Developer's Guide
► API Reference
120
[ For full details, see the Interface Details ]
Method Summary
Table 17: Methods
Methods
getClusterPresentation (cluster) : {H.map.Object}
Function returns a cluster presentation as a map object.
getNoisePresentation (noisePoint) : {H.map.Object}
Function returns noise point presentation as a map object
Interface Description
Interface which specifies the methods a theme must implement.
Themes can be used to style the output of a clustering process when overlaying clustered data on
the map.
Method Details
getClusterPresentation (cluster) : {H.map.Object}
Function returns a cluster presentation as a map object.
Parameters:
cluster:
{H.clustering.ICluster}
Returns:
{H.map.Object}
getNoisePresentation (noisePoint) : {H.map.Object}
Function returns noise point presentation as a map object
Parameters:
noisePoint:
{H.clustering.INoisePoint}
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
121
{H.map.Object}
Class: Provider
This class is a member of the namespace
H.clustering .
Class Summary
Extends: H.util.EventTarget
The clustering provider serves clusters and noise point representation for the map depending on
the provided data set. Levels for clustering as well as custom cluster representation can be set via
Options.
[ For full details, see the Class Details ]
Property Summary
Table 18: Properties
Properties
min : {number}
Minimum zoom level at which provider can cluster data
max : {number}
Maximum zoom level at which provider can cluster data
Method Summary
Table 19: Methods
Methods
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
Maps API for JavaScript Developer's Guide
► API Reference
122
Methods
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
setTheme (theme)
This method sets new theme on the provider. Calling this method will change visuals for displayed clusters and noise points.
getTheme () : {H.clustering.ITheme}
This method returns current theme used for creating cluster visualization
setDataPoints (data)
This method sets new data to the provider
providesDomMarkers () : {boolean}
This method returns true if Provider supplies map with dom markers
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}
Returns all DomMarker cluster and noise point representations which intersect with the provided rectangular area.
providesMarkers () : {boolean}
This method returns true if Provider supplies map with bitmap markers
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}
Returns all cluster and noise point markers which intersect with the provided rectangular area.
providesSpatials () : {boolean}
This method returns true if Provider supplies map with spatial objects
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns all polyline, polygon, circle and rect objects which represent cluster and noise points and intersect with the provided
area.
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
getInvalidations () : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the
given map object and triggers dispatchUpdate()
Maps API for JavaScript Developer's Guide
► API Reference
123
Class Description
The clustering provider serves clusters and noise point representation for the map depending on
the provided data set. Levels for clustering as well as custom cluster representation can be set via
Options.
Example
var dataPoints = [
new H.clustering.DataPoint(52, 1),
new H.clustering.DataPoint(52.1, 1)
];
var cluteringProvider = new H.clustering.Provider(dataPoints, {
clusteringOptions: {
minWeight: 1,
eps: 32
}
});
//clustering should be used with ObjectLayer
var clusteringLayer = new H.map.layer.ObjectLayer(clusteringPprovider);
map.addLayer(clusteringLayer);
Constructor Details
H.clustering.Provider(dataPoints, opt_options)
Parameters:
dataPoints:
{Array<H.clustering.DataPoint>}
opt_options:
{H.clustering.Provider.Options=} [optional]
Property Details
min: {number}
Minimum zoom level at which provider can cluster data
max: {number}
Maximum zoom level at which provider can cluster data
Maps API for JavaScript Developer's Guide
► API Reference
Method Details
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
124
Maps API for JavaScript Developer's Guide
► API Reference
evt:
{(H.util.Event | string)}
event object or event name
125
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
setTheme (theme)
This method sets new theme on the provider. Calling this method will change visuals for displayed
clusters and noise points.
Parameters:
theme:
{H.clustering.ITheme}
getTheme () : {H.clustering.ITheme}
This method returns current theme used for creating cluster visualization
Returns:
{H.clustering.ITheme}
setDataPoints (data)
This method sets new data to the provider
Parameters:
data:
{Array<H.clustering.DataPoint>}
Maps API for JavaScript Developer's Guide
► API Reference
126
providesDomMarkers () : {boolean}
This method returns true if Provider supplies map with dom markers
Returns:
{boolean}
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.DomMarker>}
Returns all DomMarker cluster and noise point representations which intersect with the provided
rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.DomMarker>}
a list of intersecting objects
providesMarkers () : {boolean}
This method returns true if Provider supplies map with bitmap markers
Returns:
{boolean}
Maps API for JavaScript Developer's Guide
► API Reference
127
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Marker>}
Returns all cluster and noise point markers which intersect with the provided rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Marker>}
a list of intersecting objects
providesSpatials () : {boolean}
This method returns true if Provider supplies map with spatial objects
Returns:
{boolean}
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Returns all polyline, polygon, circle and rect objects which represent cluster and noise points and
intersect with the provided area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Spatial>}
a list of intersecting objects
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
Parameters:
tile:
{H.map.provider.SpatialTile}
The tile for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Spatial>}
a list of intersecting objects
getInvalidations () : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
Returns:
{H.map.provider.Invalidations}
an invalidations object
128
Maps API for JavaScript Developer's Guide
► API Reference
129
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations
of this provider and the given map object and triggers dispatchUpdate()
Parameters:
mapObject:
{!H.map.Object}
The map object to be invalidated
changes:
{H.math.BitMask}
The flags indicating the types of occurred changes
Type definition: ClusteringOptions
This type definition is a member of the class
H.clustering.Provider .
Type Definition Summary
Options which are used within cluster calculations.
[ For full details, see the Type Definition Details ]
Property Summary
Table 20: Properties
Properties
eps
epsilon parameter for cluster calculation
minWeight
the minimum points weight sum to form a cluster
projection
projection to use for clustering, default is H.geo.mercator
Type Definition Description
Options which are used within cluster calculations.
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
eps: {number=} [optional]
epsilon parameter for cluster calculation
minWeight: {number=} [optional]
the minimum points weight sum to form a cluster
projection: {H.geo.IProjection=} [optional]
projection to use for clustering, default is H.geo.mercator
Type definition: Options
This type definition is a member of the class
H.clustering.Provider .
Type Definition Summary
Options which are used to initialize the clustering Provider
[ For full details, see the Type Definition Details ]
Property Summary
Table 21: Properties
Properties
min
The minimal supported zoom level, default is 0
max
The maximal supported zoom level, default is 22
clusteringOptions
options for clustering algorithm
theme
cluster and noise point graphical representation
Type Definition Description
Options which are used to initialize the clustering Provider
130
Maps API for JavaScript Developer's Guide
► API Reference
131
Property Details
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The maximal supported zoom level, default is 22
clusteringOptions: {H.clustering.Provider.ClusteringOptions=} [optional]
options for clustering algorithm
theme: {H.clustering.ITheme=} [optional]
cluster and noise point graphical representation
Namespace: data
Namespace Summary
The namespace contains classes and functionality for data visualization.
Namespace Description
The namespace contains classes and functionality for data visualization.
Class: AbstractReader
This class is a member of the namespace
H.data .
Class Summary
Extends: H.util.EventTarget
An abstract reader class defines interface for data readers and has general functionality related to
fetching data and reader events.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
132
Method Summary
Table 22: Methods
Methods
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new
instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that
contains partial information, and reader will add new parsed objects to the layer's provider later on.
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently
parsed objects if parsing is ongoing.
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed.
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects,
etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader).
Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers.
Events Summary
Table 23: Events
Events
statechange : {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Class Description
An abstract reader class defines interface for data readers and has general functionality related to
fetching data and reader events.
Maps API for JavaScript Developer's Guide
► API Reference
133
Constructor Details
H.data.AbstractReader(opt_url)
Parameters:
opt_url:
{string=} [optional]
Method Details
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to
the map. It returns new instance of the class with every invocation. If data hasn't been parsed it
will return H.map.layer.ObjectLayer that contains partial information, and reader will add new
parsed objects to the layer's provider later on.
Returns:
{H.map.layer.ObjectLayer}
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects.
Method returns only currently parsed objects if parsing is ongoing.
Returns:
{Array<H.map.Object>}
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been
already parsed.
Returns:
{(string | undefined)}
url
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about
last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
url:
{string}
The new URL
Returns:
{H.data.AbstractReader}
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
Returns:
{H.data.AbstractReader.State}
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or
H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or
server should respond with proper CORS headers.
Event Details
statechange: {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Class: Event
This class is a member of the class
H.data.AbstractReader .
Class Summary
Extends: H.util.Event
The event class for state events that are dispatched by AbstractReader
[ For full details, see the Class Details ]
Class Description
The event class for state events that are dispatched by AbstractReader
134
Maps API for JavaScript Developer's Guide
► API Reference
Constructor Details
H.data.AbstractReader.Event(target, type, state, message)
Parameters:
target:
{(H.data.AbstractReader | H.map.Object)}
The target that's passed to event listeners
type:
{string}
The type of the event
state:
{H.data.AbstractReader.State}
The state of the target firing an event
message:
{string}
The message associated with an event
Enumeration: State
This enumeration is a member of the class
H.data.AbstractReader .
Enumeration Summary
The state types of an Reader. Possible states are:
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 24: Constants
Constants
static
ERROR
static
LOADING
static
VISIT
static
READY
135
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration Details
The state types of an Reader. Possible states are:
•
•
•
•
ERROR - request failed or data are malformed
LOADING - fetching data from network resource
VISIT - parser encountered data at root level
READY - reader is ready to fetch and parse new data
Enumeration Constants Details
static ERROR
static LOADING
static VISIT
static READY
Namespace: geojson
Namespace Summary
Namespace provides GeoJSON functionality
Namespace Description
Namespace provides GeoJSON functionality
Class: Reader
This class is a member of the namespace
H.data.geojson .
Class Summary
Extends: H.data.AbstractReader
The GeoJSON Reader is responsible for fetching and interpreting GeoJSON data. Reader creates
H.map.Object that can be displayed on the map (for more details on GeoJSON see http://
geojson.org/). Auxiliary data that accompanies geometries (everthing that properties field
contains) is binded to the map object and can be fetched with object's getData method (see
H.map.Object#getData)
[ For full details, see the Class Details ]
136
Maps API for JavaScript Developer's Guide
► API Reference
137
Method Summary
Table 25: Methods
Methods
parseData (data)
Method launches parsing of the data provided.
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new
instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that
contains partial information, and reader will add new parsed objects to the layer's provider later on.
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently
parsed objects if parsing is ongoing.
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed.
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects,
etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader).
Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers.
Events Summary
Table 26: Events
Events
statechange : {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Class Description
The GeoJSON Reader is responsible for fetching and interpreting GeoJSON data. Reader creates
H.map.Object that can be displayed on the map (for more details on GeoJSON see http://
Maps API for JavaScript Developer's Guide
► API Reference
138
geojson.org/). Auxiliary data that accompanies geometries (everthing that properties field
contains) is binded to the map object and can be fetched with object's getData method (see
H.map.Object#getData)
Note that you can load GeoJSON file even from a different domain, if that domain supports
Cross-Origin Resource Sharing (see http://developer.mozilla.org/en-US/docs/Web/HTTP/
Access_control_CORS).
Example
var reader = new H.data.geojson.Reader('/path/to/geojson/file.json');
reader.parse();
//assuming that map already exists
map.addLayer(reader.getLayer());
Constructor Details
H.data.geojson.Reader(opt_url, opt_options)
Parameters:
opt_url:
{string=} [optional]
url of the data file
opt_options:
{H.data.geojson.Reader.Options=} [optional]
additional reader parameters
Method Details
parseData (data)
Method launches parsing of the data provided.
Parameters:
data:
{(string | Object)}
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to
the map. It returns new instance of the class with every invocation. If data hasn't been parsed it
will return H.map.layer.ObjectLayer that contains partial information, and reader will add new
parsed objects to the layer's provider later on.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
139
{H.map.layer.ObjectLayer}
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects.
Method returns only currently parsed objects if parsing is ongoing.
Returns:
{Array<H.map.Object>}
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been
already parsed.
Returns:
{(string | undefined)}
url
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about
last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
Parameters:
url:
{string}
The new URL
Returns:
{H.data.AbstractReader}
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
Returns:
{H.data.AbstractReader.State}
Maps API for JavaScript Developer's Guide
► API Reference
140
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or
H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or
server should respond with proper CORS headers.
Event Details
statechange: {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Type definition: Options
This type definition is a member of the class
H.data.geojson.Reader .
Type Definition Summary
Options used to initialize a Reader
[ For full details, see the Type Definition Details ]
Property Summary
Table 27: Properties
Properties
style
Function that is invoked during parsing after object creation, and is used to set style of the object
Type Definition Description
Options used to initialize a Reader
Property Details
style: {function(H.map.Object)=} [optional]
Function that is invoked during parsing after object creation, and is used to set style of the object
Maps API for JavaScript Developer's Guide
► API Reference
141
Namespace: heatmap
Namespace Summary
This namespace contains classes and functionality to enable the heat map creation.
Namespace Description
This namespace contains classes and functionality to enable the heat map creation.
Class: Colors
This class is a member of the namespace
H.data.heatmap .
Class Summary
This class defines a standard way to customize the colors displayed in a heat map by associating
custom colors with the normalized "heat" values.
[ For full details, see the Class Details ]
Property Summary
Table 28: Properties
Properties
static
DEFAULT : {H.data.heatmap.Colors}
This static member defines the default heatmap colors. It uses color interpolation and has the following color stops:
Class Description
This class defines a standard way to customize the colors displayed in a heat map by associating
custom colors with the normalized "heat" values.
It associates colors with "heat" values via the "stops" property. This property is a map, where the
keys are numbers ranging from 0 to 1, inclusive, and the values are colors associated with these
numeric values. The colors are represented using CSS syntax, i.e. hexadecimal notation ("#RGB" or
"#RRGGBB") or rgb(a) notation ("rgba(R, G, B, A)"), etc. The range (0 .. 1) stands for the normalized
"heat" value.
Maps API for JavaScript Developer's Guide
► API Reference
142
Example
var colors = new H.data.heatmap.Colors({
'0': 'rgba(255, 0, 0, 0.5)',
// half-transparent red
'0.5': 'rgba(255, 255, 0, 0.5)', // half-transparent yellow
'1': 'rgba(255, 255, 255, 0.5)' // half-transparent white
},
true // interpolate between the stops to create a smooth color gradient
);
Constructor Details
H.data.heatmap.Colors(stops, opt_interpolate)
Parameters:
stops:
{Object<string, string>}
The color stops.
opt_interpolate:
{boolean=} [optional]
The flag indicating whether interpolation is to be used to display smooth
color transitions in the heat map (true) or whether the heat map is to be
posterized (false), default is false.
Property Details
static DEFAULT: {H.data.heatmap.Colors}
This static member defines the default heatmap colors. It uses color interpolation and has the
following color stops:
Example
{
'0':
'0.2':
'0.5':
'0.7':
'#008',
'#0b0',
'#ff0',
'#f00'
//
//
//
//
dark blue
medium green
yellow
red
}
Interface: IDataPoint
This interface is a member of the namespace
H.data.heatmap .
Maps API for JavaScript Developer's Guide
► API Reference
143
Interface Summary
An interface to represent a single data point that can be visualized in a heat map. It consists of the
geographic coordinates defining its position and an optional value to be associated with this position.
[ For full details, see the Interface Details ]
Property Summary
Table 29: Properties
Properties
value : {(number | undefined)}
The "heat" value associated with the given data point, default is 1.
Interface Description
An interface to represent a single data point that can be visualized in a heat map. It consists of the
geographic coordinates defining its position and an optional value to be associated with this position.
Property Details
value: {(number | undefined)}
The "heat" value associated with the given data point, default is 1.
Class: Provider
This class is a member of the namespace
H.data.heatmap .
Class Summary
Extends: H.map.provider.RemoteTileProvider
The class provides tiles to visualize value-based or density-based heat maps. User can choose
between density and value based heat map.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
144
Method Summary
Table 30: Methods
Methods
addData (dataPoints, opt_hardReload)
This method adds an array of H.data.heatmap.IDataPoint to the heat map. The heat map provides a visual representation of
these data. Note that there is a significant performance cost to adding and removing data, once an overlay has been created.
This is related to the rendering engine and tile caching. If you wish to add data after tiles have been created, the cache must
be cleared and all tiles need to be recreated. For this reason, heat maps should not be used to create fast animations.
clear ()
This method removes all data from the given heat map provider. New data can be added using the
H.data.heatmap.Provider#addData method.
Class Description
The class provides tiles to visualize value-based or density-based heat maps. User can choose
between density and value based heat map.
Example
// Create heat map provider
var heatmapProvider = new H.data.heatmap.Provider({
colors: new H.data.heatmap.Colors({
'0': 'blue',
'0.5': 'yellow',
'1': 'red'
}, true),
// paint assumed values in regions where no data is available
assumeValues: true
});
// Add the data
heatmapProvider.addData([
{lat: 52, lng: 1, value: 1},
{lat: 53, lng: 2, value: 2}
]);
// Create semi transparent heat map layer
var heatmapLayer = new H.map.layer.TileLayer(heatmapProvider, {
opacity: 0.6
});
// Add layer to the map
map.addLayer(heatmapLayer);
Maps API for JavaScript Developer's Guide
► API Reference
145
Constructor Details
H.data.heatmap.Provider(opt_options)
Parameters:
opt_options:
{H.data.heatmap.Provider.Options=} [optional]
Configuration options
Method Details
addData (dataPoints, opt_hardReload)
This method adds an array of H.data.heatmap.IDataPoint to the heat map. The heat map provides
a visual representation of these data. Note that there is a significant performance cost to adding
and removing data, once an overlay has been created. This is related to the rendering engine and tile
caching. If you wish to add data after tiles have been created, the cache must be cleared and all tiles
need to be recreated. For this reason, heat maps should not be used to create fast animations.
As new data might invalidate the already generated tiles, those tiles should be removed form the tile
cache. Pass opt_hardReload parameter to change the mode how those tiles are removed. Two
modes are possible:
•
hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to
re-fetch the tiles. Currently cached tiles will not be used for rendering.
•
soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the
earliest convenience. The provider does not invalidate the cache immediately in this case. This
means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
dataPoints:
{Array<H.data.heatmap.IDataPoint>}
The array of data points to add.
opt_hardReload:
{boolean=} [optional]
a boolean flag indicating whether to invalidate in hard mode (true) or in
soft mode (false), default is soft mode.
clear ()
This method removes all data from the given heat map provider. New data can be added using the
H.data.heatmap.Provider#addData method.
Maps API for JavaScript Developer's Guide
► API Reference
146
Type definition: Options
This type definition is a member of the class
H.data.heatmap.Provider .
Type Definition Summary
Options which are used to initialize the heat map Provider
[ For full details, see the Type Definition Details ]
Property Summary
Table 31: Properties
Properties
type
The type of the heat map, either "value" or "density". Default is "density"
colors
The colors of the heat map, default is H.data.heatmap.Colors.DEFAULT
min
The minimal supported zoom level, default is 0.
max
The maximal supported zoom level, default is 22.
tileSize
The size of a tile as edge length in pixels. It must be 2^n where n is in a range [0 ... 30]. Default is 256.
assumeValues
This property holds a boolean value defining whether to paint assumed values in regions where no data is available. This is
especially useful for value maps which are generated from a small data sets as tiles with no available data will be filled with
the next available average value in the data set. Default is false.
coarseness
This property holds a numeric value defining the resolution reduction when producing tiles. If the coarseness is set to 0 tiles
will be produced in the original resolution. A coarseness of 1 allows the renderer to render tiles at half the size and then
scale the output, a coarseness of 2 allows the renderer to create tiles at a size of a quarter of the original tile size. Increasing
the number dramatically increases performance but also reduces visual quality, especially when using "posterization" (noninterpolated colors). Values are clamped to a integer from a range [0 ... 3]. Default is 1.
sampleDepth
Maps API for JavaScript Developer's Guide
► API Reference
147
Properties
This property holds a numeric value defining the number of sampling iterations the heat map renderer will perform on
the data set. Each iteration will sample the data more finely. Higher values will create more detailed maps but also cost
performance. Values are clamped to a integer from a range [1 ... 8]. Default is 4.
dataMax
This property holds a numeric value defining the pixel color gamma correction in case of the "density" heat maps. Values
are clamped to a integer from a range [min ... max+sampleDepth]. Default is max.
Type Definition Description
Options which are used to initialize the heat map Provider
Property Details
type: {string}
The type of the heat map, either "value" or "density". Default is "density"
colors: {H.data.heatmap.Colors}
The colors of the heat map, default is H.data.heatmap.Colors.DEFAULT
min: {number=} [optional]
The minimal supported zoom level, default is 0.
max: {number=} [optional]
The maximal supported zoom level, default is 22.
tileSize: {number=} [optional]
The size of a tile as edge length in pixels. It must be 2^n where n is in a range [0 ... 30]. Default is
256.
assumeValues: {boolean=} [optional]
This property holds a boolean value defining whether to paint assumed values in regions where
no data is available. This is especially useful for value maps which are generated from a small data
sets as tiles with no available data will be filled with the next available average value in the data set.
Default is false.
coarseness: {number=} [optional]
This property holds a numeric value defining the resolution reduction when producing tiles.
If the coarseness is set to 0 tiles will be produced in the original resolution. A coarseness of 1
allows the renderer to render tiles at half the size and then scale the output, a coarseness of 2
Maps API for JavaScript Developer's Guide
► API Reference
148
allows the renderer to create tiles at a size of a quarter of the original tile size. Increasing the
number dramatically increases performance but also reduces visual quality, especially when using
"posterization" (non-interpolated colors). Values are clamped to a integer from a range [0 ... 3].
Default is 1.
sampleDepth: {number=} [optional]
This property holds a numeric value defining the number of sampling iterations the heat map
renderer will perform on the data set. Each iteration will sample the data more finely. Higher values
will create more detailed maps but also cost performance. Values are clamped to a integer from a
range [1 ... 8]. Default is 4.
dataMax: {number=} [optional]
This property holds a numeric value defining the pixel color gamma correction in case of
the "density" heat maps. Values are clamped to a integer from a range [min ... max
+sampleDepth]. Default is max.
Namespace: kml
Namespace Summary
Namespace provides KML functionality
Namespace Description
Namespace provides KML functionality
Class: Reader
This class is a member of the namespace
H.data.kml .
Class Summary
Extends: H.data.AbstractReader
The KML Reader is responsible for fetching and interpreting KML data. Reader creates
H.map.Object that can be displayed on the map, from KML Features and geometries as described
by OGC. Auxiliary data that accompanies geometries (such as name, description, kml node
itself etc.) is binded to the map object and can be fetched with object's getData method (see
H.map.Object#getData).
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
149
Method Summary
Table 32: Methods
Methods
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new
instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that
contains partial information, and reader will add new parsed objects to the layer's provider later on.
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently
parsed objects if parsing is ongoing.
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed.
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects,
etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader).
Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers.
Events Summary
Table 33: Events
Events
statechange : {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Class Description
The KML Reader is responsible for fetching and interpreting KML data. Reader creates
H.map.Object that can be displayed on the map, from KML Features and geometries as described
by OGC. Auxiliary data that accompanies geometries (such as name, description, kml node
itself etc.) is binded to the map object and can be fetched with object's getData method (see
H.map.Object#getData).
Maps API for JavaScript Developer's Guide
► API Reference
150
Note that you can load KML file even from a different domain, if that domain supports Cross-Origin
Resource Sharing (see http://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).
Example
var reader = new H.data.kml.Reader('/path/to/kml/file.kml');
reader.parse();
//assuming that map already exists
map.addLayer(reader.getLayer());
Constructor Details
H.data.kml.Reader(url)
Parameters:
url:
{string}
Method Details
getLayer () : {H.map.layer.ObjectLayer}
Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to
the map. It returns new instance of the class with every invocation. If data hasn't been parsed it
will return H.map.layer.ObjectLayer that contains partial information, and reader will add new
parsed objects to the layer's provider later on.
Returns:
{H.map.layer.ObjectLayer}
getParsedObjects () : {Array<H.map.Object>}
Method returns collection of currently parsed, and converted to H.map.Object data objects.
Method returns only currently parsed objects if parsing is ongoing.
Returns:
{Array<H.map.Object>}
getUrl () : {(string | undefined)}
Returns URL of the current file, which is either in process of fetching/parsing or file that has been
already parsed.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
151
{(string | undefined)}
url
setUrl (url) : {H.data.AbstractReader}
Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about
last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR.
Parameters:
url:
{string}
The new URL
Returns:
{H.data.AbstractReader}
getState () : {H.data.AbstractReader.State}
Returns the reader's processing state for possible states see H.data.AbstractReader.State
Returns:
{H.data.AbstractReader.State}
parse ()
Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or
H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or
server should respond with proper CORS headers.
Event Details
statechange: {H.data.AbstractReader.Event}
Fired when the reader state changes, see H.data.AbstractReader#getState
Namespace: geo
Namespace Summary
This namespace contains functionality for geo-computation.
Maps API for JavaScript Developer's Guide
► API Reference
152
Property Summary
Table 34: Properties
Properties
static
mercator : {H.geo.IProjection}
Spherical mercator projection. This projection treats earth as a sphere and maps geo coordinates to a cooresponding 2
dimensional space. Map uses this projection by default.
Namespace Description
This namespace contains functionality for geo-computation.
Property Details
static mercator: {H.geo.IProjection}
Spherical mercator projection. This projection treats earth as a sphere and maps geo coordinates to
a cooresponding 2 dimensional space. Map uses this projection by default.
Type definition: Altitude
This type definition is a member of the namespace
H.geo .
Type Definition Summary
A Geographic coordinate that specifies the height of a point in meters. A value of undefined is
treated as 0.
[ For full details, see the Type Definition Details ]
Type Definition Description
A Geographic coordinate that specifies the height of a point in meters. A value of undefined is
treated as 0.
Enumeration: AltitudeContext
This enumeration is a member of the namespace
H.geo .
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration Summary
Contexts for altitudes to specify the contextual origin of an altitude's value
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 35: Constants
Constants
static
undefined
Ground level
static
GL
Ground level
static
OL
Obstruction level
static
SL
Mean sea level
static
SB
Sea bed level
static
WE
WGS84 ellipsoid
static
WG
WGS84 geoid
Enumeration Details
Contexts for altitudes to specify the contextual origin of an altitude's value
Enumeration Constants Details
static undefined
Ground level
static GL
Ground level
153
Maps API for JavaScript Developer's Guide
► API Reference
static OL
Obstruction level
static SL
Mean sea level
static SB
Sea bed level
static WE
WGS84 ellipsoid
static WG
WGS84 geoid
Interface: IPoint
This interface is a member of the namespace
H.geo .
Interface Summary
An interface to represent a geographic point. Every point in geo space is represented by three
coordinates latitude, longitude and optional altitude.
[ For full details, see the Interface Details ]
Property Summary
Table 36: Properties
Properties
lat : {H.geo.Latitude}
The latitude coordinate.
lng : {H.geo.Longitude}
The longitude coordinate.
alt : {H.geo.Altitude}
The altitude coordinate.
ctx : {H.geo.AltitudeContext}
154
Maps API for JavaScript Developer's Guide
► API Reference
Properties
The altitude context.
Interface Description
An interface to represent a geographic point. Every point in geo space is represented by three
coordinates latitude, longitude and optional altitude.
Property Details
lat: {H.geo.Latitude}
The latitude coordinate.
lng: {H.geo.Longitude}
The longitude coordinate.
alt: {H.geo.Altitude}
The altitude coordinate.
ctx: {H.geo.AltitudeContext}
The altitude context.
Interface: IProjection
This interface is a member of the namespace
H.geo .
Interface Summary
Interface which describes map projection. Functions transform geo coordinates to EPSG3857
coordinate reference system, which is x,y values in range 0..1
[ For full details, see the Interface Details ]
Method Summary
Table 37: Methods
Methods
latLngToPoint (lat, lng, opt_out) : {H.math.Point}
This method transforms geographical lat/lng coordinates to a projected point in range 0...1
155
Maps API for JavaScript Developer's Guide
► API Reference
Methods
xyToGeo (x, y, opt_out) : {H.geo.Point}
This method transforms projected x/y coordinates in range 0...1 to a geographical point
pointToGeo (point, opt_out) : {H.geo.Point}
This method transforms a projected point in range 0...1 to a geographical point
geoToPoint (geoPoint, opt_out) : {H.math.Point}
This method transforms a geographical point to a projected point in range 0...1
Interface Description
Interface which describes map projection. Functions transform geo coordinates to EPSG3857
coordinate reference system, which is x,y values in range 0..1
Method Details
latLngToPoint (lat, lng, opt_out) : {H.math.Point}
This method transforms geographical lat/lng coordinates to a projected point in range 0...1
Parameters:
lat:
{number}
latitude
lng:
{number}
longitude
opt_out:
{H.math.Point=} [optional]
an optional point to store the result
Returns:
{H.math.Point}
xyToGeo (x, y, opt_out) : {H.geo.Point}
This method transforms projected x/y coordinates in range 0...1 to a geographical point
Parameters:
x:
{number}
156
Maps API for JavaScript Developer's Guide
► API Reference
y:
{number}
opt_out:
{H.geo.Point=} [optional]
an optional point to store the result
Returns:
{H.geo.Point}
pointToGeo (point, opt_out) : {H.geo.Point}
This method transforms a projected point in range 0...1 to a geographical point
Parameters:
point:
{H.math.IPoint}
opt_out:
{H.geo.Point=} [optional]
an optional point to store the result
Returns:
{H.geo.Point}
geoToPoint (geoPoint, opt_out) : {H.math.Point}
This method transforms a geographical point to a projected point in range 0...1
Parameters:
geoPoint:
{H.geo.IPoint}
opt_out:
{H.math.Point=} [optional]
An optional point to store the result
Returns:
{H.math.Point}
157
Maps API for JavaScript Developer's Guide
► API Reference
158
Type definition: Latitude
This type definition is a member of the namespace
H.geo .
Type Definition Summary
A geographic coordinate that specifies the north-south position of a point on the Earth's surface in
the range from -90 to + 90 degrees, inclusive.
[ For full details, see the Type Definition Details ]
Type Definition Description
A geographic coordinate that specifies the north-south position of a point on the Earth's surface in
the range from -90 to + 90 degrees, inclusive.
Type definition: Longitude
This type definition is a member of the namespace
H.geo .
Type Definition Summary
A Geographic coordinate that specifies the east-west position of a point on the Earth's surface in the
range from -180 to 180 degrees, inclusive.
[ For full details, see the Type Definition Details ]
Type Definition Description
A Geographic coordinate that specifies the east-west position of a point on the Earth's surface in the
range from -180 to 180 degrees, inclusive.
Class: PixelProjection
This class is a member of the namespace
H.geo .
Class Summary
PixelProjection is used to transform pixel world coordinates at certain scale (zoom level) to
geographical coordinates and vice-versa. By default it uses mercator geo projection to transform geo
points into the 2d plane map point which are adjusted to current scale.
Maps API for JavaScript Developer's Guide
► API Reference
[ For full details, see the Class Details ]
Property Summary
Table 38: Properties
Properties
projection : {H.geo.IProjection}
Geographical projection that backs given PixelProjection.
x : {number}
X-offset in projection relative to top left corner.
y : {number}
Y-offset in projection relative to top left corner.
w : {number}
Width of the world in pixels
h : {number}
Height of the world in pixels
Method Summary
Table 39: Methods
Methods
rescale (zoom)
This method updates scale exponent for the pixel projection.
getZoomScale () : {number}
This method returns current zoom scale factor previously set by H.geo.PixelProjection#rescale function.
geoToPixel (geoPoint, opt_out) : {H.math.IPoint}
This method translates geo point to pixel coordinates at given zoom level.
pixelToGeo (point, opt_out) : {H.geo.IPoint}
This method translates a pixel's point to the according geo point.
xyToGeo (x, y, opt_out) : {H.geo.Point}
This method translates pixel's x and y coordinates to the according geo point.
latLngToPixel (latitude, longitude, opt_out) : {H.math.Point}
159
Maps API for JavaScript Developer's Guide
► API Reference
160
Methods
This method translates geographical coordinates (latitude, longitude) supplied by the caller. This method accepts longitudes
outside of the normal longitude range. into a point defined in terms of pixel coordinates.
pointToPixel (point) : {H.math.Point}
Method translates provided map point to world pixel coordinates relative to current projection offset.
Class Description
PixelProjection is used to transform pixel world coordinates at certain scale (zoom level) to
geographical coordinates and vice-versa. By default it uses mercator geo projection to transform geo
points into the 2d plane map point which are adjusted to current scale.
Constructor Details
H.geo.PixelProjection(opt_projection, opt_sizeAtLevelZero)
Parameters:
opt_projection:
{H.geo.IProjection=} [optional]
default is spherical mercator H.geo.mercator
opt_sizeAtLevelZero:
{number=} [optional]
world size in pixels at zoom level 0, default is 256
Property Details
projection: {H.geo.IProjection}
Geographical projection that backs given PixelProjection.
x: {number}
X-offset in projection relative to top left corner.
y: {number}
Y-offset in projection relative to top left corner.
w: {number}
Width of the world in pixels
h: {number}
Height of the world in pixels
Maps API for JavaScript Developer's Guide
► API Reference
Method Details
rescale (zoom)
This method updates scale exponent for the pixel projection.
Parameters:
zoom:
{number}
getZoomScale () : {number}
This method returns current zoom scale factor previously set by H.geo.PixelProjection#rescale
function.
Returns:
{number}
geoToPixel (geoPoint, opt_out) : {H.math.IPoint}
This method translates geo point to pixel coordinates at given zoom level.
Parameters:
geoPoint:
{H.geo.IPoint}
opt_out:
{H.math.IPoint=} [optional]
an optional point to store the result
Returns:
{H.math.IPoint}
pixelToGeo (point, opt_out) : {H.geo.IPoint}
This method translates a pixel's point to the according geo point.
Parameters:
point:
{H.math.Point}
161
Maps API for JavaScript Developer's Guide
► API Reference
opt_out:
{H.geo.IPoint=} [optional]
an optional point to store the result
Returns:
162
{H.geo.IPoint}
xyToGeo (x, y, opt_out) : {H.geo.Point}
This method translates pixel's x and y coordinates to the according geo point.
Parameters:
x:
{number}
y:
{number}
opt_out:
{H.geo.Point=} [optional]
an optional point to store the result
Returns:
{H.geo.Point}
latLngToPixel (latitude, longitude, opt_out) : {H.math.Point}
This method translates geographical coordinates (latitude, longitude) supplied by the caller. This
method accepts longitudes outside of the normal longitude range. into a point defined in terms of
pixel coordinates.
Parameters:
latitude:
{number}
The latitude to translate
longitude:
{number}
The longitude to translate
opt_out:
{H.math.IPoint=} [optional]
an optional point to store the result
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
163
{H.math.Point}
A point object containing x and y coordinates (in pixels)
pointToPixel (point) : {H.math.Point}
Method translates provided map point to world pixel coordinates relative to current projection offset.
Parameters:
point:
{H.math.IPoint}
Returns:
{H.math.Point}
pixel coordinate
Class: Point
This class is a member of the namespace
H.geo .
Class Summary
Implements: H.geo.IPoint
Class represents a geographical point, which is defined by the latitude, longitude and optional
altitude.
[ For full details, see the Class Details ]
Property Summary
Table 40: Properties
Properties
lat : {H.geo.Latitude}
The latitude coordinate.
lng : {H.geo.Longitude}
The longitude coordinate.
Maps API for JavaScript Developer's Guide
► API Reference
164
Properties
alt : {H.geo.Altitude}
The altitude coordinate.
ctx : {H.geo.AltitudeContext}
The altitude context.
Method Summary
Table 41: Methods
Methods
equals (other) : {boolean}
To compare this point with a supplied other point for equality. Two points are considered equal if they have the same lat
and lng as well as equivalent values for alt and ctx.
distance (other) : {number}
To calculate the distance between this point and the supplied other point. The method uses the Haversine formula. The
altitude is not considered.
walk (bearing, distance, opt_overGreatCircle) : {H.geo.Point}
This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. The
altitude is ignored, instead the WGS84 Mean Radius is taken.
static
validate (point, opt_caller, opt_argNr) : {boolean}
This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat
property is clamped into a range of -90 ... +90 and the value of the lng property is modulo into a range of -180 ...
+180 plus validates the values of the alt and ctx properties
static
fromIPoint (iPoint) : {H.geo.Point}
This method creates a Point instance from a given IPoint object.
Class Description
Class represents a geographical point, which is defined by the latitude, longitude and optional
altitude.
Example
var geoPoint = new H.geo.Point(1, 51);
Maps API for JavaScript Developer's Guide
► API Reference
165
Constructor Details
H.geo.Point(lat, lng, opt_alt, opt_ctx)
Parameters:
lat:
{H.geo.Latitude}
The latitude coordinate
lng:
{H.geo.Longitude}
The longitude coordinate
opt_alt:
{H.geo.Altitude=} [optional]
The altitude coordinate
opt_ctx:
{H.geo.AltitudeContext=} [optional]
The altitude context
Property Details
lat: {H.geo.Latitude}
The latitude coordinate.
lng: {H.geo.Longitude}
The longitude coordinate.
alt: {H.geo.Altitude}
The altitude coordinate.
ctx: {H.geo.AltitudeContext}
The altitude context.
Method Details
equals (other) : {boolean}
To compare this point with a supplied other point for equality. Two points are considered equal if
they have the same lat and lng as well as equivalent values for alt and ctx.
Parameters:
other:
{H.geo.IPoint}
Maps API for JavaScript Developer's Guide
► API Reference
166
Returns:
{boolean}
Whether the two points are equal.
distance (other) : {number}
To calculate the distance between this point and the supplied other point. The method uses the
Haversine formula. The altitude is not considered.
Parameters:
other:
{H.geo.IPoint}
Returns:
{number}
The distance between the given location and the location supplied by the
caller in meters
walk (bearing, distance, opt_overGreatCircle) : {H.geo.Point}
This method calculates the geographic point of a destination point using the distance and bearing
specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken.
Parameters:
bearing:
{number}
The bearing to use in the calculation in degrees
distance:
{number}
The distance to the destination in meters
opt_overGreatCircle:
{boolean=} [optional]
If true the computation uses the "Great Circle" otherwise "Rhumb Line".
Returns:
{H.geo.Point}
Maps API for JavaScript Developer's Guide
► API Reference
167
The calculated point
static
validate (point, opt_caller, opt_argNr) : {boolean}
This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types.
Additionally the value of the lat property is clamped into a range of -90 ... +90 and the value of
the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and
ctx properties
Parameters:
point:
{H.geo.IPoint}
The point to validate
opt_caller:
{Function=} [optional]
The caller to use for InvalidArgumentError. If omitted no error is thrown
opt_argNr:
{number=} [optional]
The argument number to use for InvalidArgumentError.
Returns:
{boolean}
if the given point could validate
static
fromIPoint (iPoint) : {H.geo.Point}
This method creates a Point instance from a given IPoint object.
Parameters:
iPoint:
{H.geo.IPoint}
The IPoint object to use
Returns:
{H.geo.Point}
the created Point instance
Class: Rect
This class is a member of the namespace
H.geo .
Maps API for JavaScript Developer's Guide
► API Reference
Class Summary
This class represents a rectangular geographic area. The area is defined by four geographical
coordinates two (left, right) longitudes and two (top, bottom) latitudes.
[ For full details, see the Class Details ]
Method Summary
Table 42: Methods
Methods
equals (other) : {boolean}
To compare this rectangle with a supplied other rectangle for equality.
getTopLeft () : {H.geo.Point}
This method returns the top-left corner of the rectangular area.
getBottomRight () : {H.geo.Point}
This method returns the bottom-right corner of the rectangular area.
getTop () : {H.geo.Latitude}
This method returns the north-most latitude of this rectangular area
getBottom () : {H.geo.Latitude}
This method returns the south-most latitude of this rectangular area
getLeft () : {H.geo.Longitude}
This method returns the left-most longitude of this rectangular area
getRight () : {H.geo.Longitude}
This method returns the right-most longitude of this rectangular area
getCenter () : {H.geo.Point}
This method returns the center point of this rectangular area
getWidth () : {number}
Returns this width of this rectangular area in decimal degrees.
getHeight () : {number}
Returns this height of this rectangular area in decimal degrees.
isCDB () : {boolean}
Returns a boolean value indicating whether this rectangular area spans across the date border.
168
Maps API for JavaScript Developer's Guide
► API Reference
169
Methods
isEmpty () : {boolean}
The method checks if the area enclosed by the given bounding box is 0.
containsLatLng (lat, lng, opt_skipValidation) : {boolean}
This method checks if the latitude and longitude supplied by the caller lie within the area of this rectangular area.
containsPoint (geoPoint, opt_skipValidation) : {boolean}
This method checks if the point supplied by the caller lies within the area of this rectangular area.
containsRect (geoRect, opt_skipValidation) : {boolean}
This method checks if the rectangular area supplied by the caller is completely contained within the area of this rectangular
area.
mergeLatLng (lat, lng, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the latitude and longitude supplied by
the caller.
mergePoint (geoPoint, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the point supplied by the caller.
mergeRect (geoRect, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the rectangular area supplied by the
caller.
mergeTopLeftBottomRight (top, left, bottom, right, opt_skipValidation, opt_out) :
{H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the rectangular area supplied by the
caller.
intersects (geoRect, opt_skipValidation) : {boolean}
This method checks if the intersection of two bounding boxes is non-empty.
static merge (topA, leftA, bottomA, rightA, topB, leftB, bottomB, rightB, opt_out) :
{H.geo.Rect}
This method merges two rects by their values. The result of the merge is a bounding rect which covers all provided rect
bounds.
static
fromPoints (topLeft, bottomRight, opt_skipValidation) : {H.geo.Rect}
This method creates a rectangular area from a top-left and bottom-right point pair.
static
coverPoints (pointArray, opt_skipValidation) : {?H.geo.Rect}
This method creates the minimum rectangular area covering all of the points in the argument array.
static
coverLatLngAlts (latLngAltArray, opt_skipValidation) : {(H.geo.Rect | undefined)}
Maps API for JavaScript Developer's Guide
► API Reference
170
Methods
This method creates the minimum rectangular area covering all of the coordinates in the argument array.
static
coverRects (rectArray, opt_skipValidation) : {(H.geo.Rect | undefined)}
This method creates the minimum rectangular area covering all of the rectangular areas in the argument array.
resizeToCenter (center, opt_out) : {H.geo.Rect}
This method clones the given bounding rect and resizes the clone if necessary until the location supplied by the caller is at its
center.
Class Description
This class represents a rectangular geographic area. The area is defined by four geographical
coordinates two (left, right) longitudes and two (top, bottom) latitudes.
Constructor Details
H.geo.Rect(top, left, bottom, right)
Parameters:
top:
{H.geo.Latitude}
the northern-most latitude
left:
{H.geo.Longitude}
the left-most longitude
bottom:
{H.geo.Latitude}
the southern-most latitude
right:
{H.geo.Longitude}
the right-most latitude
Method Details
equals (other) : {boolean}
To compare this rectangle with a supplied other rectangle for equality.
Parameters:
other:
{H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{boolean}
Whether the two rectangles are equal.
getTopLeft () : {H.geo.Point}
This method returns the top-left corner of the rectangular area.
Returns:
{H.geo.Point}
the top-left corner of the area
getBottomRight () : {H.geo.Point}
This method returns the bottom-right corner of the rectangular area.
Returns:
{H.geo.Point}
the bottom-right corner of the area
getTop () : {H.geo.Latitude}
This method returns the north-most latitude of this rectangular area
Returns:
{H.geo.Latitude}
the north-most latitude of the area
getBottom () : {H.geo.Latitude}
This method returns the south-most latitude of this rectangular area
Returns:
{H.geo.Latitude}
the south-most latitude of the area
getLeft () : {H.geo.Longitude}
This method returns the left-most longitude of this rectangular area
171
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.geo.Longitude}
the left-most longitude of the area
getRight () : {H.geo.Longitude}
This method returns the right-most longitude of this rectangular area
Returns:
{H.geo.Longitude}
the right-most longitude of the area
getCenter () : {H.geo.Point}
This method returns the center point of this rectangular area
Returns:
{H.geo.Point}
the center point of the area
getWidth () : {number}
Returns this width of this rectangular area in decimal degrees.
Returns:
{number}
the width of this area
getHeight () : {number}
Returns this height of this rectangular area in decimal degrees.
Returns:
{number}
the height of this area
isCDB () : {boolean}
Returns a boolean value indicating whether this rectangular area spans across the date border.
Returns:
172
Maps API for JavaScript Developer's Guide
► API Reference
173
{boolean}
true if the area spans across the date border, otherwise false
isEmpty () : {boolean}
The method checks if the area enclosed by the given bounding box is 0.
Returns:
{boolean}
true if the dimensions of the area a 0, otherwise false
containsLatLng (lat, lng, opt_skipValidation) : {boolean}
This method checks if the latitude and longitude supplied by the caller lie within the area of this
rectangular area.
Parameters:
lat:
{H.geo.Latitude}
the latitude
lng:
{H.geo.Longitude}
the longitude
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{boolean}
true if the latitude and longitude are contained in this area, otherwise false
containsPoint (geoPoint, opt_skipValidation) : {boolean}
This method checks if the point supplied by the caller lies within the area of this rectangular area.
Parameters:
geoPoint:
{H.geo.IPoint}
the point
opt_skipValidation:{boolean=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
a boolean flag indicating whether to check validity of the arguments
Returns:
174
{boolean}
true if the point is contained in this area, otherwise false
containsRect (geoRect, opt_skipValidation) : {boolean}
This method checks if the rectangular area supplied by the caller is completely contained within the
area of this rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
the rectangular area
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{boolean}
true if the rectangular area is contained in this area, otherwise false
mergeLatLng (lat, lng, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the latitude and
longitude supplied by the caller.
Parameters:
lat:
{H.geo.Latitude}
the latitude
lng:
{H.geo.Longitude}
the longitude
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
opt_out:
{H.geo.Rect=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
an optional rectangular area to store the result
Returns:
175
{H.geo.Rect}
either the rectangular area passed as out parameter or a new rectangular
area
mergePoint (geoPoint, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the point
supplied by the caller.
Parameters:
geoPoint:
{H.geo.IPoint}
the point to merge
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
opt_out:
{H.geo.Rect=} [optional]
an optional rectangular area to store the result
Returns:
{H.geo.Rect}
either the rectangular area passed as out parameter or a new rectangular
area
mergeRect (geoRect, opt_skipValidation, opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the rectangular
area supplied by the caller.
Parameters:
geoRect:
{H.geo.Rect}
the point to merge
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Maps API for JavaScript Developer's Guide
► API Reference
opt_out:
{H.geo.Rect=} [optional]
an optional rectangular area to store the result
Returns:
176
{H.geo.Rect}
either the rectangular area passed as out parameter or a new rectangular
area
mergeTopLeftBottomRight (top, left, bottom, right, opt_skipValidation,
opt_out) : {H.geo.Rect}
This method returns the smallest bounding box that covers this rectangular area and the rectangular
area supplied by the caller.
Parameters:
top:
{H.geo.Latitude}
The top latitude of the rectangle to merge
left:
{H.geo.Longitude}
The left longitude of the rectangle to merge
bottom:
{H.geo.Latitude}
The bottom latitude of the rectangle to merge
right:
{H.geo.Longitude}
The right longitude of the rectangle to merge
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
opt_out:
{H.geo.Rect=} [optional]
an optional rectangular area to store the result
Returns:
{H.geo.Rect}
either the rectangular area passed as out parameter or a new rectangular
area
Maps API for JavaScript Developer's Guide
► API Reference
177
intersects (geoRect, opt_skipValidation) : {boolean}
This method checks if the intersection of two bounding boxes is non-empty.
Parameters:
geoRect:
{H.geo.Rect}
a rectangular area to be tested for intersection with this rectangular area
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{boolean}
a boolean value indicating whether the two areas intersect
static merge (topA, leftA, bottomA, rightA, topB, leftB, bottomB, rightB,
opt_out) : {H.geo.Rect}
This method merges two rects by their values. The result of the merge is a bounding rect which
covers all provided rect bounds.
Parameters:
topA:
{H.geo.Latitude}
the northern-most latitude
leftA:
{H.geo.Longitude}
the left-most longitude of operand A
bottomA:
{H.geo.Latitude}
the southern-most latitude of operand A
rightA:
{H.geo.Longitude}
the right-most latitude of operand A
topB:
{H.geo.Latitude}
the northern-most latitude of operand B
leftB:
{H.geo.Longitude}
the left-most longitude of operand B
Maps API for JavaScript Developer's Guide
► API Reference
bottomB:
{H.geo.Latitude}
the southern-most latitude of operand B
rightB:
{H.geo.Longitude}
the right-most latitude of operand B
opt_out:
{H.geo.Rect=} [optional]
an optional rect to store the results
Returns:
178
{H.geo.Rect}
either the opt_out rect or a new rect
static
fromPoints (topLeft, bottomRight, opt_skipValidation) : {H.geo.Rect}
This method creates a rectangular area from a top-left and bottom-right point pair.
Parameters:
topLeft:
{H.geo.IPoint}
the top-left corner of the area
bottomRight:
{H.geo.IPoint}
the bottom-right corner of the area
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{H.geo.Rect}
returns the rectangular area defined by the top-left and bottom-right corners
static
coverPoints (pointArray, opt_skipValidation) : {?H.geo.Rect}
This method creates the minimum rectangular area covering all of the points in the argument array.
Parameters:
pointArray:
{Array<H.geo.IPoint>}
Maps API for JavaScript Developer's Guide
► API Reference
179
the array of points to cover
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{?H.geo.Rect}
returns the minimum rectangular area covering the points or null if no
point is covered
static coverLatLngAlts (latLngAltArray, opt_skipValidation) : {(H.geo.Rect
| undefined)}
This method creates the minimum rectangular area covering all of the coordinates in the argument
array.
Parameters:
latLngAltArray:
{Array<number>}
the array of coordinates to cover
opt_skipValidation:{boolean=} [optional]
a boolean flag indicating whether to check validity of the arguments
Returns:
{(H.geo.Rect | undefined)}
returns the minimum rectangular area covering the coordinates
static coverRects (rectArray, opt_skipValidation) : {(H.geo.Rect |
undefined)}
This method creates the minimum rectangular area covering all of the rectangular areas in the
argument array.
Parameters:
rectArray:
{Array<H.geo.Rect>}
the array of points to cover
opt_skipValidation:{boolean=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
a boolean flag indicating whether to check validity of the arguments
Returns:
{(H.geo.Rect | undefined)}
returns the minimum rectangular area covering the rectangular areas
resizeToCenter (center, opt_out) : {H.geo.Rect}
This method clones the given bounding rect and resizes the clone if necessary until the location
supplied by the caller is at its center.
Parameters:
center:
{H.geo.IPoint}
a point which is to be the center of the resized rectangular area
opt_out:
{H.geo.Rect=} [optional]
an optional rectangular area to store the result
Returns:
{H.geo.Rect}
the resized rectangular area
Class: Strip
This class is a member of the namespace
H.geo .
Class Summary
A strip is a flat list of latitude, longitude, altitude tuples in a fixed order.
[ For full details, see the Class Details ]
Method Summary
Table 43: Methods
Methods
pushLatLngAlt (lat, lng, alt)
180
Maps API for JavaScript Developer's Guide
► API Reference
181
Methods
This method pushes a lat, lng, alt to the end of this strip.
spliceLatLngAlts (index, opt_nRemove, opt_latLngAlts) : {Array<number>}
This method splices the strip at the provided index, removing the specified number of items at that index and inserting the
lat, lng, alt array.
insertLatLngAlt (index, lat, lng, alt)
This method inserts one set of lat, lng, alt values into the strip at the specified index.
removeLatLngAlt (index)
This method removes one set of lat, lng, alt values from the strip at the specified index.
pushPoint (geoPoint)
This method pushes the lat, lng, alt values of a H.geo.Point to the end of this strip.
insertPoint (pointIndex, geoPoint)
This method inserts the lat, lng, alt values of a H.geo.Point into the list at the specified index.
removePoint (pointIndex)
This method removes one set of lat, lng, alt values from this strip at the virtual point index specified.
extractPoint (pointIndex, opt_out) : {H.geo.Point}
This method extracts a H.geo.Point from this strip at the virtual point index. If the extracted point has an alt value, the strip's
altitude context will be supplied to the point.
eachLatLngAlt (eachFn, opt_start, opt_end)
This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements
passing lat, lng and alt and the virtual point index as arguments.
getDBCs (opt_closed) : {number}
This method returns the number of times that legs in this strip cross the date border.
getPointCount () : {number}
This method return the number of points stored in this strip.
getLatLngAltArray () : {Array<number>}
This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can destroy the integrity
of this strip. Use it only for read access.
getBounds () : {?H.geo.Rect}
This method returns the bounding box of this strip.
static
isDBC (lng1, lng2) : {boolean}
This method checks whether two longitudes form a leg which crosses the date border.
Maps API for JavaScript Developer's Guide
► API Reference
182
Methods
static
fromLatLngArray (latLngs) : {H.geo.Strip}
This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even length with the format
[lat, lng, lat, lng, ...].
Class Description
A strip is a flat list of latitude, longitude, altitude tuples in a fixed order.
Constructor Details
H.geo.Strip(opt_latLngAlts, opt_ctx)
Parameters:
opt_latLngAlts:
{Array<number>=} [optional]
An optional array of latitude, longitude and altitude triples to initialize the
strip with.
opt_ctx:
{H.geo.AltitudeContext=} [optional]
An optional altitude context for all altitudes contained in this strip.
Method Details
pushLatLngAlt (lat, lng, alt)
This method pushes a lat, lng, alt to the end of this strip.
Parameters:
lat:
{H.geo.Latitude}
lng:
{H.geo.Longitude}
alt:
{H.geo.Altitude}
spliceLatLngAlts (index, opt_nRemove, opt_latLngAlts) : {Array<number>}
Maps API for JavaScript Developer's Guide
► API Reference
183
This method splices the strip at the provided index, removing the specified number of items at that
index and inserting the lat, lng, alt array.
Parameters:
index:
{number}
The index at which to splice
opt_nRemove:
{number=} [optional]
The number of lat, lng, alt values to remove
opt_latLngAlts:
{Array<number>=} [optional]
The lat, lng, alt values to add
Returns:
{Array<number>}
an array of removed elements
insertLatLngAlt (index, lat, lng, alt)
This method inserts one set of lat, lng, alt values into the strip at the specified index.
Parameters:
index:
{number}
the index at which to add the element
lat:
{H.geo.Latitude}
the latitude to insert
lng:
{H.geo.Longitude}
the longitude to insert
alt:
{H.geo.Altitude}
the altitude to insert
removeLatLngAlt (index)
This method removes one set of lat, lng, alt values from the strip at the specified index.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
index:
184
{number}
pushPoint (geoPoint)
This method pushes the lat, lng, alt values of a H.geo.Point to the end of this strip.
Parameters:
geoPoint:
{H.geo.IPoint}
insertPoint (pointIndex, geoPoint)
This method inserts the lat, lng, alt values of a H.geo.Point into the list at the specified index.
Parameters:
pointIndex:
{number}
geoPoint:
{H.geo.IPoint}
removePoint (pointIndex)
This method removes one set of lat, lng, alt values from this strip at the virtual point index specified.
Parameters:
pointIndex:
{number}
the virtual point index
extractPoint (pointIndex, opt_out) : {H.geo.Point}
This method extracts a H.geo.Point from this strip at the virtual point index. If the extracted point has
an alt value, the strip's altitude context will be supplied to the point.
Parameters:
pointIndex:
{number}
the virtual point index in the strip
opt_out:
{H.geo.Point=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
an optional point object to store the lat, lng, alt values
Returns:
185
{H.geo.Point}
returns either the 'opt_out' point object or a new point object.
eachLatLngAlt (eachFn, opt_start, opt_end)
This method is a utility method that iterates over the lat, lng, alt array and calls the provided function
for each 3 elements passing lat, lng and alt and the virtual point index as arguments.
Example
var eachFn = function(lat, lng, alt, idx) {
console.log("point", idx + ":", lat, lng, alt);
}
myStrip.eachLatLngAlt(eachFn); //iterates over each point and logs its
latitude and longitude
Parameters:
eachFn:
{function(H.geo.Latitude, H.geo.Longitude,
H.geo.Altitude, number)}
the function to be called for each 3 elements
opt_start:
{number=} [optional]
an optional start index to iterate from
opt_end:
{number=} [optional]
an optional end index to iterate to
getDBCs (opt_closed) : {number}
This method returns the number of times that legs in this strip cross the date border.
Parameters:
opt_closed:
{boolean=} [optional]
indicates whether the strip is closed (i.e. whether the strip's last and first coordinates form the closing leg of a polygon)
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
186
{number}
the amount of times this strip crosses the date border.
getPointCount () : {number}
This method return the number of points stored in this strip.
Returns:
{number}
the number of points in this strip
getLatLngAltArray () : {Array<number>}
This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can
destroy the integrity of this strip. Use it only for read access.
Returns:
{Array<number>}
returns the raw lat, lng, alt values of this strip
getBounds () : {?H.geo.Rect}
This method returns the bounding box of this strip.
Note: The strip is treated as an open path. If the bounding rectangle for a closed shape is required,
the closing leg must be merged in an extra step.
Returns:
{?H.geo.Rect}
this strip's bounding rectangle
static
isDBC (lng1, lng2) : {boolean}
This method checks whether two longitudes form a leg which crosses the date border.
Parameters:
lng1:
{H.geo.Longitude}
the start longitude of the leg
lng2:
{H.geo.Longitude}
the end longitude of the leg
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
187
{boolean}
true if the leg crosses the date border, otherwise false
static
fromLatLngArray (latLngs) : {H.geo.Strip}
This method initializes a new strip with an array of lat, lng values. Arrays are expected to have an even
length with the format [lat, lng, lat, lng, ...].
Parameters:
latLngs:
{Array<number>}
the array of lat, lng value.
Returns:
{H.geo.Strip}
the strip containing the lat, lng values
Namespace: lang
Namespace Summary
Contains implementation for the base library definitions and error handling
Namespace Description
Contains implementation for the base library definitions and error handling
Class: IllegalOperationError
This class is a member of the namespace
H.lang .
Class Summary
An error to throw if an illegal operation happens
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
188
Class Description
An error to throw if an illegal operation happens
Example
Foo.prototype.bar = function() {
if(this.isDisposed()) {
throw new H.lang.IllegalOperationError(H.Foo.prototype.bar, 'Instance
already disposed');
}
}
Constructor Details
H.lang.IllegalOperationError(opt_caller, opt_message)
Parameters:
opt_caller:
{Function=} [optional]
The calling function
opt_message:
{*=} [optional]
Class: InvalidArgumentError
This class is a member of the namespace
H.lang .
Class Summary
An error to throw if an argument is invalid
[ For full details, see the Class Details ]
Class Description
An error to throw if an argument is invalid
Example
H.Foo.prototype.bar = function(array, idx) {
if(idx < 0) throw new H.lang.InvalidArgumentError(
H.Foo.prototype.bar, 2, 'less then 0');
}
Maps API for JavaScript Developer's Guide
► API Reference
new H.Foo().bar([], -4711); // ==> 'Invalid Argument: H.Foo#bar
"idx" (-4711) less then 0
Constructor Details
H.lang.InvalidArgumentError(opt_caller, opt_argNr, opt_message)
Parameters:
opt_caller:
{Function=} [optional]
The calling function
opt_argNr:
{?number=} [optional]
The number of the invalid argument (zero based)
opt_message:
{*=} [optional]
Class: OutOfRangeError
This class is a member of the namespace
H.lang .
Class Summary
An error to throw if an value is out of range
[ For full details, see the Class Details ]
Class Description
An error to throw if an value is out of range
Example
H.Foo.prototype.bar = function(array, idx) {
if(idx < 0) throw new H.lang.OutOfRangeError(
H.Foo.prototype.bar, 2, 0, array.length - 1);
}
new H.Foo().bar([0, 1], -4); // ==> 'OutOfrange: H.Foo#bar (-4 out of
[0...1])
Constructor Details
H.lang.OutOfRangeError(opt_caller, opt_val, opt_range)
189
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
opt_caller:
{Function=} [optional]
The calling function
opt_val:
{number=} [optional]
190
opt_range:
{Array<number>=} [optional]
The range's values as [min, max]
Namespace: map
Namespace Summary
This namespace contains interfaces and implementation classes of map-related functionality of the
Maps API.
Namespace Description
This namespace contains interfaces and implementation classes of map-related functionality of the
Maps API.
Class: AbstractMarker
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Object
This class represents marker, which offers a means of identifying a location on the map with an icon.
[ For full details, see the Class Details ]
Method Summary
Table 44: Methods
Methods
getPosition () : {H.geo.Point}
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This method returns this marker's current position.
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
191
Maps API for JavaScript Developer's Guide
► API Reference
192
Methods
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 45: Events
Events
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
This class represents marker, which offers a means of identifying a location on the map with an icon.
Maps API for JavaScript Developer's Guide
► API Reference
A marker consists of a geographic location and a visual representation in the form of a bitmap
or a DOM element. Markers are rendered in screen space, i.e. while they are always fixed to their
geographic location their icon is always rendered independently of the map's zoom level.
Constructor Details
H.map.AbstractMarker(position, opt_options)
Parameters:
position:
{H.geo.IPoint}
The location of this marker
opt_options:
{H.map.AbstractMarker.Options=} [optional]
The values to initialize this marker
Method Details
getPosition () : {H.geo.Point}
This method returns this marker's current position.
Returns:
{H.geo.Point}
current marker geo position
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
Parameters:
position:
{H.geo.IPoint}
Returns:
{H.map.AbstractMarker}
the marker itself
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
193
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{!(H.map.Icon | H.map.DomIcon)}
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
Parameters:
icon:
{!(H.map.Icon | H.map.DomIcon)}
The new marker icon
Returns:
{H.map.AbstractMarker}
the marker itself
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
194
Maps API for JavaScript Developer's Guide
► API Reference
195
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
196
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
197
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
198
Maps API for JavaScript Developer's Guide
► API Reference
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
199
Maps API for JavaScript Developer's Guide
► API Reference
Type definition: Options
This type definition is a member of the class
H.map.AbstractMarker .
Type Definition Summary
Options used to initialize a AbstractMarker
[ For full details, see the Type Definition Details ]
Property Summary
Table 46: Properties
Properties
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
visibility
Indicates whether the map object is visible at all, default is true.
zIndex
The z-index value of the map object, default is 0
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
icon
The icon to use for the visual representation, if omitted a default icon is used.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData.
Type Definition Description
Options used to initialize a AbstractMarker
200
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
visibility: {boolean=} [optional]
Indicates whether the map object is visible at all, default is true.
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
icon: {(H.map.Icon | H.map.DomIcon)=} [optional]
The icon to use for the visual representation, if omitted a default icon is used.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData.
Class: ArrowStyle
This class is a member of the namespace
H.map .
Class Summary
This class represents style attributes for arrows to be rendered along a polyline. A ArrowStyle
instance is always treated as immutable to avoid inconstiencies and must not modified.
[ For full details, see the Class Details ]
Method Summary
Table 47: Methods
Methods
equals (other) : {boolean}
201
Maps API for JavaScript Developer's Guide
► API Reference
202
Methods
This method checks value-equality with another arrow style.
Class Description
This class represents style attributes for arrows to be rendered along a polyline. A ArrowStyle
instance is always treated as immutable to avoid inconstiencies and must not modified.
Constructor Details
H.map.ArrowStyle(opt_options)
Parameters:
opt_options:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
Method Details
equals (other) : {boolean}
This method checks value-equality with another arrow style.
Parameters:
other:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)}
the arrow style to compare with
Returns:
{boolean}
true if the arrow styles are value-equal, otherwise false
Type definition: Options
This type definition is a member of the class
H.map.ArrowStyle .
Type Definition Summary
An object type to specify the style of arrows to render along a polyline
Maps API for JavaScript Developer's Guide
► API Reference
203
[ For full details, see the Type Definition Details ]
Property Summary
Table 48: Properties
Properties
fillColor
The CSS color value used to fill the arrow shapes. If omitted or the value evaluates to false it defaults to "rgba(255,
255, 255, 0.75)"
width
The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. If
omitted or the value is <= 0 it defaults to 1.2
length
The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn.
If omitted or the value is <= 0 it defaults to 1.6
frequency
The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows.
If omitted or the value is false it defaults to 5
Type Definition Description
An object type to specify the style of arrows to render along a polyline
Property Details
fillColor: {string=} [optional]
The CSS color value used to fill the arrow shapes. If omitted or the value evaluates to false it
defaults to "rgba(255, 255, 255, 0.75)"
width: {number=} [optional]
The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow
description is applied. If omitted or the value is <= 0 it defaults to 1.2
length: {number=} [optional]
The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of
which the arrow is drawn. If omitted or the value is <= 0 it defaults to 1.6
frequency: {number=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
204
The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1
results in gapless arrows. If omitted or the value is false it defaults to 5
Class: ChangeEvent
This class is a member of the namespace
H.map .
Class Summary
Extends: H.util.ChangeEvent
An Event to signalize map related changes.
[ For full details, see the Class Details ]
Property Summary
Table 49: Properties
Properties
target : {*}
Object which triggered the event
currentTarget : {*}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 50: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Maps API for JavaScript Developer's Guide
► API Reference
205
Class Description
An Event to signalize map related changes.
Constructor Details
H.map.ChangeEvent(type, newValue, oldValue, modifiers)
Parameters:
type:
{string}
The type of the event
newValue:
{Object}
The view values that were set after the change
oldValue:
{Object}
The view values that were set before the change
modifiers:
{H.math.BitMask}
Indicates which values were changed. See properties FOV, PITCH, POSITION,
ROLL, SIZE, YAW and ZOOM for the meaning of the bits.
Property Details
target: {*}
Object which triggered the event
currentTarget: {*}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
Maps API for JavaScript Developer's Guide
► API Reference
206
stopPropagation ()
Stops propagation for current event.
Class: Circle
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Polygon
A Polygon with a circular shape.
[ For full details, see the Class Details ]
Method Summary
Table 51: Methods
Methods
setCenter (center)
To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify
this Point instance without calling setCenter immediately afterwards.
getCenter () : {H.geo.Point}
To get the center point of this circle You must not modify the returned Point instance without calling setCenter immediately
afterwards.
setRadius (radius)
To set the length of the radius of the circle in meters. The value is clamped to the of {@code[0 ... 20015089.27787877]}
(half WGS84 mean circumference)
getRadius () : {number}
To get the length of the radius of the circle in meters.
setPrecision (precision)
To set the precision of this circle {@see H.map.Circle.Options#precision}
getPrecision () : {number}
To get the precision value of this circle
setNorthPoleCovering (flag) : {H.map.Polygon}
Maps API for JavaScript Developer's Guide
► API Reference
207
Methods
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines
arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional
information is needed to know if the southern or northern part of the world should be covered by the poygon.
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
clip (geoRect, projection) : {Array<Array<number>>}
This method clips this polygon against a rectangular area. This method will take polygons crossing the date border into
account duplicate the shape in the returned list of intersecting strips.
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points
of the spatial object.
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Maps API for JavaScript Developer's Guide
► API Reference
Methods
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
208
Maps API for JavaScript Developer's Guide
► API Reference
209
Methods
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 52: Events
Events
stripchange : {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
A Polygon with a circular shape.
Constructor Details
H.map.Circle(center, radius, opt_options)
Parameters:
center:
{H.geo.IPoint}
The geographical coordinates of the circle's center
Maps API for JavaScript Developer's Guide
► API Reference
210
radius:
{number}
The radius of the circle in meters
opt_options:
{H.map.Circle.Options=} [optional]
An object that specifies circle options and their initial values (among these,
precision has a significant impact on the shape of the circle - please see
Method Details
setCenter (center)
To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point
you must not modify this Point instance without calling setCenter immediately afterwards.
Parameters:
center:
{H.geo.IPoint}
getCenter () : {H.geo.Point}
To get the center point of this circle You must not modify the returned Point instance without calling
setCenter immediately afterwards.
Returns:
{H.geo.Point}
setRadius (radius)
To set the length of the radius of the circle in meters. The value is clamped to the of {@code[0 ...
20015089.27787877]} (half WGS84 mean circumference)
Parameters:
radius:
{number}
getRadius () : {number}
To get the length of the radius of the circle in meters.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
211
{number}
setPrecision (precision)
To set the precision of this circle {@see H.map.Circle.Options#precision}
Parameters:
precision:
{number}
getPrecision () : {number}
To get the precision value of this circle
Returns:
{number}
setNorthPoleCovering (flag) : {H.map.Polygon}
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip
is defined as lines arround the world on longitude axis (for example a circle whose center is one of the
poles). In this case a additional information is needed to know if the southern or northern part of the
world should be covered by the poygon.
Parameters:
flag:
{boolean}
A value of true means it covers the north pole, false means south pole
Returns:
{H.map.Polygon}
the Polygon instance itself
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
Returns:
{boolean}
clip (geoRect, projection) : {Array<Array<number>>}
Maps API for JavaScript Developer's Guide
► API Reference
212
This method clips this polygon against a rectangular area. This method will take polygons crossing
the date border into account duplicate the shape in the returned list of intersecting strips.
Parameters:
geoRect:
{H.geo.Rect}
the rectangular area against which to clip
projection:
{H.geo.PixelProjection}
a projection to use for bounding box padding
Returns:
{Array<Array<number>>}
a list of arrays with alternating lat, lng values.
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
Returns:
{H.geo.Strip}
the strip
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
Parameters:
strip:
{?H.geo.Strip}
The strip which represents the shape of the spatial object.
Returns:
{H.map.GeoShape}
the Spatial instance itself
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle
which encloses all points of the spatial object.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
213
{H.geo.Rect}
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
opt_arrows:
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
{boolean}
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
Returns:
214
Maps API for JavaScript Developer's Guide
► API Reference
215
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
216
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
217
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
218
Maps API for JavaScript Developer's Guide
► API Reference
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
stripchange: {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange: {H.util.ChangeEvent}
219
Maps API for JavaScript Developer's Guide
► API Reference
220
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.Circle .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 53: Properties
Properties
style
the style to be used when tracing the polyline
visibility
An optional boolean value indicating whether this map object is visible, default is true
precision
The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range
between [4 ... 360], where 60 is the default. Note that the lower the value the more angular and the less circle-like the shape
appears and, conversely, the higher the value the smoother and more rounded the result. Thus, starting at the extreme
low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears
increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth circle.
zIndex
The z-index value of the circle, default is 0
min
The minimum zoom level for which the circle is visible, default is -Infinity
max
The maximum zoom level for which the circle is visible, default is Infinity
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
Maps API for JavaScript Developer's Guide
► API Reference
221
Properties
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData
Type Definition Description
Property Details
style: {H.map.SpatialStyle=} [optional]
the style to be used when tracing the polyline
visibility: {boolean=} [optional]
An optional boolean value indicating whether this map object is visible, default is true
precision: {number=} [optional]
The precision of a circle as a number of segments to be used when rendering the circle. The value
is clamped to the range between [4 ... 360], where 60 is the default. Note that the lower the value
the more angular and the less circle-like the shape appears and, conversely, the higher the value
the smoother and more rounded the result. Thus, starting at the extreme low end of the possible
values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears
increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth
circle.
zIndex: {number=} [optional]
The z-index value of the circle, default is 0
min: {number=} [optional]
The minimum zoom level for which the circle is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the circle is visible, default is Infinity
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData
Maps API for JavaScript Developer's Guide
► API Reference
222
Class: DataModel
This class is a member of the namespace
H.map .
Class Summary
Extends: H.util.OList
The class represents data model of the map. It holds list of layers that are rendered by map's
RenderEngine. The class listens to 'update' events from layers and dispatches them to the
RenderEngine.
[ For full details, see the Class Details ]
Method Summary
Table 54: Methods
Methods
add (layer, opt_idx)
This method adds layer to the data model, which will result in displaying the layer on the map respecting the order in which
they were added.
set (idx, layer) : {H.map.layer.Layer}
removeAt (idx) : {H.map.layer.Layer}
This method removes layer with the given index. This will effectively remove the layer from the map.
remove (layer) : {boolean}
This method removes a given layer. This will effectively remove the layer from the map.
flush ()
This method removes all layers from data model.
indexOf (entry) : {number}
This method retrieves the index of the first object in this list that is identical with the object supplied by the caller.
get (idx) : {?}
To get the entry at the specified index.
getLength () : {number}
This method returns the length of the list.
asArray () : {Array<*>}
Maps API for JavaScript Developer's Guide
► API Reference
223
Methods
This method returns all list's entries as an array.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 55: Events
Events
add : {H.util.OList.Event}
Fired when an entry was added to the list.
remove : {H.util.OList.Event}
Fired when an entry was removed from the list.
set : {H.util.OList.Event}
Fired when an entry was set in the list.
move : {H.util.OList.Event}
Fired when an entry was moved within the list.
Maps API for JavaScript Developer's Guide
► API Reference
Class Description
The class represents data model of the map. It holds list of layers that are rendered by map's
RenderEngine. The class listens to 'update' events from layers and dispatches them to the
RenderEngine.
Constructor Details
H.map.DataModel(opt_layers)
Parameters:
opt_layers:
{Array=} [optional]
array of layers to be added to the data model
Method Details
add (layer, opt_idx)
This method adds layer to the data model, which will result in displaying the layer on the map
respecting the order in which they were added.
Parameters:
layer:
{H.map.layer.Layer}
The Layer to add
opt_idx:
{number=} [optional]
index where the new element should be inserted
set (idx, layer) : {H.map.layer.Layer}
Parameters:
idx:
{number}
layer:
{H.map.layer.Layer}
Returns:
{H.map.layer.Layer}
224
Maps API for JavaScript Developer's Guide
► API Reference
225
removeAt (idx) : {H.map.layer.Layer}
This method removes layer with the given index. This will effectively remove the layer from the map.
Parameters:
idx:
{number}
index of the layer to be removed
Returns:
{H.map.layer.Layer}
remove (layer) : {boolean}
This method removes a given layer. This will effectively remove the layer from the map.
Parameters:
layer:
{H.map.layer.Layer}
The layer to be removed
Returns:
{boolean}
signals if the layer could be found in the list and is removed
flush ()
This method removes all layers from data model.
indexOf (entry) : {number}
This method retrieves the index of the first object in this list that is identical with the object supplied
by the caller.
Parameters:
entry:
{?}
The entry for which to return the index.
Returns:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
226
The index of the first matching entry in this list or -1 if the entry provided by
the caller is not found in the list
get (idx) : {?}
To get the entry at the specified index.
Parameters:
idx:
{number}
The index of the entry to get a negative index is treated as being relative
from the end of the list
Returns:
{?}
The element at the given index
getLength () : {number}
This method returns the length of the list.
Returns:
{number}
asArray () : {Array<*>}
This method returns all list's entries as an array.
Returns:
{Array<*>}
The list as an array
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
Maps API for JavaScript Developer's Guide
► API Reference
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
227
Maps API for JavaScript Developer's Guide
► API Reference
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
add: {H.util.OList.Event}
Fired when an entry was added to the list.
remove: {H.util.OList.Event}
Fired when an entry was removed from the list.
set: {H.util.OList.Event}
Fired when an entry was set in the list.
move: {H.util.OList.Event}
Fired when an entry was moved within the list.
228
Maps API for JavaScript Developer's Guide
► API Reference
229
Class: DomIcon
This class is a member of the namespace
H.map .
Class Summary
A visual representation of the H.map.DomMarker.
[ For full details, see the Class Details ]
Class Description
A visual representation of the H.map.DomMarker.
DomIcon needs to be created with a dom element. Dom element works as a template for visual
representation of the marker therefore single DomIcon can be reused across multiple DomMarkers.
Provided dom node gets cloned and rendered every time when marker reaches (is visible within) the
map view port therefore all previously attached event listeners will not execute. To handle cases
where listeners for the dom node are in needed, user needs to add them within onAttach callback
were currently displayed clone reference is available. Within onDetach callback, cloned node listener
can be removed.
The onAttach and onDetach callbacks can be provided to the icon by using H.map.DomIcon.Options
Example
var domElement = document.createElement('div');
domElement.style.width = '20px';
domElement.style.height = '20px';
domElement.style.backgroundColor = 'blue';
function changeOpacity(evt) {
evt.target.style.opacity = 0.8;
};
var domIcon = new H.map.DomIcon(domElement, {
onAttach: function(clonedElement, domIcon, domMarker) {
clonedElement.addEventListener('mouseover', changeOpacity);
},
onDetach: function(clonedElement, domIcon, domMarker) {
clonedElement.removeEventListener('mouseover', changeOpacity);
}
});
Maps API for JavaScript Developer's Guide
► API Reference
230
Constructor Details
H.map.DomIcon(element, opt_options)
Parameters:
element:
{!(Element | string)}
The element or markup to use for this icon
opt_options:
{H.map.DomIcon.Options=} [optional]
Type definition: Options
This type definition is a member of the class
H.map.DomIcon .
Type Definition Summary
Options used to initialize a DomIcon
[ For full details, see the Type Definition Details ]
Property Summary
Table 56: Properties
Properties
onAttach
A callback which is invoked before a clone of the icon's element is appended and displayed on the map. This callback can be
used to setup the clone.
onDetach
A callback which is invoked after a clone of the icon's element is removed from the map. This callback can be used to clean
up the clone.
Type Definition Description
Options used to initialize a DomIcon
Property Details
onAttach: {function(Element, H.map.DomIcon, H.map.DomMarker)=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
231
A callback which is invoked before a clone of the icon's element is appended and displayed on the
map. This callback can be used to setup the clone.
onDetach: {function(Element, H.map.DomIcon, H.map.DomMarker)=} [optional]
A callback which is invoked after a clone of the icon's element is removed from the map. This callback
can be used to clean up the clone.
Class: DomMarker
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.AbstractMarker
A marker with a visual representation in the form of a full styleable and scripteable DOM element.
DomMarker are predestinated if small amounts of markers with dynamic styled and/or scripted icons
should be displayed om the map (e.g. animated interactive SVG).
[ For full details, see the Class Details ]
Method Summary
Table 57: Methods
Methods
getPosition () : {H.geo.Point}
This method returns this marker's current position.
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Maps API for JavaScript Developer's Guide
► API Reference
Methods
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
232
Maps API for JavaScript Developer's Guide
► API Reference
233
Methods
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 58: Events
Events
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
A marker with a visual representation in the form of a full styleable and scripteable DOM element.
DomMarker are predestinated if small amounts of markers with dynamic styled and/or scripted icons
should be displayed om the map (e.g. animated interactive SVG).
Constructor Details
H.map.DomMarker(position, opt_options)
Parameters:
position:
{H.geo.IPoint}
opt_options:
{H.map.DomMarker.Options=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
Method Details
getPosition () : {H.geo.Point}
This method returns this marker's current position.
Returns:
{H.geo.Point}
current marker geo position
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
Parameters:
position:
{H.geo.IPoint}
Returns:
{H.map.AbstractMarker}
the marker itself
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
Returns:
{!(H.map.Icon | H.map.DomIcon)}
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
Parameters:
icon:
{!(H.map.Icon | H.map.DomIcon)}
The new marker icon
Returns:
{H.map.AbstractMarker}
234
Maps API for JavaScript Developer's Guide
► API Reference
235
the marker itself
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
Maps API for JavaScript Developer's Guide
► API Reference
236
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
237
Maps API for JavaScript Developer's Guide
► API Reference
238
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
239
Maps API for JavaScript Developer's Guide
► API Reference
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.DomMarker .
Type Definition Summary
Options used to initialize a DomMarker
[ For full details, see the Type Definition Details ]
Property Summary
Table 59: Properties
Properties
min
The minimum zoom level for which the object is visible, default is -Infinity
max
240
Maps API for JavaScript Developer's Guide
► API Reference
Properties
The maximum zoom level for which the object is visible, default is Infinity
visibility
Indicates whether the map object is visible at all, default is true.
zIndex
The z-index value of the map object, default is 0
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
icon
The icon to use for the visual representation, if omitted a default icon is used.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData
Type Definition Description
Options used to initialize a DomMarker
Property Details
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
visibility: {boolean=} [optional]
Indicates whether the map object is visible at all, default is true.
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
icon: {H.map.DomIcon=} [optional]
241
Maps API for JavaScript Developer's Guide
► API Reference
242
The icon to use for the visual representation, if omitted a default icon is used.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData
Class: GeoShape
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Spatial
This class represents a spatial shape in geographic space. It is defined by a path containing the
vertices of the shape (lat, lng, alt values).
[ For full details, see the Class Details ]
Method Summary
Table 60: Methods
Methods
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points
of the spatial object.
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
getArrows () : {(H.map.ArrowStyle | undefined)}
Maps API for JavaScript Developer's Guide
► API Reference
Methods
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
243
Maps API for JavaScript Developer's Guide
► API Reference
244
Methods
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 61: Events
Events
stripchange : {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Maps API for JavaScript Developer's Guide
► API Reference
Class Description
This class represents a spatial shape in geographic space. It is defined by a path containing the
vertices of the shape (lat, lng, alt values).
Constructor Details
H.map.GeoShape(isClosed, strip, options)
Parameters:
isClosed:
{boolean}
Indicates whether this geographical shape is closed (a polygon)
strip:
{H.geo.Strip}
The strip describing the shape of the spatial object
options:
{H.map.Spatial.Options}
The options to apply
Method Details
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
Returns:
{H.geo.Strip}
the strip
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
Parameters:
strip:
{?H.geo.Strip}
The strip which represents the shape of the spatial object.
Returns:
{H.map.GeoShape}
245
Maps API for JavaScript Developer's Guide
► API Reference
246
the Spatial instance itself
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle
which encloses all points of the spatial object.
Returns:
{H.geo.Rect}
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
247
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
Parameters:
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
Returns:
{boolean}
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
248
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
The other map object to compare with
Returns:
249
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
250
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
251
Maps API for JavaScript Developer's Guide
► API Reference
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
252
Maps API for JavaScript Developer's Guide
► API Reference
253
Event Details
stripchange: {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Class: Group
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Object
This class represents a map object which can contain other map objects. It's visibility, zIndex and
object-order influences the contained map objects
[ For full details, see the Class Details ]
Method Summary
Table 62: Methods
Methods
forEach (callback, opt_recursive, opt_context)
To invokes a provided callback once per object in add order. The function is invoked with the following arguments:
•
the currently traversed object
•
the index of the object
•
the group itself
getObjects (opt_recursive) : {!Array<!H.map.Object>}
To get a list of all objects of this group. On groups with many chilren this method can cause a higher memory and CPU
consumption. Alternatively you case use H.map.Group#forEach
getBounds () : {H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
254
Methods
Method returns the bounding rectangle for the group. The rectangle is the smallest rectangle that covers all objects. If group
doesn't contains objects method returns null.
addObject (object) : {!H.map.Object}
To add an object to this group.
addObjects (objects)
Appends a list of objects to this group
removeObject (object) : {!H.map.Object}
Removes an object from this group.
removeObjects (objects)
Removes objects from this group.
removeAll ()
Method removes all objects from the group.
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Maps API for JavaScript Developer's Guide
► API Reference
255
Methods
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 63: Events
Events
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Maps API for JavaScript Developer's Guide
► API Reference
256
Events
Fired when this object's z-index changes
Class Description
This class represents a map object which can contain other map objects. It's visibility, zIndex and
object-order influences the contained map objects
Constructor Details
H.map.Group(opt_options)
Parameters:
opt_options:
{H.map.Group.Options=} [optional]
an optional object containing initialization values
Method Details
forEach (callback, opt_recursive, opt_context)
To invokes a provided callback once per object in add order. The function is invoked with the
following arguments:
•
the currently traversed object
•
the index of the object
•
the group itself
Parameters:
callback:
{function(!H.map.Object, number, !H.map.Group)}
opt_recursive:
{boolean=} [optional]
Indicates whether sub groups should be traversed recursively
opt_context:
{*=} [optional]
The context to use as "this" within the callback
getObjects (opt_recursive) : {!Array<!H.map.Object>}
Maps API for JavaScript Developer's Guide
► API Reference
257
To get a list of all objects of this group. On groups with many chilren this method can cause a higher
memory and CPU consumption. Alternatively you case use H.map.Group#forEach
Parameters:
opt_recursive:
{boolean=} [optional]
Indicates whether objects in sub-groups are also collected .
Returns:
{!Array<!H.map.Object>}
getBounds () : {H.geo.Rect}
Method returns the bounding rectangle for the group. The rectangle is the smallest rectangle that
covers all objects. If group doesn't contains objects method returns null.
Returns:
{H.geo.Rect}
geo ractangle that covers all objects in the group
addObject (object) : {!H.map.Object}
To add an object to this group.
Parameters:
object:
{!H.map.Object}
Returns:
{!H.map.Object}
a reference to the appended object
addObjects (objects)
Appends a list of objects to this group
Parameters:
objects:
{Array<!H.map.Object>}
Maps API for JavaScript Developer's Guide
► API Reference
removeObject (object) : {!H.map.Object}
Removes an object from this group.
Parameters:
object:
{!H.map.Object}
The object to remove
Returns:
{!H.map.Object}
a reference to the removed object
removeObjects (objects)
Removes objects from this group.
Parameters:
objects:
{!Array<!H.map.Object>}
The list of objects to remove
removeAll ()
Method removes all objects from the group.
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
258
Maps API for JavaScript Developer's Guide
► API Reference
259
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
other:
{H.map.Object}
The other map object to compare with
Returns:
260
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
261
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
262
Maps API for JavaScript Developer's Guide
► API Reference
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
263
Maps API for JavaScript Developer's Guide
► API Reference
Event Details
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.Group .
Type Definition Summary
Options used to initialize a group
[ For full details, see the Type Definition Details ]
Property Summary
Table 64: Properties
Properties
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
visibility
Indicates whether the map object is visible, default is true
zIndex
The z-index value of the map object, default is 0
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData.
objects
264
Maps API for JavaScript Developer's Guide
► API Reference
265
Properties
A list of map objects to add initially to this group.
Type Definition Description
Options used to initialize a group
Property Details
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
visibility: {boolean=} [optional]
Indicates whether the map object is visible, default is true
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData.
objects: {Array<H.map.Object>=} [optional]
A list of map objects to add initially to this group.
Class: HitArea
This class is a member of the namespace
H.map .
Class Summary
This class represents an area that objects, like a marker, occupies in the screen space, meaning that
object can be probed and returned by H.Map@getObjectsAt method.
Maps API for JavaScript Developer's Guide
► API Reference
266
[ For full details, see the Class Details ]
Class Description
This class represents an area that objects, like a marker, occupies in the screen space, meaning that
object can be probed and returned by H.Map@getObjectsAt method.
Constructor Details
H.map.HitArea(shapeType, opt_values)
Parameters:
shapeType:
{H.map.HitArea.ShapeType}
The shape type of the HitArea
opt_values:
{Array<number>=} [optional]
The type-dependent values to define the shape of the hit area. The format
for the different types are:
Enumeration: ShapeType
This enumeration is a member of the class
H.map.HitArea .
Enumeration Summary
Enumeration represents possible shape types that HitArea can have.
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 65: Constants
Constants
static
NONE
static
RECT
static
CIRCLE
static
POLYGON
Maps API for JavaScript Developer's Guide
► API Reference
267
Enumeration Details
Enumeration represents possible shape types that HitArea can have.
Enumeration Constants Details
static NONE
static RECT
static CIRCLE
static POLYGON
Interface: IControl
This interface is a member of the namespace
H.map .
Interface Summary
Control interface defines method which are used for direct view or camera manipulation
[ For full details, see the Interface Details ]
Method Summary
Table 66: Methods
Methods
startControl (opt_kinetics, opt_atX, opt_atY)
This method starts control action for camera. This action allows to control camera animation and movement according to
provided values in the H.map.IControl#control function
control (moveX, moveY, moveZ, angleX, angleY, angleZ, zoom, opt_timestamp)
This method triggers single control action on engine. This will trigger an animation which will start modification of the view's
or camera's properties according to values begin set. Modification will occur at every frame. The speed values are measure
by 'levels per frame' were 1 level cooresponds to a distance to next zoom level.
endControl (opt_preventKinetics, opt_adjustView)
This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can
prevent kinetics as well as it can adjust the final view if the adjust function is being passed.
Maps API for JavaScript Developer's Guide
► API Reference
268
Interface Description
Control interface defines method which are used for direct view or camera manipulation
Method Details
startControl (opt_kinetics, opt_atX, opt_atY)
This method starts control action for camera. This action allows to control camera animation and
movement according to provided values in the H.map.IControl#control function
Parameters:
opt_kinetics:
{H.util.kinetics.IKinetics=} [optional]
kinetics settings
opt_atX:
{number=} [optional]
control starts at x screen coordinate
opt_atY:
{number=} [optional]
control starts at y screen coordinate
control (moveX, moveY, moveZ, angleX, angleY, angleZ, zoom, opt_timestamp)
This method triggers single control action on engine. This will trigger an animation which will start
modification of the view's or camera's properties according to values begin set. Modification will
occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to
a distance to next zoom level.
Parameters:
moveX:
{number}
moves the view/cam in right/left direction
moveY:
{number}
moves the view/cam in bottom/top direction
moveZ:
{number}
moves the view/cam in depth direction (changes zoom level)
angleX:
{number}
rotates cam over x-axis
Maps API for JavaScript Developer's Guide
► API Reference
angleY:
{number}
rotates cam over y-axis
angleZ:
{number}
rotates cam over z-axis
zoom:
{number}
changes current zoom level (for view works as moveZ)
opt_timestamp:
{number=} [optional]
269
endControl (opt_preventKinetics, opt_adjustView)
This method ends current control, which will stop ongoing animation triggered by the startControl
method. This method can prevent kinetics as well as it can adjust the final view if the adjust function
is being passed.
Example
//prevent kinetcs
viewModel.endControl(true);
//prevent kinetics and set adjusted view
viewModel.endControl(true, function(requested) {
requested.zoom = Math.round(requested.zoom);
});
Parameters:
opt_preventKinetics:
{boolean=} [optional]
if set to true will prevent kinetics animation
opt_adjustView:
{function(H.map.ViewModel.CameraData)=} [optional]
user defined function which can adjust the final view this function takes
last requestedData from the view model and should return a modified
H.map.ViewModel.CameraData which will be set as the final view
Interface: ICopyright
This interface is a member of the namespace
H.map .
Maps API for JavaScript Developer's Guide
► API Reference
270
Interface Summary
An interface to specify a copyright note
[ For full details, see the Interface Details ]
Property Summary
Table 67: Properties
Properties
label : {string}
A short textual representation of the copyright note, e.g. "DigitalGlobe 2009"
alt : {string}
A detailed textual representation of the copyright note, e.g. "copyright 2009 DigitalGlobe, Inc."
Interface Description
An interface to specify a copyright note
Property Details
label: {string}
A short textual representation of the copyright note, e.g. "DigitalGlobe 2009"
alt: {string}
A detailed textual representation of the copyright note, e.g. "copyright 2009 DigitalGlobe, Inc."
Interface: IInteraction
This interface is a member of the namespace
H.map .
Interface Summary
Interface describes interaction with the view port. Interaction will reflect view change depending on
the interaction coordinates passed and the modifiers which specify the type of interaction.
[ For full details, see the Interface Details ]
Maps API for JavaScript Developer's Guide
► API Reference
271
Method Summary
Table 68: Methods
Methods
static
startInteraction (modifiers, opt_kinetics)
This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse
grab, or touch start.
static
interaction (x, y, opt_bx, opt_by, opt_timestamp)
This method resolves direct screen (view port) interaction. This function will modify the current view according to values
passed in.
static
endInteraction (opt_preventKinetics)
This method ends interaction and applies kinetic movement if defined by using startInteraction method
Interface Description
Interface describes interaction with the view port. Interaction will reflect view change depending on
the interaction coordinates passed and the modifiers which specify the type of interaction.
Method Details
static
startInteraction (modifiers, opt_kinetics)
This method starts the interaction with the view port. Should be called every time when new
interaction is started i.e mouse grab, or touch start.
Parameters:
modifiers:
{number}
a bitmask which specifies what operations should performed during every
interaction
opt_kinetics:
{H.util.kinetics.IKinetics=} [optional]
specifies kinetic move at the end of interaction
static
interaction (x, y, opt_bx, opt_by, opt_timestamp)
This method resolves direct screen (view port) interaction. This function will modify the current view
according to values passed in.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
x:
{number}
viewport x coordinate
y:
{number}
viewport y coordinate
opt_bx:
{number=} [optional]
x coordinate for second pointer/touch if present
opt_by:
{number=} [optional]
y coordinate for secong pointer/touch if present
opt_timestamp:
{number=} [optional]
known timestamp which should be passed
static
endInteraction (opt_preventKinetics)
This method ends interaction and applies kinetic movement if defined by using startInteraction
method
Parameters:
opt_preventKinetics:
{boolean=} [optional]
if set to true will prevent kinetics behaviour at the end of interaction
Class: Icon
This class is a member of the namespace
H.map .
Class Summary
Extends: H.util.EventTarget
A visual representation of the H.map.Marker.
[ For full details, see the Class Details ]
272
Maps API for JavaScript Developer's Guide
► API Reference
273
Method Summary
Table 69: Methods
Methods
getState () : {H.map.Icon.prototype.State}
Returns the icon's bitmap loading state
getBitmap () : {?(HTMLImageElement | HTMLCanvasElement)}
Returns the bitmap of this icon or null if the bitmap is not ready yet (see H.map.Icon#getState)
getSize () : {?H.math.Size}
Returns the size of this icon or null if a size wasn't specified in the constructor's options and the state of this icon is not
H.map.Icon.READY
getAnchor () : {?H.math.Point}
Returns the anchor point of this icon or null if an anchor wasn't specified in the constructor's options and the state of this
icon is not H.map.Icon.READY.
getHitArea () : {?H.map.HitArea}
Returns the hit area of the icon.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Maps API for JavaScript Developer's Guide
► API Reference
Events Summary
Table 70: Events
Events
statechange : {H.util.Event}
Fired when the icon's bitmap loading state changes, see H.map.Icon#getState
Class Description
A visual representation of the H.map.Marker.
Constructor Details
H.map.Icon(bitmap, opt_options)
Parameters:
bitmap:
{!(string | HTMLImageElement | HTMLCanvasElement)}
Either an image URL, a SVG markup, an image or a canvas.
opt_options:
{H.map.Icon.Options=} [optional]
Method Details
getState () : {H.map.Icon.prototype.State}
Returns the icon's bitmap loading state
Returns:
{H.map.Icon.prototype.State}
getBitmap () : {?(HTMLImageElement | HTMLCanvasElement)}
Returns the bitmap of this icon or null if the bitmap is not ready yet (see H.map.Icon#getState)
Returns:
{?(HTMLImageElement | HTMLCanvasElement)}
getSize () : {?H.math.Size}
274
Maps API for JavaScript Developer's Guide
► API Reference
275
Returns the size of this icon or null if a size wasn't specified in the constructor's options and the
state of this icon is not H.map.Icon.READY
Returns:
{?H.math.Size}
getAnchor () : {?H.math.Point}
Returns the anchor point of this icon or null if an anchor wasn't specified in the constructor's
options and the state of this icon is not H.map.Icon.READY.
Returns:
{?H.math.Point}
getHitArea () : {?H.map.HitArea}
Returns the hit area of the icon.
Returns:
{?H.map.HitArea}
icon's anchor point
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
276
Maps API for JavaScript Developer's Guide
► API Reference
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
statechange: {H.util.Event}
Fired when the icon's bitmap loading state changes, see H.map.Icon#getState
Enumeration: State
This enumeration is a member of the class
H.map.Icon .
Enumeration Summary
The state types of an Icon
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 71: Constants
Constants
static
ERROR
static
LOADING
static
READY
277
Maps API for JavaScript Developer's Guide
► API Reference
278
Enumeration Details
The state types of an Icon
Enumeration Constants Details
static ERROR
static LOADING
static READY
Type definition: Options
This type definition is a member of the class
H.map.Icon .
Type Definition Summary
Options used to initialize a Icon
[ For full details, see the Type Definition Details ]
Property Summary
Table 72: Properties
Properties
size
The icon's size in pixel, default is the bitmap's natural size
anchor
The anchorage point in pixel, default is bottom-center
hitArea
The area to use for hit detection, default is the whole rectangular area
asCanvas
Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering
performance but it could also cause a higher memory consumption.
crossOrigin
Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting
canvas from tainting. The option is ignored by IE9-10.
Maps API for JavaScript Developer's Guide
► API Reference
279
Type Definition Description
Options used to initialize a Icon
Property Details
size: {H.math.ISize=} [optional]
The icon's size in pixel, default is the bitmap's natural size
anchor: {H.math.IPoint=} [optional]
The anchorage point in pixel, default is bottom-center
hitArea: {H.map.HitArea=} [optional]
The area to use for hit detection, default is the whole rectangular area
asCanvas: {H.map.HitArea=} [optional]
Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion
improves the rendering performance but it could also cause a higher memory consumption.
crossOrigin: {boolean}
Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image
to prevent resulting canvas from tainting. The option is ignored by IE9-10.
Class: Imprint
This class is a member of the namespace
H.map .
Class Summary
Extends: H.util.Disposable
Implements: H.util.ICapturable
This class encapsulates the brand, copyright and terms of use elements on the map.
[ For full details, see the Class Details ]
Method Summary
Table 73: Methods
Methods
setOptions (opt_options)
Maps API for JavaScript Developer's Guide
► API Reference
280
Methods
To set the imprint options. If no opt_options argument is defined then all values are reset to their defaults.
getCopyrights () : {string}
This method retrieves the copyright string for the current view of the map.
getStyle () : {CSSStyleDeclaration}
To get the CSS style declaration of the imprint DOM element
addOnDisposeCallback (callback, opt_scope)
Method adds a callback which will be triggered when the object is disposed
capture (canvas, pixelRatio, callback, opt_errback)
This method is used to capture the element view
Class Description
This class encapsulates the brand, copyright and terms of use elements on the map.
Constructor Details
H.map.Imprint(map, opt_options)
Parameters:
map:
{H.Map}
The map where the imprint is attached to
opt_options:
{H.map.Imprint.Options=} [optional]
The options to style the imprint
Method Details
setOptions (opt_options)
To set the imprint options. If no opt_options argument is defined then all values are reset to their
defaults.
Parameters:
opt_options:
{H.map.Imprint.Options=} [optional]
The options to style the imprint
Maps API for JavaScript Developer's Guide
► API Reference
281
getCopyrights () : {string}
This method retrieves the copyright string for the current view of the map.
Returns:
{string}
The copyright string for the current map view
getStyle () : {CSSStyleDeclaration}
To get the CSS style declaration of the imprint DOM element
Returns:
{CSSStyleDeclaration}
addOnDisposeCallback (callback, opt_scope)
Method adds a callback which will be triggered when the object is disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
capture (canvas, pixelRatio, callback, opt_errback)
This method is used to capture the element view
Parameters:
canvas:
{HTMLCanvasElement}
HTML Canvas element to draw the view of the capturable element
pixelRatio:
{number}
The pixelRatio to use for over-sampling in cases of high-resolution displays,
default is 1
callback:
{function(HTMLCanvasElement=)}
Callback function to call once result of the capturing is ready
Maps API for JavaScript Developer's Guide
► API Reference
opt_errback:
{function(string)=} [optional]
Callback function to call if error occurred during capturing
282
Type definition: Options
This type definition is a member of the class
H.map.Imprint .
Type Definition Summary
Options to style an imprint
[ For full details, see the Type Definition Details ]
Property Summary
Table 74: Properties
Properties
invert
Indicates whether the logo is inverted. If omitted the current value remains, default is false.
font
The font of the text. If omitted the current value remains, default is "11px Arial,sans-serif".
href
The URL of the "Terms of use" link. If omitted the current value remains, default is "http://here.com/terms".
Type Definition Description
Options to style an imprint
Property Details
invert: {boolean=} [optional]
Indicates whether the logo is inverted. If omitted the current value remains, default is false.
font: {string=} [optional]
The font of the text. If omitted the current value remains, default is "11px Arial,sans-serif".
href: {string=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
283
The URL of the "Terms of use" link. If omitted the current value remains, default is "http://here.com/
terms".
Class: Marker
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.AbstractMarker
A marker with a visual representation in the form of a bitmap icon. Marker are predestinated if large
amounts of markers with static icons should be displayed om the map.
[ For full details, see the Class Details ]
Method Summary
Table 75: Methods
Methods
getPosition () : {H.geo.Point}
This method returns this marker's current position.
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Maps API for JavaScript Developer's Guide
► API Reference
Methods
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
284
Maps API for JavaScript Developer's Guide
► API Reference
285
Methods
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 76: Events
Events
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
A marker with a visual representation in the form of a bitmap icon. Marker are predestinated if large
amounts of markers with static icons should be displayed om the map.
Constructor Details
H.map.Marker(position, opt_options)
Parameters:
position:
{H.geo.IPoint}
The location of this marker
opt_options:
{H.map.Marker.Options=} [optional]
The values to initialize this marker
Method Details
getPosition () : {H.geo.Point}
This method returns this marker's current position.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.geo.Point}
current marker geo position
setPosition (position) : {H.map.AbstractMarker}
This method sets the marker's current position.
Parameters:
position:
{H.geo.IPoint}
Returns:
{H.map.AbstractMarker}
the marker itself
getIcon () : {!(H.map.Icon | H.map.DomIcon)}
Returns this marker's current icon.
Returns:
{!(H.map.Icon | H.map.DomIcon)}
setIcon (icon) : {H.map.AbstractMarker}
Sets the marker's current icon.
Parameters:
icon:
{!(H.map.Icon | H.map.DomIcon)}
The new marker icon
Returns:
{H.map.AbstractMarker}
the marker itself
getId () : {*}
Returns the ID of this object.
Returns:
286
Maps API for JavaScript Developer's Guide
► API Reference
287
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Maps API for JavaScript Developer's Guide
► API Reference
288
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
object:
{*}
The object that's being compared against.
Returns:
289
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
290
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
291
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.Marker .
Type Definition Summary
Options used to initialize a Marker
[ For full details, see the Type Definition Details ]
Property Summary
Table 77: Properties
Properties
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
visibility
Indicates whether the map object is visible at all, default is true.
zIndex
The z-index value of the map object, default is 0
292
Maps API for JavaScript Developer's Guide
► API Reference
Properties
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
icon
The icon to use for the visual representation, if omitted a default icon is used.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData.
Type Definition Description
Options used to initialize a Marker
Property Details
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
visibility: {boolean=} [optional]
Indicates whether the map object is visible at all, default is true.
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
icon: {H.map.Icon=} [optional]
The icon to use for the visual representation, if omitted a default icon is used.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData.
293
Maps API for JavaScript Developer's Guide
► API Reference
294
Class: Object
This class is a member of the namespace
H.map .
Class Summary
Extends: H.util.EventTarget
This class represents the abstract base class for map objects such as polylines, polygons, markers,
groups etc.
[ For full details, see the Class Details ]
Method Summary
Table 78: Methods
Methods
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
static
compareZOrder (first, second) : {number}
Compares two objects regarding their z-order, useful to sort a list of objects via Array's sort() method
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
295
Methods
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 79: Events
Events
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
Maps API for JavaScript Developer's Guide
► API Reference
296
Events
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
This class represents the abstract base class for map objects such as polylines, polygons, markers,
groups etc.
Constructor Details
H.map.Object(opt_options)
Parameters:
opt_options:
{H.map.Object.Options=} [optional]
The values to initialize this object
Method Details
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
297
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
static
compareZOrder (first, second) : {number}
Compares two objects regarding their z-order, useful to sort a list of objects via Array's sort() method
Parameters:
first:
{H.map.Object}
The first object to compare
second:
{H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
The second object to compare
Returns:
298
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
299
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
300
Maps API for JavaScript Developer's Guide
► API Reference
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
301
Maps API for JavaScript Developer's Guide
► API Reference
Event Details
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.Object .
Type Definition Summary
Options used to initialize a map object
[ For full details, see the Type Definition Details ]
Property Summary
Table 80: Properties
Properties
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
visibility
Indicates whether the map object is visible at all, default is true
zIndex
The z-index value of the map object, default is 0
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData.
302
Maps API for JavaScript Developer's Guide
► API Reference
Type Definition Description
Options used to initialize a map object
Property Details
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
visibility: {boolean=} [optional]
Indicates whether the map object is visible at all, default is true
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData.
Enumeration: Type
This enumeration is a member of the class
H.map.Object .
Enumeration Summary
The major types of map objects
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 81: Constants
Constants
static
ANY
303
Maps API for JavaScript Developer's Guide
► API Reference
Constants
spatial object
static
SPATIAL
spatial object
static
MARKER
Marker object
static
DOM_MARKER
DomMarker object
static
GROUP
DomMarker object
Enumeration Details
The major types of map objects
Enumeration Constants Details
static ANY
spatial object
static SPATIAL
spatial object
static MARKER
Marker object
static DOM_MARKER
DomMarker object
static GROUP
DomMarker object
Class: Polygon
This class is a member of the namespace
H.map .
304
Maps API for JavaScript Developer's Guide
► API Reference
305
Class Summary
Extends: H.map.GeoShape
This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo
shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents
a closed plane defined by the list of verticies, projected on the map display. List of vericies which
define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip
[ For full details, see the Class Details ]
Method Summary
Table 82: Methods
Methods
setNorthPoleCovering (flag) : {H.map.Polygon}
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines
arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional
information is needed to know if the southern or northern part of the world should be covered by the poygon.
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
clip (geoRect, projection) : {Array<Array<number>>}
This method clips this polygon against a rectangular area. This method will take polygons crossing the date border into
account duplicate the shape in the returned list of intersecting strips.
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points
of the spatial object.
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
Maps API for JavaScript Developer's Guide
► API Reference
Methods
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
306
Maps API for JavaScript Developer's Guide
► API Reference
307
Methods
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 83: Events
Events
stripchange : {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Maps API for JavaScript Developer's Guide
► API Reference
308
Class Description
This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo
shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents
a closed plane defined by the list of verticies, projected on the map display. List of vericies which
define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip
Constructor Details
H.map.Polygon(strip, opt_options)
Parameters:
strip:
{H.geo.Strip}
the strip describing this polygon's vertices
opt_options:
{H.map.Spatial.Options=} [optional]
optional initialization parameters
Method Details
setNorthPoleCovering (flag) : {H.map.Polygon}
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip
is defined as lines arround the world on longitude axis (for example a circle whose center is one of the
poles). In this case a additional information is needed to know if the southern or northern part of the
world should be covered by the poygon.
Parameters:
flag:
{boolean}
A value of true means it covers the north pole, false means south pole
Returns:
{H.map.Polygon}
the Polygon instance itself
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
309
{boolean}
clip (geoRect, projection) : {Array<Array<number>>}
This method clips this polygon against a rectangular area. This method will take polygons crossing
the date border into account duplicate the shape in the returned list of intersecting strips.
Parameters:
geoRect:
{H.geo.Rect}
the rectangular area against which to clip
projection:
{H.geo.PixelProjection}
a projection to use for bounding box padding
Returns:
{Array<Array<number>>}
a list of arrays with alternating lat, lng values.
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
Returns:
{H.geo.Strip}
the strip
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
Parameters:
strip:
{?H.geo.Strip}
The strip which represents the shape of the spatial object.
Returns:
{H.map.GeoShape}
the Spatial instance itself
getBounds () : {H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
310
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle
which encloses all points of the spatial object.
Returns:
{H.geo.Rect}
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
Maps API for JavaScript Developer's Guide
► API Reference
311
To set the arrow style of this object.
Parameters:
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
Returns:
{boolean}
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
312
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
313
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Maps API for JavaScript Developer's Guide
► API Reference
314
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
315
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
stripchange: {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
316
Maps API for JavaScript Developer's Guide
► API Reference
317
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Class: Polyline
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.GeoShape
This class represents a polyline in geo-space. It is defined by a path containing the vertices of a
polyline (lat, lng, alt values) and a pen to use when tracing the path on the map.
[ For full details, see the Class Details ]
Method Summary
Table 84: Methods
Methods
clip (geoRect) : {Array<Array<number>>}
This method clips this polyline against a rectangular area and returns the intersecting sub-lines.
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points
of the spatial object.
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
Maps API for JavaScript Developer's Guide
► API Reference
318
Methods
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Maps API for JavaScript Developer's Guide
► API Reference
319
Methods
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 85: Events
Events
stripchange : {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
Maps API for JavaScript Developer's Guide
► API Reference
Events
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
This class represents a polyline in geo-space. It is defined by a path containing the vertices of a
polyline (lat, lng, alt values) and a pen to use when tracing the path on the map.
Constructor Details
H.map.Polyline(strip, opt_options)
Parameters:
strip:
{H.geo.Strip}
the strip describing this polygon's vertices
opt_options:
{H.map.Polyline.Options=} [optional]
optional initialization parameters
Method Details
clip (geoRect) : {Array<Array<number>>}
This method clips this polyline against a rectangular area and returns the intersecting sub-lines.
Parameters:
geoRect:
{H.geo.Rect}
Returns:
{Array<Array<number>>}
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
Returns:
{H.geo.Strip}
320
Maps API for JavaScript Developer's Guide
► API Reference
321
the strip
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
Parameters:
strip:
{?H.geo.Strip}
The strip which represents the shape of the spatial object.
Returns:
{H.map.GeoShape}
the Spatial instance itself
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle
which encloses all points of the spatial object.
Returns:
{H.geo.Rect}
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
322
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
Parameters:
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
Returns:
{boolean}
getId () : {*}
Returns the ID of this object.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
323
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Maps API for JavaScript Developer's Guide
► API Reference
324
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
object:
{*}
The object that's being compared against.
Returns:
325
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
326
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
327
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
stripchange: {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Options
This type definition is a member of the class
H.map.Polyline .
Type Definition Summary
Options which are used to initialize a polyline
[ For full details, see the Type Definition Details ]
Property Summary
Table 86: Properties
Properties
style
the style to be used when tracing the polyline
arrows
328
Maps API for JavaScript Developer's Guide
► API Reference
Properties
The arrows style to be used when rendering the polyline.
visibility
An optional boolean value indicating whether this map object is visible, default is true
zIndex
The z-index value of the map object, default is 0
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
provider
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData
Type Definition Description
Options which are used to initialize a polyline
Property Details
style: {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
the style to be used when tracing the polyline
arrows: {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
The arrows style to be used when rendering the polyline.
visibility: {boolean=} [optional]
An optional boolean value indicating whether this map object is visible, default is true
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
329
Maps API for JavaScript Developer's Guide
► API Reference
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData
Class: Rect
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Polygon
A Polygon with a rectangular shape.
[ For full details, see the Class Details ]
Method Summary
Table 87: Methods
Methods
setBounds (bounds)
To set the bounds of this rectangle.
setNorthPoleCovering (flag) : {H.map.Polygon}
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines
arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional
information is needed to know if the southern or northern part of the world should be covered by the poygon.
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
clip (geoRect, projection) : {Array<Array<number>>}
This method clips this polygon against a rectangular area. This method will take polygons crossing the date border into
account duplicate the shape in the returned list of intersecting strips.
330
Maps API for JavaScript Developer's Guide
► API Reference
331
Methods
getStrip () : {H.geo.Strip}
This method returns the strip which represents the shape of the spatial object.
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle which encloses all points
of the spatial object.
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Maps API for JavaScript Developer's Guide
► API Reference
332
Methods
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Maps API for JavaScript Developer's Guide
► API Reference
Events Summary
Table 88: Events
Events
stripchange : {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
A Polygon with a rectangular shape.
Constructor Details
H.map.Rect(bounds, opt_options)
Parameters:
bounds:
{H.geo.Rect}
The geographical bounding box for this rectangle
opt_options:
{H.map.Spatial.Options=} [optional]
Method Details
setBounds (bounds)
To set the bounds of this rectangle.
Parameters:
bounds:
{H.geo.Rect}
333
Maps API for JavaScript Developer's Guide
► API Reference
334
setNorthPoleCovering (flag) : {H.map.Polygon}
To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip
is defined as lines arround the world on longitude axis (for example a circle whose center is one of the
poles). In this case a additional information is needed to know if the southern or northern part of the
world should be covered by the poygon.
Parameters:
flag:
{boolean}
A value of true means it covers the north pole, false means south pole
Returns:
{H.map.Polygon}
the Polygon instance itself
getNorthPoleCovering () : {boolean}
See H.map.Polygon#setNorthPoleCovering
Returns:
{boolean}
clip (geoRect, projection) : {Array<Array<number>>}
This method clips this polygon against a rectangular area. This method will take polygons crossing
the date border into account duplicate the shape in the returned list of intersecting strips.
Parameters:
geoRect:
{H.geo.Rect}
the rectangular area against which to clip
projection:
{H.geo.PixelProjection}
a projection to use for bounding box padding
Returns:
{Array<Array<number>>}
a list of arrays with alternating lat, lng values.
getStrip () : {H.geo.Strip}
Maps API for JavaScript Developer's Guide
► API Reference
335
This method returns the strip which represents the shape of the spatial object.
Returns:
{H.geo.Strip}
the strip
setStrip (strip) : {H.map.GeoShape}
This method sets the geo-information for the spatial object
Parameters:
strip:
{?H.geo.Strip}
The strip which represents the shape of the spatial object.
Returns:
{H.map.GeoShape}
the Spatial instance itself
getBounds () : {H.geo.Rect}
This method returns the bounding rectangle for this object. The rectangle is the smallest rectangle
which encloses all points of the spatial object.
Returns:
{H.geo.Rect}
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Maps API for JavaScript Developer's Guide
► API Reference
336
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
Parameters:
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
Returns:
{boolean}
Maps API for JavaScript Developer's Guide
► API Reference
337
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
338
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Returns:
{!H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
339
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
Maps API for JavaScript Developer's Guide
► API Reference
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
340
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
341
Maps API for JavaScript Developer's Guide
► API Reference
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
stripchange: {H.util.ChangeEvent}
Fired when this spatial's strip changes.
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Class: Spatial
This class is a member of the namespace
H.map .
Class Summary
Extends: H.map.Object
This class represents a spatial map object which provides its projected geometry.
[ For full details, see the Class Details ]
342
Maps API for JavaScript Developer's Guide
► API Reference
343
Method Summary
Table 89: Methods
Methods
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be modified afterwards to
prevent inconsistancies!
setStyle (opt_style) : {H.map.Spatial}
To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as
immutable and must not be modified afterwards to prevent inconsistancies! .
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as
immutable and must not be modified afterwards to prevent inconsistancies!
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
getId () : {*}
Returns the ID of this object.
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any group.
getRootGroup () : {!H.map.Object}
Maps API for JavaScript Developer's Guide
► API Reference
344
Methods
The root object in which this object is attached or the object itself.
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
invalidate (flags) : {boolean}
This method invalidates this map object.
getData () : {*}
This method returns previously stored arbitrary data from this object.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Maps API for JavaScript Developer's Guide
► API Reference
345
Events Summary
Table 90: Events
Events
stylechange : {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange : {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange : {H.util.ChangeEvent}
Fired when this object's z-index changes
Class Description
This class represents a spatial map object which provides its projected geometry.
Constructor Details
H.map.Spatial(isClosed, opt_options)
Parameters:
isClosed:
{boolean}
Indicates whether this spatial object represents a closed shape
opt_options:
{H.map.Spatial.Options=} [optional]
The options to apply
Method Details
getStyle () : {H.map.SpatialStyle}
To get the drawing style of this object. The returned style is treated as immutable and must not be
modified afterwards to prevent inconsistancies!
Returns:
{H.map.SpatialStyle}
setStyle (opt_style) : {H.map.Spatial}
Maps API for JavaScript Developer's Guide
► API Reference
346
To set the drawing style of this object. If the passed opt_style argument is an instance of
H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent
inconsistancies! .
Parameters:
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The style to set. If it evaluates to a falsy the
H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
{H.map.Spatial}
the Spatial instance itself
getArrows () : {(H.map.ArrowStyle | undefined)}
To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow
style is treated as immutable and must not be modified afterwards to prevent inconsistancies!
Returns:
{(H.map.ArrowStyle | undefined)}
setArrows (opt_arrows) : {H.map.Spatial}
To set the arrow style of this object.
Parameters:
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
the arrow style to be applied
Returns:
{H.map.Spatial}
the Spatial instance itself
isClosed () : {boolean}
Indicates whether this spatial object represents a closed shape
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
347
{boolean}
getId () : {*}
Returns the ID of this object.
Returns:
{*}
setVisibility (opt_visibility) : {H.map.Object}
Sets the visibility of this object.
Parameters:
opt_visibility:
{boolean=} [optional]
Indicates whether this map object should be visible.
Returns:
{H.map.Object}
returns this object
getVisibility (opt_effective) : {boolean}
Returns the visibility of this object.
Parameters:
opt_effective:
{boolean=} [optional]
Indicates that the effective visibility is requested. In this case the visibility of
all possible ancestor groups is also taken into account
Returns:
{boolean}
getZIndex () : {(number | undefined)}
Returns the z-index of this object.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
348
{(number | undefined)}
setZIndex (zIndex) : {H.map.Object}
To set the-index of this object.
Parameters:
zIndex:
{(number | undefined)}
Returns:
{H.map.Object}
returns this object
compareZOrder (other) : {number}
Compares the rendering z-order of this object with another object.
Parameters:
other:
{H.map.Object}
The other map object to compare with
Returns:
{number}
If less then 0 the first object has a lower z-order. If equal 0 booth objects
have the same z-order. If greater then 0 the first object has a higher z-order.
getParentGroup () : {?H.map.Group}
Returns the parent group which contains this object or null if the object is not contained by any
group.
Returns:
{?H.map.Group}
getRootGroup () : {!H.map.Object}
The root object in which this object is attached or the object itself.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{!H.map.Object}
contains (object) : {boolean}
Checks whether the given object is an inclusive descendant of this object
Parameters:
object:
{*}
The object that's being compared against.
Returns:
{boolean}
getProvider () : {?H.map.provider.ObjectProvider}
The current provider of this object
Returns:
{?H.map.provider.ObjectProvider}
the current provider
getInvalidations () : {H.map.provider.Invalidations}
Returns the invalidations of this object
Returns:
{H.map.provider.Invalidations}
an invalidation object
invalidate (flags) : {boolean}
This method invalidates this map object.
Parameters:
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
Returns:
349
Maps API for JavaScript Developer's Guide
► API Reference
350
{boolean}
indicates whether a validtion was executed (only if the object has a provider)
getData () : {*}
This method returns previously stored arbitrary data from this object.
Returns:
{*}
the previously stored data or undefined if not data was stored.
setData (data) : {H.map.Object}
This method stores arbitrary data with this map object
Parameters:
data:
{*}
the data to be stored
Returns:
{H.map.Object}
returns this map object instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
Maps API for JavaScript Developer's Guide
► API Reference
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
351
Maps API for JavaScript Developer's Guide
► API Reference
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
stylechange: {H.util.ChangeEvent}
Fired when this spatial's style changes.
visibilitychange: {H.util.ChangeEvent}
Fired when this object's visibility changes
zindexchange: {H.util.ChangeEvent}
Fired when this object's z-index changes
Type definition: Label
This type definition is a member of the class
H.map.Spatial .
Type Definition Summary
Data to used as rendering hint for a label
[ For full details, see the Type Definition Details ]
352
Maps API for JavaScript Developer's Guide
► API Reference
Property Summary
Table 91: Properties
Properties
x
The X coordinate of the first line's starting point
y
The Y coordinate of the first line's base line
angle
The clockwise rotation angle in radians
font
The CSS font-family
size
The CSS font-size
color
The CSS color
text
The text content, new line characters (\u000A) are interpreted as line breaks
Type Definition Description
Data to used as rendering hint for a label
Property Details
x: {number}
The X coordinate of the first line's starting point
y: {number}
The Y coordinate of the first line's base line
angle: {number}
The clockwise rotation angle in radians
font: {string}
The CSS font-family
353
Maps API for JavaScript Developer's Guide
► API Reference
size: {number}
The CSS font-size
color: {string}
The CSS color
text: {string}
The text content, new line characters (\u000A) are interpreted as line breaks
Type definition: Options
This type definition is a member of the class
H.map.Spatial .
Type Definition Summary
Options which are used to initialize spatial object object
[ For full details, see the Type Definition Details ]
Property Summary
Table 92: Properties
Properties
style
the style to be used when tracing the spatial object
arrows
The arrows style to be used when rendering the spatial.
visibility
An optional boolean value indicating whether this map object is visible, default is true
zIndex
The z-index value of the map object, default is 0
min
The minimum zoom level for which the object is visible, default is -Infinity
max
The maximum zoom level for which the object is visible, default is Infinity
provider
354
Maps API for JavaScript Developer's Guide
► API Reference
Properties
The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to
instantiate an object.
data
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData.
Type Definition Description
Options which are used to initialize spatial object object
Property Details
style: {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
the style to be used when tracing the spatial object
arrows: {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
The arrows style to be used when rendering the spatial.
visibility: {boolean=} [optional]
An optional boolean value indicating whether this map object is visible, default is true
zIndex: {number=} [optional]
The z-index value of the map object, default is 0
min: {number=} [optional]
The minimum zoom level for which the object is visible, default is -Infinity
max: {number=} [optional]
The maximum zoom level for which the object is visible, default is Infinity
provider: {(H.map.provider.Provider | null)=} [optional]
The provider of this object. This property is only needed if a customized Implementation of
ObjectProvider wants to instantiate an object.
data: {*}
Optional arbitrary data to be stored with this map object. This data can be retrieved by calling
getData.
355
Maps API for JavaScript Developer's Guide
► API Reference
356
Class: SpatialStyle
This class is a member of the namespace
H.map .
Class Summary
The SpatialStyle class represents a style with which spatial objects like polylines and polygons are
drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies and must not
modified.
[ For full details, see the Class Details ]
Property Summary
Table 93: Properties
Properties
strokeColor : {string}
The color of the stroke in CSS syntax, default is 'rgba(0, 85, 170, 0.6)'.
fillColor : {string}
The filling color in CSS syntax, default is 'rgba(0, 85, 170, 0.4)'.
lineWidth : {number}
The width of the line in pixels, default is 2.
lineCap : {H.map.SpatialStyle.LineCap}
The style of the end caps for a line, default is 'round'.
lineJoin : {H.map.SpatialStyle.LineJoin}
The type of corner created, when two lines meet, default is 'miter'.
miterLimit : {number}
The miter length is the distance between the inner corner and the outer corner where two lines meet. The default is 10.
lineDash : {Array<number>}
The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is [ ].
lineDashOffset : {number}
The phase offset of the line dash pattern The default is 0.
static
MAX_LINE_WIDTH : {number}
This constant represents the maximum line width which can be used for rendering.
Maps API for JavaScript Developer's Guide
► API Reference
357
Properties
static
DEFAULT_STYLE : {H.map.SpatialStyle}
This static member defines the default style for spatial objects on the map. It's value is { strokeColor: '#05A',
fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth: 1, lineCap: 'round', lineJoin: 'miter',
miterLimit: 10, lineDash: [ ], lineDashOffset: 0 }
Method Summary
Table 94: Methods
Methods
equals (other) : {boolean}
This method checks value-equality with another style.
getCopy (opt_attributes) : {H.map.SpatialStyle}
Returns a copy of spatial style object and replaces the passed style attributes into it.
Class Description
The SpatialStyle class represents a style with which spatial objects like polylines and polygons are
drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies and must not
modified.
Constructor Details
H.map.SpatialStyle(opt_options)
Parameters:
opt_options:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
The optional style attributes
Property Details
strokeColor: {string}
The color of the stroke in CSS syntax, default is 'rgba(0, 85, 170, 0.6)'.
fillColor: {string}
The filling color in CSS syntax, default is 'rgba(0, 85, 170, 0.4)'.
Maps API for JavaScript Developer's Guide
► API Reference
358
lineWidth: {number}
The width of the line in pixels, default is 2.
lineCap: {H.map.SpatialStyle.LineCap}
The style of the end caps for a line, default is 'round'.
lineJoin: {H.map.SpatialStyle.LineJoin}
The type of corner created, when two lines meet, default is 'miter'.
miterLimit: {number}
The miter length is the distance between the inner corner and the outer corner where two lines meet.
The default is 10.
lineDash: {Array<number>}
The line dash pattern as an even numbered list of distances to alternately produce a line and a space.
The default is [ ].
lineDashOffset: {number}
The phase offset of the line dash pattern The default is 0.
static MAX_LINE_WIDTH: {number}
This constant represents the maximum line width which can be used for rendering.
static DEFAULT_STYLE: {H.map.SpatialStyle}
This static member defines the default style for spatial objects on the map. It's value is
{ strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth:
1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [ ],
lineDashOffset: 0 }
Method Details
equals (other) : {boolean}
This method checks value-equality with another style.
Parameters:
other:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)}
the style to compare with
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{boolean}
true if the styles are value-equal, otherwise false
getCopy (opt_attributes) : {H.map.SpatialStyle}
Returns a copy of spatial style object and replaces the passed style attributes into it.
Parameters:
opt_attributes:
{H.map.SpatialStyle.Options=} [optional]
The style attributes to set on the copied style instance
Returns:
{H.map.SpatialStyle}
Type definition: LineCap
This type definition is a member of the class
H.map.SpatialStyle .
Type Definition Summary
The style of the end caps for a line, one of 'butt', 'round' or 'square'.
[ For full details, see the Type Definition Details ]
Type Definition Description
The style of the end caps for a line, one of 'butt', 'round' or 'square'.
Type definition: LineJoin
This type definition is a member of the class
H.map.SpatialStyle .
Type Definition Summary
The type of corner created, when two lines meet, one of 'round', 'bevel' or 'miter'.
[ For full details, see the Type Definition Details ]
Type Definition Description
The type of corner created, when two lines meet, one of 'round', 'bevel' or 'miter'.
359
Maps API for JavaScript Developer's Guide
► API Reference
360
Type definition: Options
This type definition is a member of the class
H.map.SpatialStyle .
Type Definition Summary
Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is
taken.
[ For full details, see the Type Definition Details ]
Property Summary
Table 95: Properties
Properties
strokeColor
The color of the stroke in CSS syntax.
fillColor
The color of the stroke in CSS syntax.
lineWidth
The width of the line in pixels, default is 2. The maximum supported line width is 100.
lineCap
The style of the end caps for a line.
lineJoin
The type of corner created, when two lines meet.
miterLimit
The miter limit in pixel, default is 10. The maximum supported miter limit is 100
lineDash
The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't
support this feature this style property is ignored.
lineDashOffset
The phase offset of the line dash pattern
Maps API for JavaScript Developer's Guide
► API Reference
361
Type Definition Description
Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is
taken.
Property Details
strokeColor: {string=} [optional]
The color of the stroke in CSS syntax.
fillColor: {string=} [optional]
The color of the stroke in CSS syntax.
lineWidth: {number=} [optional]
The width of the line in pixels, default is 2. The maximum supported line width is 100.
lineCap: {H.map.SpatialStyle.LineCap=} [optional]
The style of the end caps for a line.
lineJoin: {H.map.SpatialStyle.LineJoin=} [optional]
The type of corner created, when two lines meet.
miterLimit: {number=} [optional]
The miter limit in pixel, default is 10. The maximum supported miter limit is 100
lineDash: {Array<number>}
The line dash pattern as an even numbered list of distances to alternately produce a line and a space.
If the browser doesn't support this feature this style property is ignored.
lineDashOffset: {number=} [optional]
The phase offset of the line dash pattern
Class: ViewModel
This class is a member of the namespace
Class Summary
Extends: H.util.EventTarget
Implements: H.map.IControl
H.map .
Maps API for JavaScript Developer's Guide
► API Reference
362
This class represents a view of the map. It consists of a virtual camera and a look-at point both of
which have a position in geo-space and orientation angles. The view model allows to change the
values of these objects in order to move or rotate the map or zoom in and out.
[ For full details, see the Class Details ]
Method Summary
Table 96: Methods
Methods
getCameraData () : {H.map.ViewModel.CameraData}
This method returns the camera data, which is currently rendered.
setCameraData (data) : {H.map.ViewModel}
This method sets new camera data to be processed by the renderer.
setZoom (zoom, animate)
This method sets a new zoom level to be processed by the renderer
getZoom () : {number}
This method returns the zoom level that is currently rendered.
getRequestedCameraData () : {H.map.ViewModel.CameraData}
This method returns the currently requested data.
startControl (opt_kinetics, opt_atX, opt_atY)
A method to signal the begin of a control operation.
control (moveX, moveY, moveZ, angleX, angleY, angleZ, opt_zoom)
A method to set the values for a continuously modification of the ViewModel on different axes. If the current render engine
doesn't support certain modifications then they are ignored.
endControl (opt_preventKinetics, opt_adjustView)
A method to signal the end of a control operation.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Maps API for JavaScript Developer's Guide
► API Reference
363
Methods
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 97: Events
Events
update : {H.util.ChangeEvent}
Fired when this view-model's data changes
sync : {H.map.ChangeEvent}
Fired when the rendered map is synchronized with this view-model's data
Class Description
This class represents a view of the map. It consists of a virtual camera and a look-at point both of
which have a position in geo-space and orientation angles. The view model allows to change the
values of these objects in order to move or rotate the map or zoom in and out.
The view model can be manipulated by using two objects: a virtual camera or the a look-at point. A
virtual camera has a position and orientation (pitch, yaw and roll) in geo-space. A look-at point allows
to change the postion and orientation of the virtual camera with respect to the point that is being
looked at. The look-at point has a position in geo-space and orientation (heading, tilt and incline) and
a distance (the distance of the camera with respect to the look-at point). Setting look-at point values
influences the camera's position and orientation and vice-versa.
Modifying the view of a map is asynchronous as the view model will notify the renderer of a change of
its state and trigger the renderer.
A map renderer can choose to ignore or even correct certain values depending on its capabilities. For
example a 2D map renderer will ignore tilt values and correct tilt values to be 0 on the view model in
order to keep the integrity of the view model.
Maps API for JavaScript Developer's Guide
► API Reference
364
In order to be notified of changes to the model that originate from the renderer the view model
dispatches an event "sync" whenever the renderer synchronizes the requested changes to the view
with it's own internal state.
Constructor Details
H.map.ViewModel()
Method Details
getCameraData () : {H.map.ViewModel.CameraData}
This method returns the camera data, which is currently rendered.
Returns:
{H.map.ViewModel.CameraData}
the current rendered camera data
setCameraData (data) : {H.map.ViewModel}
This method sets new camera data to be processed by the renderer.
Parameters:
data:
{H.map.ViewModel.CameraData}
the values to be modified
Returns:
{H.map.ViewModel}
this view model object
setZoom (zoom, animate)
This method sets a new zoom level to be processed by the renderer
Parameters:
zoom:
{number}
the new zoom level
animate:
{boolean}
Maps API for JavaScript Developer's Guide
► API Reference
365
getZoom () : {number}
This method returns the zoom level that is currently rendered.
Returns:
{number}
current zoom level (scale)
getRequestedCameraData () : {H.map.ViewModel.CameraData}
This method returns the currently requested data.
Returns:
{H.map.ViewModel.CameraData}
last requested cam/view data
startControl (opt_kinetics, opt_atX, opt_atY)
A method to signal the begin of a control operation.
Parameters:
opt_kinetics:
{H.util.kinetics.IKinetics=} [optional]
kinetics settings
opt_atX:
{number=} [optional]
x screen coordinate at which control has started
opt_atY:
{number=} [optional]
y screen coordinate at which control has started
control (moveX, moveY, moveZ, angleX, angleY, angleZ, opt_zoom)
A method to set the values for a continuously modification of the ViewModel on different axes. If the
current render engine doesn't support certain modifications then they are ignored.
Parameters:
moveX:
{number}
The movement on x-axis as levels per millisecond where a level correlates to
the distance between camera and look-at point.
moveY:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
366
The movement on y-axis as levels per millisecond where a level correlates to
the distance between camera and look-at point
moveZ:
{number}
The movement on z-axis as levels per millisecond.
angleX:
{number}
The rotation of on screen's x axis as degrees per millisecond.
angleY:
{number}
The rotation of on screen's y axis as degrees per millisecond.
angleZ:
{number}
The rotation of on screen's z axis as degrees per millisecond.
opt_zoom:
{number=} [optional]
The modification of the zoom level as levels per millisecond
endControl (opt_preventKinetics, opt_adjustView)
A method to signal the end of a control operation.
Parameters:
opt_preventKinetics:
{boolean=} [optional]
A flag to indicate whether a kinetic effect is performed
opt_adjustView:
{function(H.map.ViewModel.CameraData)=} [optional]
An callback to adjust the final ViewModel by modifying the passed camera
data.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
Maps API for JavaScript Developer's Guide
► API Reference
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
367
Maps API for JavaScript Developer's Guide
► API Reference
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.ChangeEvent}
Fired when this view-model's data changes
sync: {H.map.ChangeEvent}
Fired when the rendered map is synchronized with this view-model's data
Type definition: CameraData
This type definition is a member of the class
H.map.ViewModel .
Type Definition Summary
Defines camera's properties.
[ For full details, see the Type Definition Details ]
368
Maps API for JavaScript Developer's Guide
► API Reference
Property Summary
Table 98: Properties
Properties
zoom
zoom level to be used by rendering engine
position
the position of the virtual camera in geo-space
pitch
the rotation of the virtual camera along its local x-axis
yaw
the rotation of the virtual camera along its local y-axis
roll
the rotation of the virtual camera along its local z-axis
fov
Type Definition Description
Defines camera's properties.
Property Details
zoom: {number=} [optional]
zoom level to be used by rendering engine
position: {H.geo.IPoint}
the position of the virtual camera in geo-space
pitch: {number=} [optional]
the rotation of the virtual camera along its local x-axis
yaw: {number=} [optional]
the rotation of the virtual camera along its local y-axis
roll: {number=} [optional]
the rotation of the virtual camera along its local z-axis
369
Maps API for JavaScript Developer's Guide
► API Reference
fov: {number=} [optional]
Type definition: RequestedData
This type definition is a member of the class
H.map.ViewModel .
Type Definition Summary
Defines currently requested view data, which will be rendered by the map.
[ For full details, see the Type Definition Details ]
Property Summary
Table 99: Properties
Properties
camera
The requested camera properties
zoom
The requested zoom level
animate
indicates if the requested transition should be animated
Type Definition Description
Defines currently requested view data, which will be rendered by the map.
Property Details
camera: {H.map.ViewModel.CameraData=} [optional]
The requested camera properties
zoom: {number=} [optional]
The requested zoom level
animate: {boolean=} [optional]
indicates if the requested transition should be animated
370
Maps API for JavaScript Developer's Guide
► API Reference
371
Class: UpdateEvent
This class is a member of the class
H.map.ViewModel .
Class Summary
Extends: H.util.Event
Update event is fired whenever view model data is changed. It contains property which hold currently
requested data
[ For full details, see the Class Details ]
Property Summary
Table 100: Properties
Properties
target : {*}
Object which triggered the event
currentTarget : {*}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 101: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Maps API for JavaScript Developer's Guide
► API Reference
372
Class Description
Update event is fired whenever view model data is changed. It contains property which hold currently
requested data
Constructor Details
H.map.ViewModel.UpdateEvent(requested)
Parameters:
requested:
{H.map.ViewModel.RequestedData}
Property Details
target: {*}
Object which triggered the event
currentTarget: {*}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class: ViewPort
This class is a member of the namespace
H.map .
Maps API for JavaScript Developer's Guide
► API Reference
373
Class Summary
Implements: H.map.IInteraction
Extends: H.util.EventTarget
ViewPort object holds information about the HTML element where the map is rendered. It contains
information regarding the element (view port) size and triggers events when the element size is
changed.
[ For full details, see the Class Details ]
Property Summary
Table 102: Properties
Properties
element : {Element}
This property holds the HTML element, which defines the viewport.
width : {number}
This property holds this viewport's current width
height : {number}
This property holds this viewport's current height
margin : {number}
This property holds this viewport's current margin value
padding : {H.map.ViewPort.Padding}
This property holds this viewport's current padding
center : {H.math.Point}
This property holds this viewport's current center point
Method Summary
Table 103: Methods
Methods
setMargin (margin)
This method sets the margin on the viewPort
setPadding (top, right, bottom, left)
Maps API for JavaScript Developer's Guide
► API Reference
374
Methods
This method sets the padding on the viewport. Padding will result in shifted map center which will be the visual center of the
padded area.
resize ()
This method updates size of the viewport according to container size. It must be called whenever the HTML element changed
size in order to update the map's viewport values.
startInteraction (modifiers, opt_kinetics)
This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse
grab, or touch start.
interaction (x, y, opt_bx, opt_by, opt_timestamp)
This method resolves direct screen (view port) interaction. This function will modify the current view according to values
passed in.
endInteraction (opt_preventKinetics)
This method ends interaction and applies kinetic movement if defined by using startInteraction method
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 104: Events
Events
update : {H.util.Event}
Maps API for JavaScript Developer's Guide
► API Reference
375
Events
Fired when this view-port's properties padding, margin or size changes
sync : {H.util.Event}
Fired when the rendered map is synchronized with this viewport's properties
Class Description
ViewPort object holds information about the HTML element where the map is rendered. It contains
information regarding the element (view port) size and triggers events when the element size is
changed.
Constructor Details
H.map.ViewPort(element, opt_options)
Parameters:
element:
{Element}
html element were map will be rendered
opt_options:
{H.map.ViewPort.Options=} [optional]
optional configuration parameters
Property Details
element: {Element}
This property holds the HTML element, which defines the viewport.
width: {number}
This property holds this viewport's current width
height: {number}
This property holds this viewport's current height
margin: {number}
This property holds this viewport's current margin value
padding: {H.map.ViewPort.Padding}
This property holds this viewport's current padding
Maps API for JavaScript Developer's Guide
► API Reference
376
center: {H.math.Point}
This property holds this viewport's current center point
Method Details
setMargin (margin)
This method sets the margin on the viewPort
Parameters:
margin:
{number}
margin which is used to fetch map data
setPadding (top, right, bottom, left)
This method sets the padding on the viewport. Padding will result in shifted map center which will be
the visual center of the padded area.
Parameters:
top:
{number}
padding from the top
right:
{number}
padding from the right
bottom:
{number}
padding from the bottom
left:
{number}
padding from the left
resize ()
This method updates size of the viewport according to container size. It must be called whenever the
HTML element changed size in order to update the map's viewport values.
startInteraction (modifiers, opt_kinetics)
This method starts the interaction with the view port. Should be called every time when new
interaction is started i.e mouse grab, or touch start.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
377
modifiers:
{number}
a bitmask which specifies what operations should performed during every
interaction
opt_kinetics:
{H.util.kinetics.IKinetics=} [optional]
specifies kinetic move at the end of interaction
interaction (x, y, opt_bx, opt_by, opt_timestamp)
This method resolves direct screen (view port) interaction. This function will modify the current view
according to values passed in.
Parameters:
x:
{number}
viewport x coordinate
y:
{number}
viewport y coordinate
opt_bx:
{number=} [optional]
x coordinate for second pointer/touch if present
opt_by:
{number=} [optional]
y coordinate for secong pointer/touch if present
opt_timestamp:
{number=} [optional]
known timestamp which should be passed
endInteraction (opt_preventKinetics)
This method ends interaction and applies kinetic movement if defined by using startInteraction
method
Parameters:
opt_preventKinetics:
{boolean=} [optional]
if set to true will prevent kinetics behaviour at the end of interaction
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
378
Maps API for JavaScript Developer's Guide
► API Reference
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this view-port's properties padding, margin or size changes
sync: {H.util.Event}
Fired when the rendered map is synchronized with this viewport's properties
379
Maps API for JavaScript Developer's Guide
► API Reference
380
Type definition: Options
This type definition is a member of the class
H.map.ViewPort .
Type Definition Summary
Options which may be used to initialize new ViewPort instance
[ For full details, see the Type Definition Details ]
Property Summary
Table 105: Properties
Properties
margin
The size in pixel of the supplemental area to render for each side of the map
padding
The padding in pixels for each side of the map
fixedCenter
Indicates whether the center of the map should remain unchanged if the viewport's size or or padding has been changed,
default is true
Type Definition Description
Options which may be used to initialize new ViewPort instance
Property Details
margin: {number=} [optional]
The size in pixel of the supplemental area to render for each side of the map
padding: {H.map.ViewPort.Padding=} [optional]
The padding in pixels for each side of the map
fixedCenter: {boolean=} [optional]
Indicates whether the center of the map should remain unchanged if the viewport's size or or
padding has been changed, default is true
Maps API for JavaScript Developer's Guide
► API Reference
Type definition: Padding
This type definition is a member of the class
H.map.ViewPort .
Type Definition Summary
Represents viewport padding definition.
[ For full details, see the Type Definition Details ]
Property Summary
Table 106: Properties
Properties
top
the padding on the top edge (in pixels)
right
the padding on the right edge (in pixels)
bottom
the padding on the bottom edge (in pixels)
left
the padding on the left edge (in pixels)
Type Definition Description
Represents viewport padding definition.
Property Details
top: {number}
the padding on the top edge (in pixels)
right: {number}
the padding on the right edge (in pixels)
bottom: {number}
the padding on the bottom edge (in pixels)
381
Maps API for JavaScript Developer's Guide
► API Reference
382
left: {number}
the padding on the left edge (in pixels)
Namespace: layer
Namespace Summary
This namespace contains interfaces and implementation classes of map layer related functionality of
the Maps API.
Namespace Description
This namespace contains interfaces and implementation classes of map layer related functionality of
the Maps API.
Class: BaseTileLayer
This class is a member of the namespace
H.map.layer .
Class Summary
Extends: H.map.layer.Layer
BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as
H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request
management.
[ For full details, see the Class Details ]
Method Summary
Table 107: Methods
Methods
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at
provided zoom level
getTileBounds (rectBounds, zoom) : {H.math.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
383
Methods
This method returns tile grid for a bounding rectangle
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or
undefined and starts loading the tile
cancelTile (x, y, z)
This method cancels a previously requested tile.
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles
which are not yet loaded will be included in response as soon as they will be available during subsequent calls.
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Maps API for JavaScript Developer's Guide
► API Reference
384
Events Summary
Table 108: Events
Events
update : {H.util.Event}
Fired when this layer's data updates
minchange : {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange : {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class Description
BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as
H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request
management.
Constructor Details
H.map.layer.BaseTileLayer(provider, opt_options)
Parameters:
provider:
{H.map.provider.TileProvider}
data source for the TileLayer
opt_options:
{H.map.layer.ITileLayer.Options=} [optional]
additional options
Method Details
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
Returns:
{H.map.provider.TileProvider}
this layer's provider
Maps API for JavaScript Developer's Guide
► API Reference
385
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection
zoom level or at provided zoom level
Parameters:
geoRect:
{H.geo.Rect}
geo bounds to be projected
opt_zoom:
{number=} [optional]
overrides current projection zoom level
Returns:
{H.math.Rect}
projected 2d space rect cooresponding to provided geo bounds
getTileBounds (rectBounds, zoom) : {H.math.Rect}
This method returns tile grid for a bounding rectangle
Parameters:
rectBounds:
{H.math.Rect}
projected rect bounds which coorespond to geo bounding box
zoom:
{number}
current zoom level
Returns:
{H.math.Rect}
rectangle which represents the tile grid bounds
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is
already loaded or undefined and starts loading the tile
Parameters:
x:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
tile row position
y:
{number}
tile column position
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
indicates whether only cached tiles are to be considered
Returns:
386
{(H.map.provider.Tile | undefined)}
tile object corresponding to requested coordinates
cancelTile (x, y, z)
This method cancels a previously requested tile.
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
zoom level
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles from the data source (provider). It can return a set of tiles which are
currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be
available during subsequent calls.
Parameters:
tileBounds:
{H.math.Rect}
bounds in tile grid
Maps API for JavaScript Developer's Guide
► API Reference
isCDB:
{boolean}
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{H.map.layer.ITileLayer.Response}
returns an array if tile which are already loaded
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
Parameters:
zoomLevel:
{number}
the zoom level to check
Returns:
{boolean}
true if this layer can provide data for the zoom level, otherwise false
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
Parameters:
min:
{number}
The new minimum zoom level of this layer
Returns:
387
Maps API for JavaScript Developer's Guide
► API Reference
388
{H.map.layer.Layer}
Returns this instance of the layer
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
Parameters:
max:
{number}
The new maximum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
Note: This function must be overridden by any class inheriting layer. The default implementation
returns null.
Parameters:
bounds:
{H.geo.Rect}
the bounding area for which to retrieve the copyright information
level:
{number}
the zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
Maps API for JavaScript Developer's Guide
► API Reference
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
389
Maps API for JavaScript Developer's Guide
► API Reference
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this layer's data updates
minchange: {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange: {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
390
Maps API for JavaScript Developer's Guide
► API Reference
391
Interface: IMarkerLayer
This interface is a member of the namespace
H.map.layer .
Interface Summary
This interface describes a layer which provides marker objects to the renderer.
[ For full details, see the Interface Details ]
Method Summary
Table 109: Methods
Methods
requestMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
requestDomMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
Interface Description
This interface describes a layer which provides marker objects to the renderer.
Adding a layer implementing this interface to the layer collection causes the render engine to render
marker objects provided by the requestMarkers function.
Method Details
requestMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
The implementation of this method must return all marker objects which are contained within this
bounding rectangle.
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
Maps API for JavaScript Developer's Guide
► API Reference
392
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
requestDomMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
The implementation of this method must return all dom marker objects which are contained within
this bounding rectangle.
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
Maps API for JavaScript Developer's Guide
► API Reference
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
393
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
Type definition: Response
This type definition is a member of the interface
H.map.layer.IMarkerLayer .
Type Definition Summary
This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers
function.
[ For full details, see the Type Definition Details ]
Property Summary
Table 110: Properties
Properties
total
The total number of markers, inclusive markers with not ready icons
markers
The marker objects for the bounding rectangle (only ready)
Maps API for JavaScript Developer's Guide
► API Reference
394
Type Definition Description
This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers
function.
Property Details
total: {number}
The total number of markers, inclusive markers with not ready icons
markers: {Array<H.map.AbstractMarker>}
The marker objects for the bounding rectangle (only ready)
Type definition: TiledResponse
This type definition is a member of the interface
H.map.layer.IMarkerLayer .
Type Definition Summary
This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers
function.
[ For full details, see the Type Definition Details ]
Property Summary
Table 111: Properties
Properties
number
of returned tiles
requested
number of requested tiles
objects
the marker objects within requested tiled area
Type Definition Description
This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers
function.
Maps API for JavaScript Developer's Guide
► API Reference
395
Property Details
number: {number}
of returned tiles
requested: {number}
number of requested tiles
objects: {Array<H.map.AbstractMarker>}
the marker objects within requested tiled area
Interface: ITileLayer
This interface is a member of the namespace
H.map.layer .
Interface Summary
This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion
(where z describes the level within the tree and x and y describe the absolute column and row indeces
whithin the level).
[ For full details, see the Interface Details ]
Method Summary
Table 112: Methods
Methods
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or
undefined and starts loading the tile
cancelTile (x, y, z)
This method cancels a previously requested tile.
Maps API for JavaScript Developer's Guide
► API Reference
396
Interface Description
This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion
(where z describes the level within the tree and x and y describe the absolute column and row indeces
whithin the level).
Adding a layer implementing this interface to the layer collection causes the render engine to retrieve
tiles and render the data contained within the tiles (see H.map.provider.Tile).
Method Details
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
An implementing object must calculate the tile grid which intersects with the given bounding
rectangle. An ITileLayer does not need to return all tiles immediately (as loading tile data from remote
sources may be asynchronous). The implementing object may return a partial response as long as the
full response cannot be synchronously provided to the renderer.
The response object returned by this method must contain the number of tiles which intersect with
the bounding rectangle at the given zoom level.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process, i.e. caching of remote
objects is strongly advised.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which tiles are to be returned
zoomLevel:
{number}
The zoom level for which the tiles are requested
cacheOnly:
{boolean}
Indicates whether only cached tiles are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
397
{H.map.layer.ITileLayer.Response}
a response object containing the total number of tiles requested and the tile
objects that could be immediately returned
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is
already loaded or undefined and starts loading the tile
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
indicates whether only cached tiles are to be considered
Returns:
{(H.map.provider.Tile | undefined)}
tile object corresponding to requested coordinates
cancelTile (x, y, z)
This method cancels a previously requested tile.
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
zoom level
Maps API for JavaScript Developer's Guide
► API Reference
398
Type definition: Options
This type definition is a member of the interface
H.map.layer.ITileLayer .
Type Definition Summary
Options which are used to initialize a TileLayer object.
[ For full details, see the Type Definition Details ]
Property Summary
Table 113: Properties
Properties
projection
an optional projection to be used for this layer, default is H.geo.mercator
opacity
tile layer opacity, default is 1
Type Definition Description
Options which are used to initialize a TileLayer object.
Property Details
projection: {H.geo.IProjection=} [optional]
an optional projection to be used for this layer, default is H.geo.mercator
opacity: {number=} [optional]
tile layer opacity, default is 1
Type definition: Response
This type definition is a member of the interface
H.map.layer.ITileLayer .
Type Definition Summary
A response object for a tile request. Contains total number of elements requested and an array of
currently available Tiles
Maps API for JavaScript Developer's Guide
► API Reference
399
[ For full details, see the Type Definition Details ]
Property Summary
Table 114: Properties
Properties
total
the total number of requested tiles
tiles
the tiles which this provider can currently return synchronously
Type Definition Description
A response object for a tile request. Contains total number of elements requested and an array of
currently available Tiles
Property Details
total: {number}
the total number of requested tiles
tiles: {Array<H.map.provider.Tile>}
the tiles which this provider can currently return synchronously
Class: Layer
This class is a member of the namespace
H.map.layer .
Class Summary
Extends: H.util.EventTarget
The Layer class represents an object that is evaluated by the renderer in the order in which it is added
to the layers collection. It provides the basic infrastructure for dispatching update events to the
renderer in case new data is available.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
400
Method Summary
Table 115: Methods
Methods
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 116: Events
Events
update : {H.util.Event}
Fired when this layer's data updates
Maps API for JavaScript Developer's Guide
► API Reference
401
Events
minchange : {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange : {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class Description
The Layer class represents an object that is evaluated by the renderer in the order in which it is added
to the layers collection. It provides the basic infrastructure for dispatching update events to the
renderer in case new data is available.
A layer is defined by a minimum and maximum zoom level for which it can provide data to the
renderer and a projection which it uses to transform geo-coordinates into 2D projected world
coordinates.
Constructor Details
H.map.layer.Layer(opt_options)
Parameters:
opt_options:
{H.map.layer.Layer.Options=} [optional]
optional configuration object
Method Details
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
Parameters:
zoomLevel:
{number}
the zoom level to check
Returns:
{boolean}
true if this layer can provide data for the zoom level, otherwise false
Maps API for JavaScript Developer's Guide
► API Reference
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
Parameters:
min:
{number}
The new minimum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
Parameters:
max:
{number}
The new maximum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
Note: This function must be overridden by any class inheriting layer. The default implementation
returns null.
Parameters:
bounds:
{H.geo.Rect}
the bounding area for which to retrieve the copyright information
level:
{number}
the zoom level for which to retrieve the copyright information
Returns:
402
Maps API for JavaScript Developer's Guide
► API Reference
403
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
404
Maps API for JavaScript Developer's Guide
► API Reference
Fired when this layer's data updates
minchange: {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange: {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Type definition: Options
This type definition is a member of the class
H.map.layer.Layer .
Type Definition Summary
Options which can be used when creating new layer object.
[ For full details, see the Type Definition Details ]
Property Summary
Table 117: Properties
Properties
min
The minimum zoom level for which the layer can provide data, default is 0
max
The maximum zoom level for which the layer can provide data, default is 22
dark
Indicates whether the content of this layer is mainly dark, default is false See also H.Map.Options#autoColor
projection
The projection to be used for this layer, default is H.geo.mercator
minWorldSize
The minimal world size at zoom level 0, default is 256
Type Definition Description
Options which can be used when creating new layer object.
405
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
min: {number=} [optional]
The minimum zoom level for which the layer can provide data, default is 0
max: {number=} [optional]
The maximum zoom level for which the layer can provide data, default is 22
dark: {boolean=} [optional]
Indicates whether the content of this layer is mainly dark, default is false See also
H.Map.Options#autoColor
projection: {H.geo.IProjection=} [optional]
The projection to be used for this layer, default is H.geo.mercator
minWorldSize: {number=} [optional]
The minimal world size at zoom level 0, default is 256
Class: MarkerTileLayer
This class is a member of the namespace
H.map.layer .
Class Summary
Extends: H.map.layer.BaseTileLayer
Implements: H.map.layer.IMarkerLayer
ObjectTileLayer represents map objects which are requested on a tile basis
[ For full details, see the Class Details ]
Method Summary
Table 118: Methods
Methods
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at
provided zoom level
406
Maps API for JavaScript Developer's Guide
► API Reference
407
Methods
getTileBounds (rectBounds, zoom) : {H.math.Rect}
This method returns tile grid for a bounding rectangle
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or
undefined and starts loading the tile
cancelTile (x, y, z)
This method cancels a previously requested tile.
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles
which are not yet loaded will be included in response as soon as they will be available during subsequent calls.
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This method adds callback which is triggered when the object is being disposed
requestMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
requestDomMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
Events Summary
Table 119: Events
Events
update : {H.util.Event}
Fired when this layer's data updates
minchange : {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange : {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class Description
ObjectTileLayer represents map objects which are requested on a tile basis
Constructor Details
H.map.layer.MarkerTileLayer(provider, opt_options)
Parameters:
provider:
{H.map.provider.MarkerTileProvider}
opt_options:
{H.map.layer.ITileLayer.Options=} [optional]
408
Maps API for JavaScript Developer's Guide
► API Reference
409
Method Details
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
Returns:
{H.map.provider.TileProvider}
this layer's provider
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection
zoom level or at provided zoom level
Parameters:
geoRect:
{H.geo.Rect}
geo bounds to be projected
opt_zoom:
{number=} [optional]
overrides current projection zoom level
Returns:
{H.math.Rect}
projected 2d space rect cooresponding to provided geo bounds
getTileBounds (rectBounds, zoom) : {H.math.Rect}
This method returns tile grid for a bounding rectangle
Parameters:
rectBounds:
{H.math.Rect}
projected rect bounds which coorespond to geo bounding box
zoom:
{number}
current zoom level
Returns:
{H.math.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
410
rectangle which represents the tile grid bounds
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is
already loaded or undefined and starts loading the tile
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
indicates whether only cached tiles are to be considered
Returns:
{(H.map.provider.Tile | undefined)}
tile object corresponding to requested coordinates
cancelTile (x, y, z)
This method cancels a previously requested tile.
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
zoom level
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
Maps API for JavaScript Developer's Guide
► API Reference
411
This method requests tiles from the data source (provider). It can return a set of tiles which are
currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be
available during subsequent calls.
Parameters:
tileBounds:
{H.math.Rect}
bounds in tile grid
isCDB:
{boolean}
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{H.map.layer.ITileLayer.Response}
returns an array if tile which are already loaded
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
Parameters:
zoomLevel:
{number}
the zoom level to check
Returns:
{boolean}
true if this layer can provide data for the zoom level, otherwise false
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
min:
{number}
The new minimum zoom level of this layer
Returns:
412
{H.map.layer.Layer}
Returns this instance of the layer
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
Parameters:
max:
{number}
The new maximum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
Note: This function must be overridden by any class inheriting layer. The default implementation
returns null.
Parameters:
bounds:
{H.geo.Rect}
the bounding area for which to retrieve the copyright information
level:
{number}
the zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
Maps API for JavaScript Developer's Guide
► API Reference
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
413
Maps API for JavaScript Developer's Guide
► API Reference
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
414
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
requestMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
The implementation of this method must return all marker objects which are contained within this
bounding rectangle.
Maps API for JavaScript Developer's Guide
► API Reference
415
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
requestDomMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
The implementation of this method must return all dom marker objects which are contained within
this bounding rectangle.
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
416
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
Event Details
update: {H.util.Event}
Fired when this layer's data updates
minchange: {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange: {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class: ObjectLayer
This class is a member of the namespace
Class Summary
Implements: H.map.layer.ITileLayer
Implements: H.map.layer.IMarkerLayer
Extends: H.map.layer.Layer
H.map.layer .
Maps API for JavaScript Developer's Guide
► API Reference
417
This class represents a layer which renders map objects. Spatial objects like polygons and polylines
a rendered to tiles before being passed to the enigne. Point objects like markers are provided as
objects given an rectangular area.
[ For full details, see the Class Details ]
Method Summary
Table 120: Methods
Methods
getProvider () : {H.map.provider.ObjectProvider}
This method returns current ObjectLayer's data provider
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or
undefined and starts loading the tile
cancelTile (x, y, z)
This method cancels a previously requested tile.
requestMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
requestDomMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
Maps API for JavaScript Developer's Guide
► API Reference
418
Methods
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 121: Events
Events
update : {H.util.Event}
Fired when this layer's data updates
minchange : {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange : {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class Description
This class represents a layer which renders map objects. Spatial objects like polygons and polylines
a rendered to tiles before being passed to the enigne. Point objects like markers are provided as
objects given an rectangular area.
Maps API for JavaScript Developer's Guide
► API Reference
419
Constructor Details
H.map.layer.ObjectLayer(provider, opt_options)
Parameters:
provider:
{H.map.provider.ObjectProvider}
the ObjectProvider which provides the map objects to this object layer.
opt_options:
{H.map.layer.ObjectLayer.Options=} [optional]
The options for this layer
Method Details
getProvider () : {H.map.provider.ObjectProvider}
This method returns current ObjectLayer's data provider
Returns:
{H.map.provider.ObjectProvider}
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
An implementing object must calculate the tile grid which intersects with the given bounding
rectangle. An ITileLayer does not need to return all tiles immediately (as loading tile data from remote
sources may be asynchronous). The implementing object may return a partial response as long as the
full response cannot be synchronously provided to the renderer.
The response object returned by this method must contain the number of tiles which intersect with
the bounding rectangle at the given zoom level.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process, i.e. caching of remote
objects is strongly advised.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which tiles are to be returned
zoomLevel:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
The zoom level for which the tiles are requested
cacheOnly:
{boolean}
Indicates whether only cached tiles are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
420
{H.map.layer.ITileLayer.Response}
a response object containing the total number of tiles requested and the tile
objects that could be immediately returned
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is
already loaded or undefined and starts loading the tile
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
indicates whether only cached tiles are to be considered
Returns:
{(H.map.provider.Tile | undefined)}
tile object corresponding to requested coordinates
cancelTile (x, y, z)
This method cancels a previously requested tile.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
zoom level
421
requestMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests marker objects for provided bounding rectangle.
The implementation of this method must return all marker objects which are contained within this
bounding rectangle.
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
422
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
requestDomMarkers (boundingRect, zoomLevel, cacheOnly,
prioCenter) : {(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
This method requests dom marker objects for provided bounding rectangle.
The implementation of this method must return all dom marker objects which are contained within
this bounding rectangle.
The response object returned by this method must contain the number of objects which intersect
with the bounding rectangle.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which marker are to be returned
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{(H.map.layer.IMarkerLayer.Response |
H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves
isValid (zoomLevel) : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
This method checks if a zoom level can be served by this layer.
Parameters:
zoomLevel:
{number}
the zoom level to check
Returns:
{boolean}
true if this layer can provide data for the zoom level, otherwise false
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
Parameters:
min:
{number}
The new minimum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
Parameters:
max:
{number}
The new maximum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
423
Maps API for JavaScript Developer's Guide
► API Reference
424
Note: This function must be overridden by any class inheriting layer. The default implementation
returns null.
Parameters:
bounds:
{H.geo.Rect}
the bounding area for which to retrieve the copyright information
level:
{number}
the zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
425
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this layer's data updates
minchange: {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange: {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Type definition: Options
This type definition is a member of the class
H.map.layer.ObjectLayer .
Type Definition Summary
Configuration object which can be use to initialize the ObjectLayer.
[ For full details, see the Type Definition Details ]
Property Summary
Table 122: Properties
Properties
tileSize
the size of the tiles rendered by this layer for polylines and polygons (must be power of 2, default is 256)
tileCacheSize
the number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
dataCacheSize
the number of tiles to cache which have render data only, default is 512
426
Maps API for JavaScript Developer's Guide
► API Reference
427
Properties
pixelRatio
The pixelRatio to use for over-sampling in cases of high-resolution displays
Type Definition Description
Configuration object which can be use to initialize the ObjectLayer.
Property Details
tileSize: {number=} [optional]
the size of the tiles rendered by this layer for polylines and polygons (must be power of 2, default is
256)
tileCacheSize: {number=} [optional]
the number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
dataCacheSize: {number=} [optional]
the number of tiles to cache which have render data only, default is 512
pixelRatio: {number=} [optional]
The pixelRatio to use for over-sampling in cases of high-resolution displays
Class: TileLayer
This class is a member of the namespace
H.map.layer .
Class Summary
Implements: H.map.layer.ITileLayer
Extends: H.map.layer.BaseTileLayer
Tile Layer, represents data shown on map on a tile basis. Can be used to show map tile images or
other type of data which is partitioned into tiles.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
428
Method Summary
Table 123: Methods
Methods
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or
undefined and starts loading the tile
cancelTile (x, y, z)
This method cancels a previously requested tile.
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at
provided zoom level
getTileBounds (rectBounds, zoom) : {H.math.Rect}
This method returns tile grid for a bounding rectangle
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles
which are not yet loaded will be included in response as soon as they will be available during subsequent calls.
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Maps API for JavaScript Developer's Guide
► API Reference
429
Methods
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 124: Events
Events
update : {H.util.Event}
Fired when this layer's data updates
minchange : {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange : {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Class Description
Tile Layer, represents data shown on map on a tile basis. Can be used to show map tile images or
other type of data which is partitioned into tiles.
The TileLayer class is an implementation of the ITileLayer interface which uses an ITileProivder as a
data source. It delegates tile requests to its provider.
Constructor Details
H.map.layer.TileLayer(provider, opt_options)
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
provider:
{H.map.provider.TileProvider}
data source for the TileLayer
opt_options:
{H.map.layer.ITileLayer.Options=} [optional]
additional options
430
Method Details
requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles for the current bounding rectangle at the given zoom level (z-value).
An implementing object must calculate the tile grid which intersects with the given bounding
rectangle. An ITileLayer does not need to return all tiles immediately (as loading tile data from remote
sources may be asynchronous). The implementing object may return a partial response as long as the
full response cannot be synchronously provided to the renderer.
The response object returned by this method must contain the number of tiles which intersect with
the bounding rectangle at the given zoom level.
This method will be called by the renderer for each rendering cycle. An implementing object must
make sure that calling this method does not impede the rendering process, i.e. caching of remote
objects is strongly advised.
Parameters:
boundingRect:
{H.geo.Rect}
the bounding rectangle for which tiles are to be returned
zoomLevel:
{number}
The zoom level for which the tiles are requested
cacheOnly:
{boolean}
Indicates whether only cached tiles are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
431
{H.map.layer.ITileLayer.Response}
a response object containing the total number of tiles requested and the tile
objects that could be immediately returned
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
This method requests a single tile according to tile coordinates. It returns either a Tile object if it is
already loaded or undefined and starts loading the tile
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
indicates whether only cached tiles are to be considered
Returns:
{(H.map.provider.Tile | undefined)}
tile object corresponding to requested coordinates
cancelTile (x, y, z)
This method cancels a previously requested tile.
Parameters:
x:
{number}
tile row position
y:
{number}
tile column position
z:
{number}
zoom level
Maps API for JavaScript Developer's Guide
► API Reference
432
getProvider () : {H.map.provider.TileProvider}
This method returns the provider which feeds this layer with data.
Returns:
{H.map.provider.TileProvider}
this layer's provider
geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}
This method transforms a geo-rectangle to geometrical projected rectangle at the current projection
zoom level or at provided zoom level
Parameters:
geoRect:
{H.geo.Rect}
geo bounds to be projected
opt_zoom:
{number=} [optional]
overrides current projection zoom level
Returns:
{H.math.Rect}
projected 2d space rect cooresponding to provided geo bounds
getTileBounds (rectBounds, zoom) : {H.math.Rect}
This method returns tile grid for a bounding rectangle
Parameters:
rectBounds:
{H.math.Rect}
projected rect bounds which coorespond to geo bounding box
zoom:
{number}
current zoom level
Returns:
{H.math.Rect}
rectangle which represents the tile grid bounds
Maps API for JavaScript Developer's Guide
► API Reference
433
getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) :
{H.map.layer.ITileLayer.Response}
This method requests tiles from the data source (provider). It can return a set of tiles which are
currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be
available during subsequent calls.
Parameters:
tileBounds:
{H.math.Rect}
bounds in tile grid
isCDB:
{boolean}
zoomLevel:
{number}
The zoom level for which the objects are requested
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
The priority center as an offset in screen pixel relative to the center
Returns:
{H.map.layer.ITileLayer.Response}
returns an array if tile which are already loaded
isValid (zoomLevel) : {boolean}
This method checks if a zoom level can be served by this layer.
Parameters:
zoomLevel:
{number}
the zoom level to check
Returns:
{boolean}
true if this layer can provide data for the zoom level, otherwise false
Maps API for JavaScript Developer's Guide
► API Reference
setMin (min) : {H.map.layer.Layer}
This method sets the minimum zoom level for which this layer will provide tiles.
Parameters:
min:
{number}
The new minimum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
setMax (max) : {H.map.layer.Layer}
This method sets the maximum zoom level for which this layer will provide tiles.
Parameters:
max:
{number}
The new maximum zoom level of this layer
Returns:
{H.map.layer.Layer}
Returns this instance of the layer
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyright current data provider.
Note: This function must be overridden by any class inheriting layer. The default implementation
returns null.
Parameters:
bounds:
{H.geo.Rect}
the bounding area for which to retrieve the copyright information
level:
{number}
the zoom level for which to retrieve the copyright information
Returns:
434
Maps API for JavaScript Developer's Guide
► API Reference
435
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
436
Maps API for JavaScript Developer's Guide
► API Reference
437
Fired when this layer's data updates
minchange: {H.util.ChangeEvent}
Fired when this layer's minimum zoom level changes.
maxchange: {H.util.ChangeEvent}
Fired when this layer's maximum zoom level changes.
Namespace: provider
Namespace Summary
This namespace contains interfaces and implementations of provider.
Namespace Description
This namespace contains interfaces and implementations of provider.
Providers represent data sources, which provide arbitrary data to the Maps API's rendering engines.
Specializations of this concept are tile providers (which create tile-partitioned data to be used by the
renderer) and object providers (which provide map objects to the renderer for consumption).
Providers implement the communication with backend-services and caching of received data.
Class: ImageTileProvider
This class is a member of the namespace
H.map.provider .
Class Summary
Extends: H.map.provider.RemoteTileProvider
An ImageTileProvider uses network service to provide bitmap images as tiles.
[ For full details, see the Class Details ]
Property Summary
Table 125: Properties
Properties
tileSize : {number}
Size of a tile image supported by the provider
Maps API for JavaScript Developer's Guide
► API Reference
Properties
requestTile : {}
Request data on a tile basis
cancelTile : {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey : {}
Cancels tile from being requested using a tile-key
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 126: Methods
Methods
getCache () : {H.util.ICache}
This method returns cache which should be used to store tiles
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
reload (hard)
This method instructs the provider to reload data from it's source.
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by
underscores e.g.: "4711_7_42_23"
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
438
Maps API for JavaScript Developer's Guide
► API Reference
439
Methods
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 127: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
An ImageTileProvider uses network service to provide bitmap images as tiles.
Constructor Details
H.map.provider.ImageTileProvider(options)
Parameters:
options:
{H.map.provider.ImageTileProvider.Options}
configuration for tile provider
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
tileSize: {number}
Size of a tile image supported by the provider
requestTile: {}
Request data on a tile basis
cancelTile: {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey: {}
Cancels tile from being requested using a tile-key
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
getCache () : {H.util.ICache}
This method returns cache which should be used to store tiles
Returns:
{H.util.ICache}
cache
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
Parameters:
x:
{number}
The row number of the tile
440
Maps API for JavaScript Developer's Guide
► API Reference
441
y:
{number}
The column number of the tile
z:
{number}
The zoom level for which the tile is requested
onResponse:
{function((Array<H.map.Object> | HTMLImageElement | HTMLCanvasElement | null), *=)}
function which is called after response arrives
onError:
{function(string=)}
function which is called in case of communication error
Returns:
{H.util.ICancelable}
reload (hard)
This method instructs the provider to reload data from it's source.
Two reload modes are possible:
•
•
hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to
re-fetch the tiles. Currently cached tiles will not be used for rendering.
soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the
earliest convenience. The provider does not invalidate the cache immediately in this case. This
means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
hard:
{boolean}
a boolean flag indicating whether to invalidate in hard mode (true) or in
soft mode (false);
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
Parameters:
x:
{number}
x tile coordinate (row)
Maps API for JavaScript Developer's Guide
► API Reference
442
y:
{number}
y tile coordinate (column)
z:
{number}
tile coordinate (zoom)
data:
{(HTMLImageElement | HTMLCanvasElement)}
data for the tile
opt_options:
{Object<string, *>=} [optional]
free form options object. These options are meant to be used in tile specific
rendering cases
Returns:
{H.map.provider.Tile}
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates,
seperated by underscores e.g.: "4711_7_42_23"
Parameters:
x:
{number}
The x tile coordinate (row)
y:
{number}
The y tile coordinate (column)
z:
{number}
The z tile coordinate (zoom level)
Returns:
{string}
string
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Maps API for JavaScript Developer's Guide
► API Reference
443
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
444
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Type definition: Options
This type definition is a member of the class
H.map.provider.ImageTileProvider .
Type Definition Summary
Options which are used to initialize the ImageTileProvider object.
[ For full details, see the Type Definition Details ]
Property Summary
Table 128: Properties
Properties
min
The minimal supported zoom level, default is 0
max
The max maximal supported zoom level, default is 22
getURL
The function to create an URL for the specified tile. If the returned value is falsy tile is not requested.
crossOrigin
The string to be set for the crossOrigin attribute for loaded images
tileSize
The size of a single tile in pixels, default is 256
445
Maps API for JavaScript Developer's Guide
► API Reference
446
Type Definition Description
Options which are used to initialize the ImageTileProvider object.
Property Details
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The max maximal supported zoom level, default is 22
getURL: {function(number, number, number)}
The function to create an URL for the specified tile. If the returned value is falsy tile is not
requested.
crossOrigin: {boolean=} [optional]
The string to be set for the crossOrigin attribute for loaded images
tileSize: {number=} [optional]
The size of a single tile in pixels, default is 256
Class: Invalidations
This class is a member of the namespace
H.map.provider .
Class Summary
This class represents invalidation states of a renderable object. A renderer can optimize its rendering
strategies based on the information in this object.
[ For full details, see the Class Details ]
Property Summary
Table 129: Properties
Properties
static
MARK_INITIAL : {H.map.provider.Invalidations.Mark}
This constant represents the initial invalidation mark an invalidations object has.
Maps API for JavaScript Developer's Guide
► API Reference
447
Method Summary
Table 130: Methods
Methods
update (mark, types)
To update invalidation marks accordingly to the given the invalidation types.
getMark () : {H.map.provider.Invalidations.Mark}
This method returns the current invalidation mark of this invalidations object.
isAny (since) : {boolean}
Checks whether any change occurred after the specified since mark
isVisual (since) : {boolean}
Checks whether a visual change occurred after the specified since mark
isSpatial (since) : {boolean}
Checks whether a spatial change occurred after the specified since mark
isAdd (since) : {boolean}
Checks whether an add-operation occurred after the specified since mark
isRemove (since) : {boolean}
Checks whether a remove operation occurred after the specified since mark
isZOrder (since) : {boolean}
Checks whether a z-order change occurred after the specified since mark
Class Description
This class represents invalidation states of a renderable object. A renderer can optimize its rendering
strategies based on the information in this object.
For example, renderers may differentiate between a purely visual change of an object and a spatial
change of an object. One may only require the change of a color during rendering, the other requires
to re-project the object.
Constructor Details
H.map.provider.Invalidations()
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
static MARK_INITIAL: {H.map.provider.Invalidations.Mark}
This constant represents the initial invalidation mark an invalidations object has.
Method Details
update (mark, types)
To update invalidation marks accordingly to the given the invalidation types.
Parameters:
mark:
{H.map.provider.Invalidations.Mark}
The invalidation mark to set
types:
{H.math.BitMask}
The descrete invalidation types to update
getMark () : {H.map.provider.Invalidations.Mark}
This method returns the current invalidation mark of this invalidations object.
Returns:
{H.map.provider.Invalidations.Mark}
the current invalidation mark
isAny (since) : {boolean}
Checks whether any change occurred after the specified since mark
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
Returns:
{boolean}
isVisual (since) : {boolean}
Checks whether a visual change occurred after the specified since mark
448
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
Returns:
{boolean}
isSpatial (since) : {boolean}
Checks whether a spatial change occurred after the specified since mark
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
Returns:
{boolean}
isAdd (since) : {boolean}
Checks whether an add-operation occurred after the specified since mark
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
Returns:
{boolean}
isRemove (since) : {boolean}
Checks whether a remove operation occurred after the specified since mark
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
449
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{boolean}
isZOrder (since) : {boolean}
Checks whether a z-order change occurred after the specified since mark
Parameters:
since:
{H.map.provider.Invalidations.Mark}
The invalidation mark to check against
Returns:
{boolean}
Enumeration: Flag
This enumeration is a member of the class
H.map.provider.Invalidations .
Enumeration Summary
This enumeration encapsulates bit flags for different invalidations of map objects.
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 131: Constants
Constants
static
NONE
static
VISUAL
static
SPATIAL
static
ADD
static
REMOVE
static
Z_ORDER
450
Maps API for JavaScript Developer's Guide
► API Reference
451
Enumeration Details
This enumeration encapsulates bit flags for different invalidations of map objects.
Flags can be combined to signal multiple changes at the same time. These flags are used by providers
to differentiate different kinds of property changes in order to optimize the rendering.
Values of this emumeration are:
•
•
•
•
•
•
VISUAL (an object's visual appearance has been changed)
SPATIAL (an object's geospatial attribute has been changed)
REMOVE (an item has been removed from a provider)
ADD (an item has been added to a provider)
Z_ORDER (an item's z-index or it's index within its parent's children collection has been changed)
NONE (indicating that no change has occured)
Enumeration Constants Details
static NONE
static VISUAL
static SPATIAL
static ADD
static REMOVE
static Z_ORDER
Type definition: Mark
This type definition is a member of the class
H.map.provider.Invalidations .
Type Definition Summary
The invalidation mark represents a counter which is increased whenever an invalidation takes place.
[ For full details, see the Type Definition Details ]
Type Definition Description
The invalidation mark represents a counter which is increased whenever an invalidation takes place.
Maps API for JavaScript Developer's Guide
► API Reference
452
Class: LocalObjectProvider
This class is a member of the namespace
H.map.provider .
Class Summary
Extends: H.map.provider.ObjectProvider
A LocalObjectProvider acts as a database for map objects. It provides functionality to
fetch visible objects within concrete geographical bounds and zoom levels. All objects are
organized within a hierarchical group structure. An object can be added to the provider by
adding it to a group within this structure. The root group of the provider can be fetched via
H.map.provider.LocalObjectProvider#getRootGroup. A H.Map has already its own LocalObjectProvider
and provides functionality to add and remove objects. Only in advanced use cases there is a need to
create an additional LocalObjectProvider.
[ For full details, see the Class Details ]
Property Summary
Table 132: Properties
Properties
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 133: Methods
Methods
getRootGroup () : {H.map.Group}
Returns the root group of this provider.
removeObject (object)
Maps API for JavaScript Developer's Guide
► API Reference
453
Methods
To remove an object from this provider's database. It must not called directly. It is invoked by H.map.Group which checks
beforehand, that it is an H.map.Object instance and its provider is this provider.
getInvalidations (opt_type) : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the
given map object and triggers dispatchUpdate()
providesSpatials () : {boolean}
Checks whether this provider is currently providing spatial map objects. A concrete implementation of ObjectProvider must
override it if it currently provides Spatials.
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns all polyline, polygon, circle and rect objects which intersect with the provided area.
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
providesMarkers () : {boolean}
Checks whether this provider is currently providing Marker map objects. A concrete implementation of ObjectProvider must
override it if it currently provides Markers.
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}
Returns all Marker map objects which intersect with the provided rectangular area.
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing DomMarker map objects. A concrete implementation of ObjectProvider
must override it if it currently provides Markers.
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}
Returns all DomMarker map objects which intersect with the provided rectangular area.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
454
Methods
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 134: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
A LocalObjectProvider acts as a database for map objects. It provides functionality to
fetch visible objects within concrete geographical bounds and zoom levels. All objects are
organized within a hierarchical group structure. An object can be added to the provider by
adding it to a group within this structure. The root group of the provider can be fetched via
H.map.provider.LocalObjectProvider#getRootGroup. A H.Map has already its own LocalObjectProvider
and provides functionality to add and remove objects. Only in advanced use cases there is a need to
create an additional LocalObjectProvider.
Example
// Create your own LocalObjectProvider and add some hierarchical
objects:
myProvider = new H.map.provider.LocalObjectProvider();
myMap.addLayer(new H.map.layer.ObjectLayer(myProvider));
hereDotCom = {lat: 52.5308, lng: 13.3852};
myGroup = new H.map.Group();
myGroup.addObject(new H.map.Circle(hereDotCom, 35));
myProvider.getRootGroup().addObjects([
myGroup,
new H.map.Marker(hereDotCom)
]);
Maps API for JavaScript Developer's Guide
► API Reference
455
myMap.setCenter(hereDotCom).setZoom(18);
Constructor Details
H.map.provider.LocalObjectProvider(opt_options)
Parameters:
opt_options:
{H.map.provider.Provider.Options=} [optional]
Property Details
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
getRootGroup () : {H.map.Group}
Returns the root group of this provider.
Returns:
{H.map.Group}
removeObject (object)
To remove an object from this provider's database. It must not called directly. It is invoked by
H.map.Group which checks beforehand, that it is an H.map.Object instance and its provider is this
provider.
Parameters:
object:
{!H.map.Object}
The object to remove
Maps API for JavaScript Developer's Guide
► API Reference
456
getInvalidations (opt_type) : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
Parameters:
opt_type:
{H.map.Object.Type=} [optional]
The type of objects to consider for the invalidations. If undefined, all types
are taken into account.
Returns:
{H.map.provider.Invalidations}
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations
of this provider and the given map object and triggers dispatchUpdate()
Parameters:
mapObject:
{!H.map.Object}
The map object to be invalidated
changes:
{H.math.BitMask}
The flags indicating the types of occurred changes
providesSpatials () : {boolean}
Checks whether this provider is currently providing spatial map objects. A concrete implementation
of ObjectProvider must override it if it currently provides Spatials.
Returns:
{boolean}
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Returns all polyline, polygon, circle and rect objects which intersect with the provided area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
Maps API for JavaScript Developer's Guide
► API Reference
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
457
{Array<H.map.Spatial>}
a list of intersecting objects
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
Parameters:
tile:
{H.map.provider.SpatialTile}
The tile for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Spatial>}
a list of intersecting objects
providesMarkers () : {boolean}
Checks whether this provider is currently providing Marker map objects. A concrete implementation
of ObjectProvider must override it if it currently provides Markers.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{boolean}
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Marker>}
Returns all Marker map objects which intersect with the provided rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Marker>}
a list of intersecting objects
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing DomMarker map objects. A concrete
implementation of ObjectProvider must override it if it currently provides Markers.
Returns:
{boolean}
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.DomMarker>}
Returns all DomMarker map objects which intersect with the provided rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
458
Maps API for JavaScript Developer's Guide
► API Reference
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
459
{Array<H.map.DomMarker>}
a list of intersecting objects
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
460
Maps API for JavaScript Developer's Guide
► API Reference
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Class: MarkerTileProvider
This class is a member of the namespace
H.map.provider .
461
Maps API for JavaScript Developer's Guide
► API Reference
462
Class Summary
Extends: H.map.provider.RemoteTileProvider
A MarkerTileProvider uses network service to provide markers on tile basis.
[ For full details, see the Class Details ]
Property Summary
Table 135: Properties
Properties
requestTile : {}
Request data on a tile basis
cancelTile : {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey : {}
Cancels tile from being requested using a tile-key
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 136: Methods
Methods
invalidateObject (marker, flags)
To signal to this provider that a map object has been changed. The method marks tile, that contains that objectm as invalid
and triggers dispatchUpdate()
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing H.map.DomMarker map objects.
getCache () : {H.util.ICache}
Maps API for JavaScript Developer's Guide
► API Reference
463
Methods
This method returns cache which should be used to store tiles
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
reload (hard)
This method instructs the provider to reload data from it's source.
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by
underscores e.g.: "4711_7_42_23"
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 137: Events
Events
update : {H.util.Event}
Maps API for JavaScript Developer's Guide
► API Reference
Events
Fired when this provider's data updates
Class Description
A MarkerTileProvider uses network service to provide markers on tile basis.
Constructor Details
H.map.provider.MarkerTileProvider(options)
Parameters:
options:
{H.map.provider.MarkerTileProvider.Options}
configuration for tile provider
Property Details
requestTile: {}
Request data on a tile basis
cancelTile: {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey: {}
Cancels tile from being requested using a tile-key
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
invalidateObject (marker, flags)
464
Maps API for JavaScript Developer's Guide
► API Reference
465
To signal to this provider that a map object has been changed. The method marks tile, that contains
that objectm as invalid and triggers dispatchUpdate()
Parameters:
marker:
{!H.map.AbstractMarker}
The map object to be invalidated
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing H.map.DomMarker map objects.
Returns:
{boolean}
getCache () : {H.util.ICache}
This method returns cache which should be used to store tiles
Returns:
{H.util.ICache}
cache
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
Parameters:
x:
{number}
The row number of the tile
y:
{number}
The column number of the tile
z:
{number}
The zoom level for which the tile is requested
Maps API for JavaScript Developer's Guide
► API Reference
onResponse:
466
{function((Array<H.map.Object> | HTMLImageElement | HTMLCanvasElement | null), *=)}
function which is called after response arrives
onError:
{function(string=)}
function which is called in case of communication error
Returns:
{H.util.ICancelable}
reload (hard)
This method instructs the provider to reload data from it's source.
Two reload modes are possible:
•
hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to
re-fetch the tiles. Currently cached tiles will not be used for rendering.
•
soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the
earliest convenience. The provider does not invalidate the cache immediately in this case. This
means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
hard:
{boolean}
a boolean flag indicating whether to invalidate in hard mode (true) or in
soft mode (false);
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
Parameters:
x:
{number}
x tile coordinate (row)
y:
{number}
y tile coordinate (column)
z:
{number}
tile coordinate (zoom)
Maps API for JavaScript Developer's Guide
► API Reference
467
data:
{(HTMLImageElement | HTMLCanvasElement)}
data for the tile
opt_options:
{Object<string, *>=} [optional]
free form options object. These options are meant to be used in tile specific
rendering cases
Returns:
{H.map.provider.Tile}
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates,
seperated by underscores e.g.: "4711_7_42_23"
Parameters:
x:
{number}
The x tile coordinate (row)
y:
{number}
The y tile coordinate (column)
z:
{number}
The z tile coordinate (zoom level)
Returns:
{string}
string
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
468
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
469
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
470
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Type definition: Options
This type definition is a member of the class
H.map.provider.MarkerTileProvider .
Type Definition Summary
Options which are used to initialize the MarkerTileProvider object.
[ For full details, see the Type Definition Details ]
Property Summary
Table 138: Properties
Properties
min
The minimal supported zoom level, default is 0
max
The maximal supported zoom level, default is 22
requestData
function that fetches marker data and creates array of H.map.AbstractMarker that is passed success callback, if function
fails to fetch data onError callback must be called
providesDomMarkers
indicates if markers provided are of type H.map.DomMarker or H.map.Marker, default is H.map.Marker
Type Definition Description
Options which are used to initialize the MarkerTileProvider object.
Maps API for JavaScript Developer's Guide
► API Reference
Property Details
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The maximal supported zoom level, default is 22
requestData: {function(number, number, number,
function(Array<H.map.AbstractMarker>), Function) : H.util.ICancelable}
function that fetches marker data and creates array of H.map.AbstractMarker that is passed
success callback, if function fails to fetch data onError callback must be called
providesDomMarkers: {boolean=} [optional]
indicates if markers provided are of type H.map.DomMarker or H.map.Marker, default is
H.map.Marker
Class: ObjectProvider
This class is a member of the namespace
H.map.provider .
Class Summary
Extends: H.map.provider.Provider
An abstract class to manage and provide map objects (Marker, Polyline, Polygon)
[ For full details, see the Class Details ]
Property Summary
Table 139: Properties
Properties
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
471
Maps API for JavaScript Developer's Guide
► API Reference
472
Method Summary
Table 140: Methods
Methods
getInvalidations (opt_type) : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the
given map object and triggers dispatchUpdate()
providesSpatials () : {boolean}
Checks whether this provider is currently providing spatial map objects. A concrete implementation of ObjectProvider must
override it if it currently provides Spatials.
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns all polyline, polygon, circle and rect objects which intersect with the provided area.
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
providesMarkers () : {boolean}
Checks whether this provider is currently providing Marker map objects. A concrete implementation of ObjectProvider must
override it if it currently provides Markers.
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}
Returns all Marker map objects which intersect with the provided rectangular area.
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing DomMarker map objects. A concrete implementation of ObjectProvider
must override it if it currently provides Markers.
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}
Returns all DomMarker map objects which intersect with the provided rectangular area.
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
473
Methods
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 141: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
An abstract class to manage and provide map objects (Marker, Polyline, Polygon)
Constructor Details
H.map.provider.ObjectProvider(opt_options)
Parameters:
opt_options:
{H.map.provider.Provider.Options=} [optional]
Property Details
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
Maps API for JavaScript Developer's Guide
► API Reference
474
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
getInvalidations (opt_type) : {H.map.provider.Invalidations}
Returns the accumulate invalidations of this provider's objects that have occurred.
Parameters:
opt_type:
{H.map.Object.Type=} [optional]
The type of objects to consider for the invalidations. If undefined, all types
are taken into account.
Returns:
{H.map.provider.Invalidations}
invalidateObject (mapObject, changes)
To signal to this provider that a map object has been changed. The method updates the Invalidations
of this provider and the given map object and triggers dispatchUpdate()
Parameters:
mapObject:
{!H.map.Object}
The map object to be invalidated
changes:
{H.math.BitMask}
The flags indicating the types of occurred changes
providesSpatials () : {boolean}
Checks whether this provider is currently providing spatial map objects. A concrete implementation
of ObjectProvider must override it if it currently provides Spatials.
Returns:
{boolean}
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Maps API for JavaScript Developer's Guide
► API Reference
Returns all polyline, polygon, circle and rect objects which intersect with the provided area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Spatial>}
a list of intersecting objects
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) :
{Array<H.map.Spatial>}
Returns the spatial objects which intersect the given tile
Parameters:
tile:
{H.map.provider.SpatialTile}
The tile for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Spatial>}
a list of intersecting objects
475
Maps API for JavaScript Developer's Guide
► API Reference
476
providesMarkers () : {boolean}
Checks whether this provider is currently providing Marker map objects. A concrete implementation
of ObjectProvider must override it if it currently provides Markers.
Returns:
{boolean}
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.Marker>}
Returns all Marker map objects which intersect with the provided rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.Marker>}
a list of intersecting objects
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing DomMarker map objects. A concrete
implementation of ObjectProvider must override it if it currently provides Markers.
Returns:
{boolean}
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) :
{Array<H.map.DomMarker>}
Maps API for JavaScript Developer's Guide
► API Reference
477
Returns all DomMarker map objects which intersect with the provided rectangular area.
Parameters:
geoRect:
{H.geo.Rect}
A rectangular area in geo space to intersect with
zoomLevel:
{number}
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
Indicates whether only cached objects are to be considered
Returns:
{Array<H.map.DomMarker>}
a list of intersecting objects
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
478
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Class: Provider
This class is a member of the namespace
H.map.provider .
479
Maps API for JavaScript Developer's Guide
► API Reference
480
Class Summary
Extends: H.util.EventTarget
A Provider defines an object which works as a database for the map. Providers can exists in different
forms they can implement client side object storage or they can request data from the remote
service.
[ For full details, see the Class Details ]
Property Summary
Table 142: Properties
Properties
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 143: Methods
Methods
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
Maps API for JavaScript Developer's Guide
► API Reference
481
Methods
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 144: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
A Provider defines an object which works as a database for the map. Providers can exists in different
forms they can implement client side object storage or they can request data from the remote
service.
Constructor Details
H.map.provider.Provider(opt_options)
Parameters:
opt_options:
{H.map.provider.Provider.Options=} [optional]
Property Details
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Maps API for JavaScript Developer's Guide
► API Reference
482
Provider instance unique identifier, generated at construction time
Method Details
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
Maps API for JavaScript Developer's Guide
► API Reference
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
483
Maps API for JavaScript Developer's Guide
► API Reference
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Type definition: Options
This type definition is a member of the class
H.map.provider.Provider .
Type Definition Summary
Options which are used to initialize the Povider
[ For full details, see the Type Definition Details ]
Property Summary
Table 145: Properties
Properties
min
The minimal supported zoom level, default is 0
max
484
Maps API for JavaScript Developer's Guide
► API Reference
485
Properties
The max maximal supported zoom level, default is 22
getCopyrights
Property overrides default getCopyrights method
Type Definition Description
Options which are used to initialize the Povider
Property Details
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The max maximal supported zoom level, default is 22
getCopyrights: {function(H.geo.Rect, number)=} [optional]
Property overrides default getCopyrights method
Class: RemoteTileProvider
This class is a member of the namespace
H.map.provider .
Class Summary
Extends: H.map.provider.TileProvider
RemoteTileProvider is an abstract class which should be used by classes implementing data provision
on a tile basis. Every child class needs to implement 'requestInternal' (to request remote tile) and
'getCache' (to provide configured cache object were tiled data is being cached)
[ For full details, see the Class Details ]
Property Summary
Table 146: Properties
Properties
requestTile : {}
Request data on a tile basis
Maps API for JavaScript Developer's Guide
► API Reference
Properties
cancelTile : {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey : {}
Cancels tile from being requested using a tile-key
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 147: Methods
Methods
getCache () : {H.util.ICache}
This method returns cache which should be used to store tiles
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
reload (hard)
This method instructs the provider to reload data from it's source.
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by
underscores e.g.: "4711_7_42_23"
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
486
Maps API for JavaScript Developer's Guide
► API Reference
487
Methods
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 148: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
RemoteTileProvider is an abstract class which should be used by classes implementing data provision
on a tile basis. Every child class needs to implement 'requestInternal' (to request remote tile) and
'getCache' (to provide configured cache object were tiled data is being cached)
Constructor Details
H.map.provider.RemoteTileProvider(options)
Parameters:
options:
{H.map.provider.TileProvider.Options}
The options to instantiate this TileProvider
Property Details
requestTile: {}
Maps API for JavaScript Developer's Guide
► API Reference
Request data on a tile basis
cancelTile: {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey: {}
Cancels tile from being requested using a tile-key
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
getCache () : {H.util.ICache}
This method returns cache which should be used to store tiles
Returns:
{H.util.ICache}
cache
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
Parameters:
x:
{number}
The row number of the tile
y:
{number}
The column number of the tile
z:
{number}
The zoom level for which the tile is requested
488
Maps API for JavaScript Developer's Guide
► API Reference
onResponse:
489
{function((Array<H.map.Object> | HTMLImageElement | HTMLCanvasElement | null), *=)}
function which is called after response arrives
onError:
{function(string=)}
function which is called in case of communication error
Returns:
{H.util.ICancelable}
reload (hard)
This method instructs the provider to reload data from it's source.
Two reload modes are possible:
•
hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to
re-fetch the tiles. Currently cached tiles will not be used for rendering.
•
soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the
earliest convenience. The provider does not invalidate the cache immediately in this case. This
means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
hard:
{boolean}
a boolean flag indicating whether to invalidate in hard mode (true) or in
soft mode (false);
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
Parameters:
x:
{number}
x tile coordinate (row)
y:
{number}
y tile coordinate (column)
z:
{number}
tile coordinate (zoom)
Maps API for JavaScript Developer's Guide
► API Reference
490
data:
{(HTMLImageElement | HTMLCanvasElement)}
data for the tile
opt_options:
{Object<string, *>=} [optional]
free form options object. These options are meant to be used in tile specific
rendering cases
Returns:
{H.map.provider.Tile}
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates,
seperated by underscores e.g.: "4711_7_42_23"
Parameters:
x:
{number}
The x tile coordinate (row)
y:
{number}
The y tile coordinate (column)
z:
{number}
The z tile coordinate (zoom level)
Returns:
{string}
string
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
491
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
492
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Type definition: Options
This type definition is a member of the class
H.map.provider.RemoteTileProvider .
Type Definition Summary
Options which are used to initialize the RemoteTileProvider object.
[ For full details, see the Type Definition Details ]
Property Summary
Table 149: Properties
Properties
min
The minimal supported zoom level, default is 0
max
The max maximal supported zoom level, default is 22
Type Definition Description
Options which are used to initialize the RemoteTileProvider object.
Property Details
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The max maximal supported zoom level, default is 22
493
Maps API for JavaScript Developer's Guide
► API Reference
494
Class: Tile
This class is a member of the namespace
H.map.provider .
Class Summary
Generic Tile object which represents a part of the world fiting into the Tile area represented by the
Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles at particular zoom level
(which means number of areas into world is being splitted) is defined as following: numberOfRows =
numberOfColumns = 2^zoomlevel
[ For full details, see the Class Details ]
Property Summary
Table 150: Properties
Properties
key : {string}
Unique tile key generated by provider
data : {*}
Tile data (an image for example)
valid : {boolean}
This property holds a boolean flag indicating whether this tile is still valid (true) or whether it should be re-fetched (false)
x : {number}
Tile column
y : {number}
Tile row
z : {number}
Tile zoom level
Class Description
Generic Tile object which represents a part of the world fiting into the Tile area represented by the
Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles at particular zoom level
(which means number of areas into world is being splitted) is defined as following: numberOfRows =
numberOfColumns = 2^zoomlevel
Maps API for JavaScript Developer's Guide
► API Reference
495
Constructor Details
H.map.provider.Tile(x, y, z, data)
Parameters:
x:
{number}
x tile coordinate (row)
y:
{number}
y tile coordinate (column)
z:
{number}
tile zoom level
data:
{*}
generic data object which cooresponds to the given coordinates
Property Details
key: {string}
Unique tile key generated by provider
data: {*}
Tile data (an image for example)
valid: {boolean}
This property holds a boolean flag indicating whether this tile is still valid (true) or whether it should
be re-fetched (false)
x: {number}
Tile column
y: {number}
Tile row
z: {number}
Tile zoom level
Maps API for JavaScript Developer's Guide
► API Reference
Class: TileProvider
This class is a member of the namespace
H.map.provider .
Class Summary
Extends: H.map.provider.Provider
TileProvider is an abstract class to provide data on a tile basis
[ For full details, see the Class Details ]
Property Summary
Table 151: Properties
Properties
requestTile : {}
Request data on a tile basis
cancelTile : {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey : {}
Cancels tile from being requested using a tile-key
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
Method Summary
Table 152: Methods
Methods
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
496
Maps API for JavaScript Developer's Guide
► API Reference
497
Methods
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by
underscores e.g.: "4711_7_42_23"
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 153: Events
Events
update : {H.util.Event}
Fired when this provider's data updates
Class Description
TileProvider is an abstract class to provide data on a tile basis
Constructor Details
H.map.provider.TileProvider(options)
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
options:
{H.map.provider.TileProvider.Options}
The options to instantiate this TileProvider
Property Details
requestTile: {}
Request data on a tile basis
cancelTile: {}
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey: {}
Cancels tile from being requested using a tile-key
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Method Details
createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}
This method creates a tile object with given parameters
Parameters:
x:
{number}
x tile coordinate (row)
y:
{number}
y tile coordinate (column)
z:
{number}
tile coordinate (zoom)
498
Maps API for JavaScript Developer's Guide
► API Reference
499
data:
{(HTMLImageElement | HTMLCanvasElement)}
data for the tile
opt_options:
{Object<string, *>=} [optional]
free form options object. These options are meant to be used in tile specific
rendering cases
Returns:
{H.map.provider.Tile}
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates,
seperated by underscores e.g.: "4711_7_42_23"
Parameters:
x:
{number}
The x tile coordinate (row)
y:
{number}
The y tile coordinate (column)
z:
{number}
The z tile coordinate (zoom level)
Returns:
{string}
string
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property.
The default implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
Maps API for JavaScript Developer's Guide
► API Reference
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
500
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
501
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
502
{Object=} [optional]
Event Details
update: {H.util.Event}
Fired when this provider's data updates
Type definition: Options
This type definition is a member of the class
H.map.provider.TileProvider .
Type Definition Summary
Options which are used to initialize the TilePovider
[ For full details, see the Type Definition Details ]
Property Summary
Table 154: Properties
Properties
tileSize
The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256
min
The minimal supported zoom level, default is 0
max
The max maximal supported zoom level, default is 22
Type Definition Description
Options which are used to initialize the TilePovider
Property Details
tileSize: {number=} [optional]
The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is
256
Maps API for JavaScript Developer's Guide
► API Reference
503
min: {number=} [optional]
The minimal supported zoom level, default is 0
max: {number=} [optional]
The max maximal supported zoom level, default is 22
Namespace: render
Namespace Summary
Contains functionality for the map rendering
Namespace Description
Contains functionality for the map rendering
Class: RenderEngine
This class is a member of the namespace
H.map.render .
Class Summary
Extends: H.util.EventTarget
Abstract RenderEngine class. Render engines are used to render geographical position set on
the view model to the actual screen (viewport element). The rendered result may be different for
different engines, since every engine uses its onw capabilities and specific implementation to present
the current view model data in best possible way. In example for 2D engines user will se mostly 2
dimensional flat map presented by tiles, on the other hand 3D engines like panorama will display the
same coordinates as a 'street view'. In other words RenderEngine is responsible for managing the
rendering loop as well as for synchronizing rendered data with the view model and the data model. It
manages what and how gets rendered inside the current viewport.
[ For full details, see the Class Details ]
Method Summary
Table 155: Methods
Methods
onceEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
504
Methods
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 156: Events
Events
render : {H.util.Event}
Fired when one of the layers or the engine (all layers) has been rendered completely. The event target references either the
completed layer or the render engine itself
Class Description
Abstract RenderEngine class. Render engines are used to render geographical position set on
the view model to the actual screen (viewport element). The rendered result may be different for
different engines, since every engine uses its onw capabilities and specific implementation to present
the current view model data in best possible way. In example for 2D engines user will se mostly 2
dimensional flat map presented by tiles, on the other hand 3D engines like panorama will display the
same coordinates as a 'street view'. In other words RenderEngine is responsible for managing the
rendering loop as well as for synchronizing rendered data with the view model and the data model. It
manages what and how gets rendered inside the current viewport.
Constructor Details
H.map.render.RenderEngine(viewPort, viewModel, dataModel, options)
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
viewPort:
{H.map.ViewPort}
viewModel:
{H.map.ViewModel}
dataModel:
{H.map.DataModel}
options:
{H.map.render.RenderEngine.Options}
Method Details
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
505
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
506
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
callback:
{!Function}
507
opt_scope:
{Object=} [optional]
Event Details
render: {H.util.Event}
Fired when one of the layers or the engine (all layers) has been rendered completely. The event target
references either the completed layer or the render engine itself
Namespace: p2d
Namespace Summary
Contains functionality specific for 2-D map rendering
Namespace Description
Contains functionality specific for 2-D map rendering
Class: RenderEngine
This class is a member of the namespace
H.map.render.p2d .
Class Summary
Extends: H.map.render.RenderEngine
Canvas render engine implementation. This engine will present geo position (camera data)
provided by the view model on a 2D canvas element, were all layers are rendered into the single
canvas element in provided order. This class contains some additional canvas rendering specific
functionality, which can be used by the application.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
508
Method Summary
Table 157: Methods
Methods
setAnimationDuration (duration)
This method changes animation duration for all engine's animations
getAnimationDuration () : {number}
This method returns current animation duration setting for engine's animations
setAnimationEase (easeFunction)
This method allows to set ease for all engine's animations.
getAnimationEase () : {function(number) : number}
This method return current setting for the animation ease.
resetAnimationDefaults ()
This method resets animation settings on the engine to defaults. Duration 300ms and ease to
H.util.animation.ease.EASE_OUT_QUAD
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Maps API for JavaScript Developer's Guide
► API Reference
509
Events Summary
Table 158: Events
Events
render : {H.util.Event}
Fired when one of the layers or the engine (all layers) has been rendered completely. The event target references either the
completed layer or the render engine itself
Class Description
Canvas render engine implementation. This engine will present geo position (camera data)
provided by the view model on a 2D canvas element, were all layers are rendered into the single
canvas element in provided order. This class contains some additional canvas rendering specific
functionality, which can be used by the application.
Constructor Details
H.map.render.p2d.RenderEngine(viewPort, viewModel, dataModel, options)
Parameters:
viewPort:
{H.map.ViewPort}
viewModel:
{H.map.ViewModel}
dataModel:
{H.map.DataModel}
options:
{H.map.render.p2d.RenderEngine.Options}
Method Details
setAnimationDuration (duration)
This method changes animation duration for all engine's animations
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
duration:
510
{number}
getAnimationDuration () : {number}
This method returns current animation duration setting for engine's animations
Returns:
{number}
setAnimationEase (easeFunction)
This method allows to set ease for all engine's animations.
Parameters:
easeFunction:
{function(number) : number}
function which alters progress. Function will receive progress as parameter
which is a values between 0..1 and should return altered values also in 0..1
range.
getAnimationEase () : {function(number) : number}
This method return current setting for the animation ease.
Returns:
{function(number) : number}
resetAnimationDefaults ()
This method resets animation settings on the engine to defaults. Duration 300ms and ease to
H.util.animation.ease.EASE_OUT_QUAD
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
Maps API for JavaScript Developer's Guide
► API Reference
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
511
Maps API for JavaScript Developer's Guide
► API Reference
512
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
render: {H.util.Event}
Fired when one of the layers or the engine (all layers) has been rendered completely. The event target
references either the completed layer or the render engine itself
Type definition: Options
This type definition is a member of the class
H.map.render.p2d.RenderEngine .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
513
Property Summary
Table 159: Properties
Properties
renderBaseBackground
Object describes how many cached zoom levels should be used as a base map background while base map tiles are
pixelRatio
The pixelRatio to use for over-sampling in cases of high-resolution displays
enableSubpixelRendering
Type Definition Description
Property Details
renderBaseBackground: {Object=} [optional]
Object describes how many cached zoom levels should be used as a base map background while base
map tiles are
pixelRatio: {number}
The pixelRatio to use for over-sampling in cases of high-resolution displays
enableSubpixelRendering: {boolean=} [optional]
Namespace: canvas
Namespace Summary
Contains functionality for canvas based rendering
Namespace Description
Contains functionality for canvas based rendering
Namespace: panorama
Namespace Summary
Contains functionality specific to Panorama renderer
Maps API for JavaScript Developer's Guide
► API Reference
514
Namespace Description
Contains functionality specific to Panorama renderer
Class: RenderEngine
This class is a member of the namespace
H.map.render.panorama .
Class Summary
Extends: H.map.render.RenderEngine
Panorama rendering engine is responsible for presenting the geo position provided by the view model
as a 'street view'. In addition it provides extra functionality specific to 'street view'.
[ For full details, see the Class Details ]
Method Summary
Table 160: Methods
Methods
static
getClosestPanoramas (coord, callback)
Searches for the closest panoramas for given geo coordinate. You can call this method method multiple times without
waiting for the callback, but intermediate calls are implicitly cancelled and the callback gets 'undefined' as parameter.
static
getImageUrl (pano) : {string}
Method returns URL of the panoorama preview based on the provided panorama object.
static
configure (appId, appCode, useHTTPS)
Method implemnts H.platform.IConfigurable interface. Must be called before engine can be set on the map or any
method invoked.
getPanoramaId () : {string}
Method returns the id of the currently displayed panorama.
Class Description
Panorama rendering engine is responsible for presenting the geo position provided by the view model
as a 'street view'. In addition it provides extra functionality specific to 'street view'.
Maps API for JavaScript Developer's Guide
► API Reference
515
Constructor Details
H.map.render.panorama.RenderEngine(viewPort, viewModel, dataModel,
opt_options)
Parameters:
viewPort:
{H.map.ViewPort}
viewModel:
{H.map.ViewModel}
dataModel:
{H.map.DataModel}
opt_options:
{H.map.render.p2d.RenderEngine.Options=} [optional]
Method Details
static
getClosestPanoramas (coord, callback)
Searches for the closest panoramas for given geo coordinate. You can call this method method
multiple times without waiting for the callback, but intermediate calls are implicitly cancelled and the
callback gets 'undefined' as parameter.
Parameters:
coord:
{H.geo.IPoint}
callback:
{!
function(Array<H.map.render.panorama.RenderEngine.Panorama>)}
static
getImageUrl (pano) : {string}
Method returns URL of the panoorama preview based on the provided panorama object.
Parameters:
pano:
{!H.map.render.panorama.RenderEngine.Panorama}
Maps API for JavaScript Developer's Guide
► API Reference
516
Returns:
{string}
static
configure (appId, appCode, useHTTPS)
Method implemnts H.platform.IConfigurable interface. Must be called before engine can be
set on the map or any method invoked.
Parameters:
appId:
{string}
appCode:
{string}
useHTTPS:
{boolean}
getPanoramaId () : {string}
Method returns the id of the currently displayed panorama.
Returns:
{string}
panorama id or empty string if no panorama is not loaded
Type definition: Panorama
This type definition is a member of the class
H.map.render.panorama.RenderEngine .
Type Definition Summary
The type represents object that describes minimum set of data for panorama.
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
Property Summary
Table 161: Properties
Properties
id
unique panorama identifier
position
position of the given panorama
Type Definition Description
The type represents object that describes minimum set of data for panorama.
Property Details
id: {number}
unique panorama identifier
position: {position}
position of the given panorama
Namespace: mapevents
Namespace Summary
This namespace contains classes and all functionality related to map events and map behavior
Namespace Description
This namespace contains classes and all functionality related to map events and map behavior
Class: Behavior
This class is a member of the namespace
Class Summary
Extends: H.util.Disposable
H.mapevents .
517
Maps API for JavaScript Developer's Guide
► API Reference
518
Behavior class uses map events and adds behavior functionality to the map. This allows map panning
and zooming via using mouse wheel
[ For full details, see the Class Details ]
Property Summary
Table 162: Properties
Properties
static
DRAGGING : {number}
Map responds to user dragging via mouse or touch
static
WHEELZOOM : {number}
Map zooms in or out in respond to mouse wheel events
static
DBLTAPZOOM : {number}
Map zooms in or out in response to double click or double tap. For double tap if more that one touches are on the screen
map will zoom out.
Method Summary
Table 163: Methods
Methods
dispose ()
This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior
object will also be disposed (this function will be called) when attached H.mapevents.MapEvents object is dispose.
disable (opt_behavior)
This method disables the behavior functionality for the map
enable (opt_behavior)
This method re-enables the behavior functionality for the map.
isEnabled (behavior) : {boolean}
This method checks if certain functionality is enabled
Class Description
Behavior class uses map events and adds behavior functionality to the map. This allows map panning
and zooming via using mouse wheel
Maps API for JavaScript Developer's Guide
► API Reference
519
Example
//add map events functionality to the map
var mapEvents = new H.mapevents.MapEvents(mapInstance);
//add behavior to the map
var behavior = new H.mapevents.Behavior(mapEvents);
//from here map is pannable
Constructor Details
H.mapevents.Behavior(mapEvents, options)
Parameters:
mapEvents:
{H.mapevents.MapEvents}
previously initialized map events instance
options:
{H.mapevents.Behavior.Options}
additional options (i.e kinetics)
Property Details
static DRAGGING: {number}
Map responds to user dragging via mouse or touch
static WHEELZOOM: {number}
Map zooms in or out in respond to mouse wheel events
static DBLTAPZOOM: {number}
Map zooms in or out in response to double click or double tap. For double tap if more that one
touches are on the screen map will zoom out.
Method Details
dispose ()
This method destroys all map interaction handling. Should be used when the behavior functionality
is disposed. Behavior object will also be disposed (this function will be called) when attached
H.mapevents.MapEvents object is dispose.
disable (opt_behavior)
This method disables the behavior functionality for the map
Maps API for JavaScript Developer's Guide
► API Reference
520
Parameters:
opt_behavior:
{number=} [optional]
value from H.mapevents.Behavior.Behaviors which specifies particular behavior to be disabled. If no arguments passed it will disable all.
enable (opt_behavior)
This method re-enables the behavior functionality for the map.
Parameters:
opt_behavior:
{number=} [optional]
value from H.mapevents.Behavior.Behaviors which specifies particular behavior to be enabled. If no arguments passed it will enable all.
isEnabled (behavior) : {boolean}
This method checks if certain functionality is enabled
Parameters:
behavior:
{number}
value from H.mapevents.Behavior.Behaviors against which the check is being performed
Returns:
{boolean}
Type definition: Options
This type definition is a member of the class
H.mapevents.Behavior .
Type Definition Summary
Options which are used to initialize the Behavior class.
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
521
Property Summary
Table 164: Properties
Properties
kinetics
parameters for kinetic movement. If set to false will prevent default settings from being used.
enable
is a bitmask of H.mapevents.Behavior.Behaviors which can enable only certain functionalities (all are enabled by default)
Type Definition Description
Options which are used to initialize the Behavior class.
Property Details
kinetics: {H.util.kinetics.IKinetics=} [optional]
parameters for kinetic movement. If set to false will prevent default settings from being used.
enable: {number}
is a bitmask of H.mapevents.Behavior.Behaviors which can enable only certain functionalities (all are
enabled by default)
Class: ContextMenuEvent
This class is a member of the namespace
H.mapevents .
Class Summary
Extends: H.util.Event
ContextMenuEvent should be fired, when a user right-clicks or longpresses on a map object.
[ For full details, see the Class Details ]
Property Summary
Table 165: Properties
Properties
viewportX : {Array<H.util.ContextItem>}
Maps API for JavaScript Developer's Guide
► API Reference
522
Properties
Contains ContextItems, that will be used to create context menu entries. Should be filled by listeners of the "contextmenu"
event
viewportY : {number}
Map viewport y position
target : {(H.map.Object | H.Map)}
Target for the event
originalEvent : {Event}
Original event
currentTarget : {(H.map.Object | H.Map)}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 166: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class Description
ContextMenuEvent should be fired, when a user right-clicks or longpresses on a map object.
Constructor Details
H.mapevents.ContextMenuEvent(viewportX, viewportY, target, originalEvent)
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
viewportX:
{number}
The x coordinate on the viewport
viewportY:
{number}
The y coordinate on the viewport
target:
{(H.Map | H.map.Object)}
The event's target element
originalEvent:
{Event}
target of the event
523
Property Details
viewportX: {Array<H.util.ContextItem>}
Contains ContextItems, that will be used to create context menu entries. Should be filled by listeners
of the "contextmenu" event
viewportY: {number}
Map viewport y position
target: {(H.map.Object | H.Map)}
Target for the event
originalEvent: {Event}
Original event
currentTarget: {(H.map.Object | H.Map)}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
Maps API for JavaScript Developer's Guide
► API Reference
524
stopPropagation ()
Stops propagation for current event.
Class: Event
This class is a member of the namespace
H.mapevents .
Class Summary
Extends: H.util.Event
Custom map event. Contains list of pointers on the map, list of changed pointers and original event.
Inherits from H.util.Event.
[ For full details, see the Class Details ]
Property Summary
Table 167: Properties
Properties
pointers : {Array<H.mapevents.Pointer>}
Pointers which are currently on the screen
changedPointers : {Array<H.mapevents.Pointer>}
Pointers which has changed in course of event
targetPointers : {Array<H.mapevents.Pointer>}
Pointers which are on same target as the current pointer
currentPointer : {H.mapevents.Pointer}
Current pointer
originalEvent : {Event}
Original event fired by the browser
target : {(H.map.Object | H.Map)}
Object which triggered event. Can be the map object (i.e marker or polyline) or the map itself
currentTarget : {(H.map.Object | H.Map)}
Object which has listener attached
type : {string}
Maps API for JavaScript Developer's Guide
► API Reference
525
Properties
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 168: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class Description
Custom map event. Contains list of pointers on the map, list of changed pointers and original event.
Inherits from H.util.Event.
Constructor Details
H.mapevents.Event(type, pointers, changedPointers, targetPointers,
currentPointer, target, originalEvent)
Parameters:
type:
{string}
type of event
pointers:
{Array<H.mapevents.Pointer>}
pointers which are currently on the screen
changedPointers:
{Array<H.mapevents.Pointer>}
pointers which changed during event
targetPointers:
{Array<H.mapevents.Pointer>}
pointers on the event target
Maps API for JavaScript Developer's Guide
► API Reference
currentPointer:
{H.mapevents.Pointer}
pointer which triggered the event
target:
{(H.Map | H.map.Object)}
target map object which triggered event
originalEvent:
{Event}
original dom event
Property Details
pointers: {Array<H.mapevents.Pointer>}
Pointers which are currently on the screen
changedPointers: {Array<H.mapevents.Pointer>}
Pointers which has changed in course of event
targetPointers: {Array<H.mapevents.Pointer>}
Pointers which are on same target as the current pointer
currentPointer: {H.mapevents.Pointer}
Current pointer
originalEvent: {Event}
Original event fired by the browser
target: {(H.map.Object | H.Map)}
Object which triggered event. Can be the map object (i.e marker or polyline) or the map itself
currentTarget: {(H.map.Object | H.Map)}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
526
Maps API for JavaScript Developer's Guide
► API Reference
527
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class: MapEvents
This class is a member of the namespace
H.mapevents .
Class Summary
Extends: H.util.Disposable
MapEvents enable the events functionality on the map and on the map objects. By using this
extension it is possible to listen to events on map objects like markers, polylines, polygons, circles
and on the map object itself. Events are triggered depending on user interaction. Please check the
Events Summary section for the list of events fired by this class and by the map objects.
[ For full details, see the Class Details ]
Method Summary
Table 169: Methods
Methods
dispose ()
This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents
and map objects will not trigger any events. This object will be disposed automatically if the corresponding map object is
disposed.
getAttachedMap () : {H.Map}
This method returns map into which events are attached
Events Summary
Table 170: Events
Events
pointerdown : {H.mapevents.Event}
Maps API for JavaScript Developer's Guide
► API Reference
528
Events
Signifies this the pointer (mouse, pen, touch) has reached the map surface. It is equivalent to platform: mousedown,
touchstart, pointerdown.
pointerup : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has left the map surface. It is equivalent to platform's: mouseup, touchend,
pointerup.
pointermove : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) is moved over the surface. It is equivalent to platform's: mousemove,
touchmove, pointermove.
pointerenter : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has entered the object area. It is equivalent to platform's: mouseenter,
touchenter, pointerenter. Note: this events is not propagated to the mapEvents object if triggered by the map object (i.e
marker).
pointerleave : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has left the target object area. It is equivalent to platform's: mouseleave,
touchleave, pointerleave. Note: this events is not propagated to the mapEvents object if triggered by the map object (i.e
marker).
pointercancel : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has been cancelled by the browser. It equalivement to platform's: touchcancel,
pointercancel.
dragstart : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) started dragging the target. This event is only fired if the target object has
draggable property set to true.
drag : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) is dragging the target. This event is only fired if the target object has
draggable property set to true.
dragend : {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) stopped dragging the target. This event is only fired if the target object has
draggable property set to true.
tap : {H.mapevents.Event}
Signifies this the pointer (touch, pen, mouse) has touched the map (or object) surface for a moment.
dbltap : {H.mapevents.Event}
Signifies this the pointer (touch, pen) has touched the map (or object) surface twice in a row for a moment.
longpress : {H.mapevents.Event}
Maps API for JavaScript Developer's Guide
► API Reference
529
Events
This event is dispatched on pointer target after pointer down has occurred and no pointer up was triggered and pointer
stayed in place for a longer time.
contextmenu : {H.mapevents.ContextMenuEvent}
This event is dispatched on a target after right click on the desktop or a longpress on a touch device, but no other pointers
were pressed
contextmenuclose : {H.mapevents.Event}
This event is dispatched after "contextmenu" event, if there was any user interaction within the map's viewport (i.e.
"mousedown", "touchstart", "pointerdown" or "wheel").
Class Description
MapEvents enable the events functionality on the map and on the map objects. By using this
extension it is possible to listen to events on map objects like markers, polylines, polygons, circles
and on the map object itself. Events are triggered depending on user interaction. Please check the
Events Summary section for the list of events fired by this class and by the map objects.
Example
//prerequisites: mapInstance and marker is initialized
mapInstance.addObject(marker);
var mapevts = new H.mapevents.MapEvents(mapInstance);
//add listener to map
mapInstance.addEventListener('pointermove', function(e) {...});
//add listener to the marker
marker.addEventListener('pointerenter', function(e) {...});
marker.addEventListener('pointerleave', function(e) {...});
Constructor Details
H.mapevents.MapEvents(map)
Parameters:
map:
{H.Map}
map instance which is used for firing events
Method Details
dispose ()
Maps API for JavaScript Developer's Guide
► API Reference
530
This method destroys the MapEvents by removing all handlers from the map object. After calling
this function mapEvents and map objects will not trigger any events. This object will be disposed
automatically if the corresponding map object is disposed.
getAttachedMap () : {H.Map}
This method returns map into which events are attached
Returns:
{H.Map}
Event Details
pointerdown: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has reached the map surface. It is equivalent to
platform: mousedown, touchstart, pointerdown.
pointerup: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has left the map surface. It is equivalent to platform's:
mouseup, touchend, pointerup.
pointermove: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) is moved over the surface. It is equivalent to platform's:
mousemove, touchmove, pointermove.
pointerenter: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has entered the object area. It is equivalent to
platform's: mouseenter, touchenter, pointerenter. Note: this events is not propagated to the
mapEvents object if triggered by the map object (i.e marker).
pointerleave: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has left the target object area. It is equivalent to
platform's: mouseleave, touchleave, pointerleave. Note: this events is not propagated to the
mapEvents object if triggered by the map object (i.e marker).
pointercancel: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) has been cancelled by the browser. It equalivement to
platform's: touchcancel, pointercancel.
dragstart: {H.mapevents.Event}
Maps API for JavaScript Developer's Guide
► API Reference
531
Signifies this the pointer (mouse, pen, touch) started dragging the target. This event is only fired if
the target object has draggable property set to true.
drag: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) is dragging the target. This event is only fired if the
target object has draggable property set to true.
dragend: {H.mapevents.Event}
Signifies this the pointer (mouse, pen, touch) stopped dragging the target. This event is only fired if
the target object has draggable property set to true.
tap: {H.mapevents.Event}
Signifies this the pointer (touch, pen, mouse) has touched the map (or object) surface for a moment.
dbltap: {H.mapevents.Event}
Signifies this the pointer (touch, pen) has touched the map (or object) surface twice in a row for a
moment.
longpress: {H.mapevents.Event}
This event is dispatched on pointer target after pointer down has occurred and no pointer up was
triggered and pointer stayed in place for a longer time.
contextmenu: {H.mapevents.ContextMenuEvent}
This event is dispatched on a target after right click on the desktop or a longpress on a touch device,
but no other pointers were pressed
contextmenuclose: {H.mapevents.Event}
This event is dispatched after "contextmenu" event, if there was any user interaction within the
map's viewport (i.e. "mousedown", "touchstart", "pointerdown" or "wheel").
Context menu ui component should stop propagation of aforementioned events within itself, to
prevent firing of "contextmenuclose" while user interacts with the context menu.
Class: Pointer
This class is a member of the namespace
H.mapevents .
Class Summary
Class representing pointer on the map surface. A pointer in platform specific definition would mean
either mouse, touch, pen or any pointing device which can trigger browser events.
Maps API for JavaScript Developer's Guide
► API Reference
532
[ For full details, see the Class Details ]
Property Summary
Table 171: Properties
Properties
static
viewportX : {number}
X coordinate on the map's viewport
static
viewportY : {number}
Y coordinate on the map's viewport
static
target : {(H.map.Object | H.Map)}
Map object directly under the pointer. Can be null if if pointer is out of the map viewport
static
id : {number}
Pointer unique identifier.
static
type : {string}
Pointer type can be: 'mouse', 'touch' or 'pen'
static
dragTarget : {(H.map.Object | H.Map)}
Object which is currently dragged by the pointer
static
button : {H.mapevents.Pointer.Button}
Indicates which pointer device button has changed.
Class Description
Class representing pointer on the map surface. A pointer in platform specific definition would mean
either mouse, touch, pen or any pointing device which can trigger browser events.
Constructor Details
H.mapevents.Pointer(viewportX, viewportY, id, type, opt_button, opt_buttons)
Parameters:
viewportX:
{number}
pointer position on x-axis
viewportY:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
533
pointer position on y-axis
id:
{number}
unique pointer identifier among currently available pointers
type:
{string}
type of pointer can be i.e 'mouse', 'touch'. 'pen'
opt_button:
{H.mapevents.Pointer.Button=} [optional]
Indicates which pointer device button has changed.
opt_buttons:
{number=} [optional]
Indicates which pointer device buttons are being pressed, expressed as a
bitmask. Uses the same values, as "buttons" in Pointer Events spec.
Property Details
static viewportX: {number}
X coordinate on the map's viewport
static viewportY: {number}
Y coordinate on the map's viewport
static target: {(H.map.Object | H.Map)}
Map object directly under the pointer. Can be null if if pointer is out of the map viewport
static id: {number}
Pointer unique identifier.
static type: {string}
Pointer type can be: 'mouse', 'touch' or 'pen'
static dragTarget: {(H.map.Object | H.Map)}
Object which is currently dragged by the pointer
static button: {H.mapevents.Pointer.Button}
Indicates which pointer device button has changed.
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration: Button
This enumeration is a member of the class
H.mapevents.Pointer .
Enumeration Summary
Types of a button
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 172: Constants
Constants
static
NONE
No button
static
LEFT
Left mouse button or touch contact or pen contact
static
MIDDLE
Middle mouse button
static
RIGHT
Right mouse button or Pen barrel button
Enumeration Details
Types of a button
Enumeration Constants Details
static NONE
No button
static LEFT
Left mouse button or touch contact or pen contact
static MIDDLE
Middle mouse button
534
Maps API for JavaScript Developer's Guide
► API Reference
535
static RIGHT
Right mouse button or Pen barrel button
Type definition: Buttons
This type definition is a member of the class
H.mapevents.Pointer .
Type Definition Summary
Indicates which pointer device buttons are being pressed, expressed as a bitmask. Bit values are:
[ For full details, see the Type Definition Details ]
Type Definition Description
Indicates which pointer device buttons are being pressed, expressed as a bitmask. Bit values are:
•
•
•
•
0: No button pressed
1: Left mouse button pressed, or Touch contact or Pen contact
2: Right mouse button pressed, or Pen contact with barrel button pressed
4: Middle mouse button pressed
Class: WheelEvent
This class is a member of the namespace
H.mapevents .
Class Summary
Extends: H.util.Event
WheelEvent is fired when the mouse wheel is used over the map. It contains information about cursor
position and the map object which resides directly under the cursor.
[ For full details, see the Class Details ]
Property Summary
Table 173: Properties
Properties
delta : {number}
Wheel move delta
Maps API for JavaScript Developer's Guide
► API Reference
536
Properties
viewportX : {number}
Map viewport x position
viewportY : {number}
Map viewport y position
target : {(H.map.Object | H.Map)}
Target for the event
originalEvent : {Event}
Original mouse wheel event
currentTarget : {(H.map.Object | H.Map)}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 174: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class Description
WheelEvent is fired when the mouse wheel is used over the map. It contains information about cursor
position and the map object which resides directly under the cursor.
Constructor Details
H.mapevents.WheelEvent(deltaY, viewportX, viewportY, target, originalEvent)
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
deltaY:
{number}
The wheel move delta on y-axis
viewportX:
{number}
The x coordinate on the viewport
viewportY:
{number}
The y coordinate on the viewport
target:
{(H.Map | H.map.Object)}
The event's target element
originalEvent:
{Event}
target of the event
Property Details
delta: {number}
Wheel move delta
viewportX: {number}
Map viewport x position
viewportY: {number}
Map viewport y position
target: {(H.map.Object | H.Map)}
Target for the event
originalEvent: {Event}
Original mouse wheel event
currentTarget: {(H.map.Object | H.Map)}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
537
Maps API for JavaScript Developer's Guide
► API Reference
538
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Namespace: math
Namespace Summary
This namespace contains mathematical constants, aliased Math functions and math helper functions.
Namespace Description
This namespace contains mathematical constants, aliased Math functions and math helper functions.
Type definition: BitMask
This type definition is a member of the namespace
H.math .
Type Definition Summary
A signed 32 bit integer (JS restriction) where bit operator can be applied to. The range is
[-2,147,483,648 ... 2,147,483,647] or [-2^31 ... 2^31 − 1]
[ For full details, see the Type Definition Details ]
Type Definition Description
A signed 32 bit integer (JS restriction) where bit operator can be applied to. The range is
[-2,147,483,648 ... 2,147,483,647] or [-2^31 ... 2^31 − 1]
Interface: IPoint
This interface is a member of the namespace
H.math .
Maps API for JavaScript Developer's Guide
► API Reference
Interface Summary
An interface for a 2-dimensional point consisting a x and y coordinate.
[ For full details, see the Interface Details ]
Property Summary
Table 175: Properties
Properties
x : {number}
The point's coordinate on X-axis.
y : {number}
The point's coordinate on Y-axis.
Interface Description
An interface for a 2-dimensional point consisting a x and y coordinate.
Property Details
x: {number}
The point's coordinate on X-axis.
y: {number}
The point's coordinate on Y-axis.
Interface: ISize
This interface is a member of the namespace
H.math .
Interface Summary
An interface for a 2-dimensional size consisting a with and a height.
[ For full details, see the Interface Details ]
539
Maps API for JavaScript Developer's Guide
► API Reference
Property Summary
Table 176: Properties
Properties
w : {number}
The size's width.
h : {number}
The size's height.
Interface Description
An interface for a 2-dimensional size consisting a with and a height.
Property Details
w: {number}
The size's width.
h: {number}
The size's height.
Class: Point
This class is a member of the namespace
H.math .
Class Summary
Implements: H.math.IPoint
Class represents a 2-dimensional point, defined by x and y coordinates.
[ For full details, see the Class Details ]
Property Summary
Table 177: Properties
Properties
x : {number}
540
Maps API for JavaScript Developer's Guide
► API Reference
Properties
The point's coordinate on X-axis.
y : {number}
The point's coordinate on Y-axis.
Method Summary
Table 178: Methods
Methods
set (x, y)
Sets the x and y coordinate of this point
clone (opt_out) : {H.math.Point}
This method creates a copy of the current point.
add (other) : {H.math.Point}
This method adds given point coordinates to the current one.
sub (other) : {H.math.Point}
This method substract given point coordinates from the current point.
scale (factor, opt_factorY) : {H.math.Point}
This method scales the current point coordinates by the given factor(s).
round () : {H.math.Point}
This method rounds the x and y coordinates of the point.
floor () : {H.math.Point}
Rounds the x and y coordinates to the next smaller integer values.
ceil () : {H.math.Point}
Rounds the x and y coordinates to the next greater integer values.
equals (other) : {boolean}
This method compares current point coordinates with the supplied point coordinates.
getNearest (start, end) : {H.math.IPoint}
Calculates the closest point on a given line
distance (other) : {number}
This method calculates the distance to a point supplied by the caller.
541
Maps API for JavaScript Developer's Guide
► API Reference
Class Description
Class represents a 2-dimensional point, defined by x and y coordinates.
Constructor Details
H.math.Point(x, y)
Parameters:
x:
{number}
coordinate on x-axis
y:
{number}
coordinate on y-axis
Property Details
x: {number}
The point's coordinate on X-axis.
y: {number}
The point's coordinate on Y-axis.
Method Details
set (x, y)
Sets the x and y coordinate of this point
Parameters:
x:
{number}
coordinate on x-axis
y:
{number}
coordinate on y-axis
clone (opt_out) : {H.math.Point}
This method creates a copy of the current point.
Parameters:
542
Maps API for JavaScript Developer's Guide
► API Reference
opt_out:
{H.math.Point=} [optional]
An optional point to store the copied values
Returns:
{H.math.Point}
The clone of the point
add (other) : {H.math.Point}
This method adds given point coordinates to the current one.
Parameters:
other:
{H.math.IPoint}
The point to add
Returns:
{H.math.Point}
the point itself after adding
sub (other) : {H.math.Point}
This method substract given point coordinates from the current point.
Parameters:
other:
{H.math.IPoint}
The point to subtract
Returns:
{H.math.Point}
the point itself after substracting
scale (factor, opt_factorY) : {H.math.Point}
This method scales the current point coordinates by the given factor(s).
Parameters:
factor:
{number}
543
Maps API for JavaScript Developer's Guide
► API Reference
multiplication factor
opt_factorY:
{number=} [optional]
If omitted, the factor argument is used
Returns:
{H.math.Point}
the point itself after scaling
round () : {H.math.Point}
This method rounds the x and y coordinates of the point.
Returns:
{H.math.Point}
the point itself after rounding
floor () : {H.math.Point}
Rounds the x and y coordinates to the next smaller integer values.
Returns:
{H.math.Point}
the point itself after flooring
ceil () : {H.math.Point}
Rounds the x and y coordinates to the next greater integer values.
Returns:
{H.math.Point}
the point itself after ceiling
equals (other) : {boolean}
This method compares current point coordinates with the supplied point coordinates.
Parameters:
other:
{H.math.IPoint}
The point to compare to.
544
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{boolean}
True if the points are equal
getNearest (start, end) : {H.math.IPoint}
Calculates the closest point on a given line
Parameters:
start:
{H.math.IPoint}
The start point of the line
end:
{H.math.IPoint}
The end point of the line
Returns:
{H.math.IPoint}
the closest point
distance (other) : {number}
This method calculates the distance to a point supplied by the caller.
Parameters:
other:
{H.math.IPoint}
Returns:
{number}
Class: Rect
This class is a member of the namespace
H.math .
545
Maps API for JavaScript Developer's Guide
► API Reference
Class Summary
Class defines a rectangle in 2-dimensional geometric space. It is used to represent the area in
projected space.
[ For full details, see the Class Details ]
Method Summary
Table 179: Methods
Methods
set (left, top, right, bottom)
To set all values of the rectangle's edges
getTopLeft () : {H.math.Point}
To get the rectangle's top-left vertex
getBottomRight () : {H.math.Point}
To get the rectangle's bottom-right vertex
containsXY (x, y) : {boolean}
Method checks if provided coordinates lie within rectangle.
static
fromPoints (topLeft, bottomRight) : {H.math.Rect}
To create a rectangle from a top-left and bottom-right point pair.
clone () : {H.math.Rect}
To clone a rectangle
Class Description
Class defines a rectangle in 2-dimensional geometric space. It is used to represent the area in
projected space.
Constructor Details
H.math.Rect(left, top, right, bottom)
Parameters:
left:
{number}
The rectangle's left edge x value
546
Maps API for JavaScript Developer's Guide
► API Reference
top:
{number}
The rectangle's top edge y value
right:
{number}
The rectangle's right edge x value
bottom:
{number}
The rectangle's bottom edge y value
Method Details
set (left, top, right, bottom)
To set all values of the rectangle's edges
Parameters:
left:
{number}
The rectangle's left edge x value
top:
{number}
The rectangle's top edge y value
right:
{number}
The rectangle's right edge x value
bottom:
{number}
The rectangle's bottom edge y value
getTopLeft () : {H.math.Point}
To get the rectangle's top-left vertex
Returns:
{H.math.Point}
getBottomRight () : {H.math.Point}
To get the rectangle's bottom-right vertex
Returns:
547
Maps API for JavaScript Developer's Guide
► API Reference
548
{H.math.Point}
containsXY (x, y) : {boolean}
Method checks if provided coordinates lie within rectangle.
Parameters:
x:
{number}
x-coordinate to check
y:
{number}
y-coordinate to check
Returns:
{boolean}
returns true if coordinates lie within rectangle, if parameters are isNaN returns false
static
fromPoints (topLeft, bottomRight) : {H.math.Rect}
To create a rectangle from a top-left and bottom-right point pair.
Parameters:
topLeft:
{H.math.IPoint}
the top-left vertex of the rectanle
bottomRight:
{H.math.IPoint}
the bottom-right vertex of the rectanle
Returns:
{H.math.Rect}
returns the rectangular area defined by the top-left and bottom-right vertices
clone () : {H.math.Rect}
To clone a rectangle
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.math.Rect}
Class: Size
This class is a member of the namespace
H.math .
Class Summary
Implements: H.math.ISize
Class for representing sizes consisting of a width and height.
[ For full details, see the Class Details ]
Property Summary
Table 180: Properties
Properties
w : {number}
The size's width value
h : {number}
The size's height value
Class Description
Class for representing sizes consisting of a width and height.
Constructor Details
H.math.Size(width, height)
Parameters:
width:
{number}
Width.
height:
{number}
Height.
549
Maps API for JavaScript Developer's Guide
► API Reference
550
Property Details
w: {number}
The size's width value
h: {number}
The size's height value
Namespace: places
Namespace Summary
H.places is a thin javascript layer wrapper around The HERE Places API. The HERE Places API is a web
service that allows your applications to use the HERE Places information and search facilities.
Namespace Description
H.places is a thin javascript layer wrapper around The HERE Places API. The HERE Places API is a web
service that allows your applications to use the HERE Places information and search facilities.
This library is built as a wish to help developers start using Places API more easily. The Places API
is a REST API that serves hyper-media responses. Some functionality can be accessed through
entrypoints that can be called directly, while other functionality is accessed by following links in the
responses of previous calls. Library tries to simplify this by adding Endpoint abstraction for different
kind of requests and by decorating response with helper functions.
This document list all of possible entrypoints and operation available in the library. For tutorial how
to use Places API in general head to playground. More detailed Places API documentation is also
available.
Class: Around
This class is a member of the namespace
H.places .
Class Summary
The Around endpoint represents sets of places within a specific location context, usually the location
of the user. This endpoint is intended for applications that employ features such as augmented
reality, where places around the user's location are displayed on a device. It is intended to provide
places that are likely to be visible to the user as well as important places that are further away. For
more visit Places API documentation
Maps API for JavaScript Developer's Guide
► API Reference
551
[ For full details, see the Class Details ]
Method Summary
Table 181: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
The Around endpoint represents sets of places within a specific location context, usually the location
of the user. This endpoint is intended for applications that employ features such as augmented
reality, where places around the user's location are displayed on a device. It is intended to provide
places that are likely to be visible to the user as well as important places that are further away. For
more visit Places API documentation
Constructor Details
H.places.Around(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
Maps API for JavaScript Developer's Guide
► API Reference
552
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Class: Categories
This class is a member of the namespace
H.places .
Class Summary
Categories endpoint is used to obtain the place categories available for a given location. The Place
Categories endpoint represents sets of locally relevant categories that are organized in a directed
acyclic graph. The category graph may change in the future and may differ depending on the location
of the request. For more visti Places API documentation
[ For full details, see the Class Details ]
Method Summary
Table 182: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
Categories endpoint is used to obtain the place categories available for a given location. The Place
Categories endpoint represents sets of locally relevant categories that are organized in a directed
acyclic graph. The category graph may change in the future and may differ depending on the location
of the request. For more visti Places API documentation
Constructor Details
H.places.Categories(service)
Parameters:
service:
{H.service.PlacesService}
Maps API for JavaScript Developer's Guide
► API Reference
553
Method Details
request (params, headers, onResult, onError)
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Class: Explore
This class is a member of the namespace
H.places .
Class Summary
The Explore endpoint retrieves a list of relevant places nearby a given position or area. It answers the
question "What interesting places are in the viewport of the map?" The results presented to the user
are confined to those located in the current map view or search area and are ordered by popularity.
For more visit Places API documentation
[ For full details, see the Class Details ]
Method Summary
Table 183: Methods
Methods
request (params, headers, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
554
Methods
Executes request to endpoint.
Class Description
The Explore endpoint retrieves a list of relevant places nearby a given position or area. It answers the
question "What interesting places are in the viewport of the map?" The results presented to the user
are confined to those located in the current map view or search area and are ordered by popularity.
For more visit Places API documentation
Constructor Details
H.places.Explore(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Maps API for JavaScript Developer's Guide
► API Reference
555
Class: Here
This class is a member of the namespace
H.places .
Class Summary
The Here endpoint answers the questions "Where am I?" and "What's right here where I am
standing?" The search results consist of a list of places with addresses that lie within the vicinity of
the search location. The feature is typically used by applications that include "check-in" or "click on
map to get more information" options. For more visit Places API documentation
[ For full details, see the Class Details ]
Method Summary
Table 184: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
The Here endpoint answers the questions "Where am I?" and "What's right here where I am
standing?" The search results consist of a list of places with addresses that lie within the vicinity of
the search location. The feature is typically used by applications that include "check-in" or "click on
map to get more information" options. For more visit Places API documentation
Constructor Details
H.places.Here(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
556
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Class: Lookup
This class is a member of the namespace
H.places .
Class Summary
Lookup Endpoint provides ability to find a place by its foreign ID. For more visti Places API
Documentation
[ For full details, see the Class Details ]
Method Summary
Table 185: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
Lookup Endpoint provides ability to find a place by its foreign ID. For more visti Places API
Documentation
Maps API for JavaScript Developer's Guide
► API Reference
557
Constructor Details
H.places.Lookup(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Class: Search
This class is a member of the namespace
H.places .
Class Summary
The Search endpoint processes text string queries based on the user's input to find specific places.
It answers questions of "what" and "where" for an online search of POI or address. For more visit
Places API documentation
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
558
Method Summary
Table 186: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
The Search endpoint processes text string queries based on the user's input to find specific places.
It answers questions of "what" and "where" for an online search of POI or address. For more visit
Places API documentation
Constructor Details
H.places.Search(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
Maps API for JavaScript Developer's Guide
► API Reference
559
callback gets triggered in case of network errors or in case of invalid request
Class: Suggest
This class is a member of the namespace
H.places .
Class Summary
The Search Suggestions endpoint represents lists of suggested search terms related to a given
(partial) search term and location context. This endpoint is used to help users to provide suggested
search terms to the user while typing. For more visti Places API Documentation
[ For full details, see the Class Details ]
Method Summary
Table 187: Methods
Methods
request (params, headers, onResult, onError)
Executes request to endpoint.
Class Description
The Search Suggestions endpoint represents lists of suggested search terms related to a given
(partial) search term and location context. This endpoint is used to help users to provide suggested
search terms to the user while typing. For more visti Places API Documentation
Constructor Details
H.places.Suggest(service)
Parameters:
service:
{H.service.PlacesService}
Method Details
request (params, headers, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
560
Executes request to endpoint.
Parameters:
params:
{H.service.ServiceParameters}
encapsulates URL parameters to be sent to endpoint.
headers:
{Object}
required by the endpoint
onResult:
{Function}
callback that gets triggered with the full response of the request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Namespace: model
Namespace Summary
Namespace Description
Class: GetLink
This class is a member of the namespace
H.places.model .
Class Summary
GetLink - is abstraction that wraps passed object and creates method for executing GET requests
against href value of the object.
[ For full details, see the Class Details ]
Method Summary
Table 188: Methods
Methods
follow (onResult, onError, queryParams)
Maps API for JavaScript Developer's Guide
► API Reference
561
Methods
Follows available href by executing ajax get request against it.
Class Description
GetLink - is abstraction that wraps passed object and creates method for executing GET requests
against href value of the object.
Our responses from the server are processed in the way that every object that contains href property
is wrapped in GetLink in case it href points to GET endpoint.
Constructor Details
H.places.model.GetLink(obj, service)
Parameters:
obj:
{Object}
that we are wrapping into GetLink instance. Should contain href property
service:
{H.service.PlacesService}
Method Details
follow (onResult, onError, queryParams)
Follows available href by executing ajax get request against it.
Parameters:
onResult:
{Function}
gets called when result of follow request gets completed
onError:
{Function}
gets called if something goes wrong when trying to follow link
queryParams:
{Object}
contains additional query params that should be passed when following link.
Maps API for JavaScript Developer's Guide
► API Reference
562
Class: PostLink
This class is a member of the namespace
H.places.model .
Class Summary
PostLink - is abstraction that wraps passed object and creates method for executing POST request
against href value of the object.
[ For full details, see the Class Details ]
Method Summary
Table 189: Methods
Methods
post (body, onResult, onError, queryParams)
Executes post ajax request against object's href property with data as a body
Class Description
PostLink - is abstraction that wraps passed object and creates method for executing POST request
against href value of the object.
Our responses from the server are processed in the way that every object that contains href property
is wrapped in PostLink in case it href points to POST endpoint.
Constructor Details
H.places.model.PostLink(obj)
Parameters:
obj:
{Object}
Method Details
post (body, onResult, onError, queryParams)
Executes post ajax request against object's href property with data as a body
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
body:
{Object}
of the POST request
onResult:
{Function}
gets called when result of post request gets completed
onError:
{Function}
gets called if something goes wrong when trying to post
queryParams:
{Object}
contains additional query params that should be passed when posting
563
Class: ResultSet
This class is a member of the namespace
H.places.model .
Class Summary
ResultSet - wraps the Discover Result Set and adds auxiliary functions. For more information about
Discover Result Set visit our Places API documentation
[ For full details, see the Class Details ]
Method Summary
Table 190: Methods
Methods
fetchNext (onResult, onError)
Function that follow next link. In case of large collections, next link leads to the next page of the collection. Presence of this
function depends if the next parameter on resultSet exist.
fetchPrevious (onResult, onError)
Function that follow previous link. In case of large collections, previous link leads to the previous page of the collection.
Presence of this function depends if the previous parameter on resultSet exist.
Maps API for JavaScript Developer's Guide
► API Reference
564
Class Description
ResultSet - wraps the Discover Result Set and adds auxiliary functions. For more information about
Discover Result Set visit our Places API documentation
Constructor Details
H.places.model.ResultSet(resultSet, service)
Parameters:
resultSet:
{Object}
service:
{H.service.PlacesService}
Method Details
fetchNext (onResult, onError)
Function that follow next link. In case of large collections, next link leads to the next page of the
collection. Presence of this function depends if the next parameter on resultSet exist.
Follow next link is a Ajax GET request.
Parameters:
onResult:
{Function}
callback that gets triggered with the full response of the next request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
fetchPrevious (onResult, onError)
Function that follow previous link. In case of large collections, previous link leads to the previous page
of the collection. Presence of this function depends if the previous parameter on resultSet exist.
Follow previous link is a Ajax GET request.
Parameters:
onResult:
{Function}
Maps API for JavaScript Developer's Guide
► API Reference
565
callback that gets triggered with the full response of the next request.
onError:
{Function}
callback gets triggered in case of network errors or in case of invalid request
Namespace: service
Namespace Summary
This namespace contains classes and interfaces related to the HERE REST APIs.
Namespace Description
This namespace contains classes and interfaces related to the HERE REST APIs.
In particular this namespace contains implementations of service stubs and helper functionality to
integrate the HERE Maps for JavaScript API with the following backend services:
•
•
•
•
•
•
HERE Map Tile API
HERE Geododer API
HERE Routing API
HERE Enterprise Routing API
HERE Traffic API
HERE Places API
Class: AbstractRestService
This class is a member of the namespace
Class Summary
Implements: H.service.IConfigurable
Abstract rest service class
[ For full details, see the Class Details ]
H.service .
Maps API for JavaScript Developer's Guide
► API Reference
566
Method Summary
Table 191: Methods
Methods
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Class Description
Abstract rest service class
Constructor Details
H.service.AbstractRestService(opt_options)
Parameters:
opt_options:
{H.service.AbstractRestService.Options=} [optional]
Method Details
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Maps API for JavaScript Developer's Guide
► API Reference
567
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Class: EnterpriseRoutingService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.service.AbstractRestService
This class encapsulates Enterprise Routing REST API as a service stub. An instance
of this class can be retrieved by calling the factory method on a platform instance.
H.service.Platform#getEnterpriseRoutingService.
[ For full details, see the Class Details ]
Method Summary
Table 192: Methods
Methods
calculateRoute (calculateRouteParams, onResult, onError)
This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once
the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occurred.
getRoute (getRouteParams, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
568
Methods
This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the
service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occurred.
getLinkInfo (getLinkInfoParams, onResult, onError)
This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once
the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occured.
calculateIsoline (calculateIsolineParams, onResult, onError)
This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function
once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a
communication error occurred.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Class Description
This class encapsulates Enterprise Routing REST API as a service stub. An instance
of this class can be retrieved by calling the factory method on a platform instance.
H.service.Platform#getEnterpriseRoutingService.
Example
// assuming that platform was already instantiated
router = platform.getEnterpriseRoutingService();
var calculateIsoline = {
'start': 'geo!52.5,13.4',
'distance': '1000,2000',
'mode': 'fastest;car;traffic:disabled'
},
onResult = function(result) {
console.log(result.response.isolines[0]);
},
onError = function(error) {
console.log(error);
};
router.calculateIsoline(calculateIsoline, onResult, onError);
Constructor Details
H.service.EnterpriseRoutingService(opt_options)
Maps API for JavaScript Developer's Guide
► API Reference
569
Parameters:
opt_options:
{H.service.EnterpriseRoutingService.Options=} [optional]
Method Details
calculateRoute (calculateRouteParams, onResult, onError)
This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult
callback function once the service response was received - providing a H.service.ServiceResult object
- or the onError callback if a communication error occurred.
Please refer to the Routing REST API documentation for information on available parameters and the
response object structure.
Parameters:
calculateR-
{H.service.ServiceParameters}
outeParams:
the service parameters to be sent with the routing request.
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Enterprise Routing REST API provides a
response to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
getRoute (getRouteParams, onResult, onError)
This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult
callback function once the service response was received - providing a H.service.ServiceResult object
- or the onError callback if a communication error occurred.
Please refer to the Routing REST API documentation for information on available parameters and the
response object structure.
Parameters:
getRouteParams:
{H.service.ServiceParameters}
Maps API for JavaScript Developer's Guide
► API Reference
570
the service parameters to be sent with the routing request.
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Enterprise Routing REST API provides a
response to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
getLinkInfo (getLinkInfoParams, onResult, onError)
This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult
callback function once the service response was received - providing a H.service.ServiceResult object
- or the onError callback if a communication error occured.
Please refer to the Routing REST API documentation for information on available parameters and the
response object structure.
Parameters:
getLinkIn-
{H.service.ServiceParameters}
foParams:
the service parameters to be sent with the routing request.
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Enterprise Routing REST API provides a
response to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
calculateIsoline (calculateIsolineParams, onResult, onError)
This method sends a "calculateisoline" request to Enterprise Routing REST API and calls
the onResult callback function once the service response was received - providing a
H.service.ServiceResult object - or the onError callback if a communication error occurred.
Please refer to the Routing REST API documentation for information on available parameters and the
response object structure.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
calculateIso-
571
{H.service.ServiceParameters}
lineParams:
the service parameters to be sent with the routing request.
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Enterprise Routing REST API provides a
response to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
572
{H.service.IConfigurable}
Type definition: Options
This type definition is a member of the class
H.service.EnterpriseRoutingService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 193: Properties
Properties
subDomain
The sub-domain of the routing service relative to the platform's base URL (default is 'route')
path
The path of the map tile service, default is "routing/7.2"
baseUrl
The base URL of the service, defaults to the the platform's base URL if instance was created using
H.service.Platform#getEnterpriseRoutingService method.
Type Definition Description
Property Details
subDomain: {string=} [optional]
The sub-domain of the routing service relative to the platform's base URL (default is 'route')
path: {string=} [optional]
The path of the map tile service, default is "routing/7.2"
baseUrl: {H.service.Url=} [optional]
The base URL of the service, defaults to the the platform's base URL if instance was created using
H.service.Platform#getEnterpriseRoutingService method.
Maps API for JavaScript Developer's Guide
► API Reference
573
Class: GeocodingService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.service.AbstractRestService
This class encapsulates the Geocoding REST API in a service stub with calls to its various resources
implemented.
[ For full details, see the Class Details ]
Method Summary
Table 194: Methods
Methods
geocode (geoodingParams, onResult, onError) : {H.service.JsonpRequestHandle}
This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the
service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occured.
reverseGeocode (reverseGeocodingParams, onResult, onError) : {H.service.JsonpRequestHandle}
This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the
service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occured.
search (searchParams, onResult, onError) : {H.service.JsonpRequestHandle}
This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the
service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication
error occured.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Class Description
This class encapsulates the Geocoding REST API in a service stub with calls to its various resources
implemented.
Maps API for JavaScript Developer's Guide
► API Reference
574
An instance of this class can be retrieved by calling the factory method on a platform instance.
H.service.Platform#getGeocodingService.
Example
// assuming that platform was already instantiated
geocoder = platform.getGeocodingService();
var geocodingParams = {
searchText: '425 W Randolph Street, Chicago'
},
onResult = function(result) {
console.log(result.view[0].result[0].displayPosition);
},
onError = function(error) {
console.log(error);
};
geocoder.geocode(geocodingParams, onResult, onError);
Constructor Details
H.service.GeocodingService(opt_options)
Parameters:
opt_options:
{H.service.GeocodingService.Options=} [optional]
Method Details
geocode (geoodingParams, onResult, onError) : {H.service.JsonpRequestHandle}
This method sends a reverse geocoding request to Geocoder REST API and calls the onResult
callback function once the service response was received - providing a H.service.ServiceResult object
- or the onError callback if a communication error occured.
Please refer to the Geocoder REST API documentation for information on available parameters and
the response object structure.
Parameters:
geoodingParams:
{H.service.ServiceParameters}
the service parameters to be sent with the geocoding request.
onResult:
{function(H.service.ServiceResult)}
Maps API for JavaScript Developer's Guide
► API Reference
575
this function will be called once the Geocoder REST API provides a response
to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
Returns:
{H.service.JsonpRequestHandle}
reverseGeocode (reverseGeocodingParams, onResult, onError) :
{H.service.JsonpRequestHandle}
This method sends a reverse geocoding request to Geocoder REST API and calls the onResult
callback function once the service response was received - providing a H.service.ServiceResult object
- or the onError callback if a communication error occured.
Please refer to the Geocoder REST API documentation for information on available parameters and
the response object structure.
Parameters:
reverseGeocod-
{H.service.ServiceParameters}
ingParams:
the service parameters to be sent with the reverse geocoding request
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Geocoder REST API provides a response
to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
Returns:
{H.service.JsonpRequestHandle}
search (searchParams, onResult, onError) : {H.service.JsonpRequestHandle}
Maps API for JavaScript Developer's Guide
► API Reference
576
This method sends a landmark search request to Geocoder REST API and calls the onResult callback
function once the service response was received - providing a H.service.ServiceResult object - or the
onError callback if a communication error occured.
Please refer to the Geocoder REST API documentation for information on available parameters and
the response object structure.
Parameters:
searchParams:
{H.service.ServiceParameters}
the service parameters to be sent with the reverse geocoding request
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Geocoder REST API provides a response
to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
Returns:
{H.service.JsonpRequestHandle}
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
Maps API for JavaScript Developer's Guide
► API Reference
577
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Type definition: Options
This type definition is a member of the class
H.service.GeocodingService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 195: Properties
Properties
subDomain
the sub-domain of the geo-coding service relative to the platform's base URL, default is 'geocoder'
path
the path of the Geocoding service, default is '6.2'
Type Definition Description
Property Details
subDomain: {string=} [optional]
the sub-domain of the geo-coding service relative to the platform's base URL, default is
'geocoder'
Maps API for JavaScript Developer's Guide
► API Reference
578
path: {string=} [optional]
the path of the Geocoding service, default is '6.2'
Interface: IConfigurable
This interface is a member of the namespace
H.service .
Interface Summary
An interface represents an object, that can be configured credentials, settings etc. by
H.service.Platform
[ For full details, see the Interface Details ]
Method Summary
Table 196: Methods
Methods
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Interface Description
An interface represents an object, that can be configured credentials, settings etc. by
H.service.Platform
Method Details
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
Maps API for JavaScript Developer's Guide
► API Reference
579
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Type definition: JsonpRequestHandle
This type definition is a member of the namespace
H.service .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 197: Properties
Properties
id
the ID associated internally with this request
cancel
this function cancels the request and invokes the errback function
Maps API for JavaScript Developer's Guide
► API Reference
580
Type Definition Description
Property Details
id: {number}
the ID associated internally with this request
cancel: {function()}
this function cancels the request and invokes the errback function
Class: MapTileService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.util.EventTarget
Implements: H.service.IConfigurable
This class encapsulates a map tile end point of the HERE Map Tile API.
[ For full details, see the Class Details ]
Method Summary
Table 198: Methods
Methods
getType () : {string}
This method returns the map tile type provided by this service.
getVersion () : {string}
This method returns the map tile service's newest version hash.
getInfo () : {(H.service.MapTileService.Info | undefined)}
This method returns the map tile service's meta information. The method will return an object once the map tile service's
data has been fetched.
createTileProvider (tileType, scheme, tileSize, format, opt_additionalParameters) :
{H.map.provider.ImageTileProvider}
This method creates a tile provider which uses the specified map tiles. This provider can be used as a data source for an
ImageTileLayer.
Maps API for JavaScript Developer's Guide
► API Reference
581
Methods
createTileLayer (tileType, scheme, tileSize, format, opt_additionalParameters, opt_opacity,
opt_dark) : {H.map.layer.TileLayer}
This method creates a tile layer. This layer can be used as a layer on a map's data model.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Events Summary
Table 199: Events
Events
infoupdate : {H.util.Event}
This event is fired when the service's info resource was successfully retrieved and processed.
versionupdate : {H.util.Event}
This event is fired when the service's version hash was successfully updated.
copyrightupdate : {H.util.Event}
This event is fired when the service's copyrights were successfully retrieved.
Class Description
This class encapsulates a map tile end point of the HERE Map Tile API.
An instance of this class can be retrieved by calling the factory method on a platform instance.
H.service.Platform#getMapTileService.
Example
// assuming that platform and map was already instantiated
var maptiler = platform.getMapTileService({type: 'aerial'}),
tileLayer = maptiler.createTileLayer('maptile', 'hybrid.day', 256,
'jpg');
map.setBaseLayer(tileLayer);
Constructor Details
H.service.MapTileService(opt_options)
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
opt_options:
582
{H.service.MapTileService.Options=} [optional]
Method Details
getType () : {string}
This method returns the map tile type provided by this service.
Returns:
{string}
the map tile type
getVersion () : {string}
This method returns the map tile service's newest version hash.
Returns:
{string}
meta information for this map tile service
getInfo () : {(H.service.MapTileService.Info | undefined)}
This method returns the map tile service's meta information. The method will return an object once
the map tile service's data has been fetched.
Returns:
{(H.service.MapTileService.Info | undefined)}
meta information for this map tile service
createTileProvider (tileType, scheme, tileSize, format,
opt_additionalParameters) : {H.map.provider.ImageTileProvider}
This method creates a tile provider which uses the specified map tiles. This provider can be used as a
data source for an ImageTileLayer.
Parameters:
tileType:
{string}
the tile type
Maps API for JavaScript Developer's Guide
► API Reference
scheme:
{string}
the tile scheme
tileSize:
{number}
the tile size
format:
{string}
the tile image format
583
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
a hash of additional parameters to be
Returns:
{H.map.provider.ImageTileProvider}
the image tile provider
createTileLayer (tileType, scheme, tileSize, format,
opt_additionalParameters, opt_opacity, opt_dark) : {H.map.layer.TileLayer}
This method creates a tile layer. This layer can be used as a layer on a map's data model.
Parameters:
tileType:
{string}
the tile type
scheme:
{string}
the tile scheme
tileSize:
{number}
the tile size
format:
{string}
the tile image format
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
Additional parameters for the map tile service
opt_opacity:
{number=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
584
The opacity of this layer
opt_dark:
{boolean=} [optional]
Indicates whether the content of this layer is mainly dark, default is false
See also H.Map.Options#autoColor
Returns:
{H.map.layer.TileLayer}
the tile layer
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.service.IConfigurable}
Event Details
infoupdate: {H.util.Event}
This event is fired when the service's info resource was successfully retrieved and processed.
versionupdate: {H.util.Event}
This event is fired when the service's version hash was successfully updated.
copyrightupdate: {H.util.Event}
This event is fired when the service's copyrights were successfully retrieved.
Type definition: Info
This type definition is a member of the class
H.service.MapTileService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 200: Properties
Properties
maps
schemes
tiletypes
formats
resolutions
languages
585
Maps API for JavaScript Developer's Guide
► API Reference
Type Definition Description
Property Details
maps: {Object<string, Object>}
schemes: {Object<string, Object>}
tiletypes: {Object<string, Object>}
formats: {Object<string, Object>}
resolutions: {Object<string, Object>}
languages: {Object<string, Object>}
Type definition: Options
This type definition is a member of the class
H.service.MapTileService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 201: Properties
Properties
type
the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API
documentation for available types)
version
the map version hash to use for retrieving tiles, default is newest and will be automatically updated
subDomain
the sub-domain of the map tile service relative to the platform's base URL, default is 'maps'
path
the path of the map tile service, default is 'maptile/2.1'
586
Maps API for JavaScript Developer's Guide
► API Reference
587
Type Definition Description
Property Details
type: {string=} [optional]
the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the
Map Tile REST API documentation for available types)
version: {string=} [optional]
the map version hash to use for retrieving tiles, default is newest and will be automatically updated
subDomain: {string=} [optional]
the sub-domain of the map tile service relative to the platform's base URL, default is 'maps'
path: {string=} [optional]
the path of the map tile service, default is 'maptile/2.1'
Type definition: MapType
This type definition is a member of the namespace
H.service .
Type Definition Summary
A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or
'terrain'). A map type contains at least a map property which defines the basic map layer for a given
map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic
etc.
[ For full details, see the Type Definition Details ]
Property Summary
Table 202: Properties
Properties
map
the basic map tiles with all features and labels
xbase
map tiles without features and labels
base
Maps API for JavaScript Developer's Guide
► API Reference
588
Properties
map tiles without labels
traffic
map tiles with traffic flow highlighting
transit
map tiles with public transit lines highlighted
panorama
map tiles highlighting areas with HERE StreetLevel coverage
labels
transparent map tiles with labels only
Type Definition Description
A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or
'terrain'). A map type contains at least a map property which defines the basic map layer for a given
map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic
etc.
Property Details
map: {H.map.layer.TileLayer}
the basic map tiles with all features and labels
xbase: {H.map.layer.TileLayer=} [optional]
map tiles without features and labels
base: {H.map.layer.TileLayer=} [optional]
map tiles without labels
traffic: {H.map.layer.TileLayer=} [optional]
map tiles with traffic flow highlighting
transit: {H.map.layer.TileLayer=} [optional]
map tiles with public transit lines highlighted
panorama: {H.map.layer.TileLayer=} [optional]
map tiles highlighting areas with HERE StreetLevel coverage
Maps API for JavaScript Developer's Guide
► API Reference
589
labels: {H.map.layer.TileLayer=} [optional]
transparent map tiles with labels only
Class: PlacesService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.service.AbstractRestService
Places service implements a low level places RestApi access. Please refer to Restful API
documentation for providing parameters and handling response objects.
[ For full details, see the Class Details ]
Method Summary
Table 203: Methods
Methods
request (entryPoint, entryPointParams, onResult, onError) : {H.service.JsonpRequestHandle}
This is generic method to query places RestAPI.
search (searchParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response
handling.
suggest (suggestParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and
response handling.
explore (exploreParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response
handling.
around (aroundParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response
handling.
here (hereParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response
handling.
Maps API for JavaScript Developer's Guide
► API Reference
590
Methods
categories (categoriesParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response
handling.
follow (hyperlink, onResult, onError, opt_additionalParameters) :
{H.service.JsonpRequestHandle}
This method should be used to follow hyperlinks available in results returned by dicovery queries.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Class Description
Places service implements a low level places RestApi access. Please refer to Restful API
documentation for providing parameters and handling response objects.
Entry point parameters are specified as objects as key:value pairs which are transformed to URL
parameters. Request headers can be specified along with entry point parameters.
Example
// assuming that platform was already instantiated
var places = platform.getPlacesService();
places.search({
'at': '52.5044,13.3909',
'q': 'pizza',
'Accept-Language': 'de'
}, function(resp) {
//handle response
console.log(resp);
}, function(resp) {
//handle network error
console.log('ERROR: '+resp);
});
Constructor Details
H.service.PlacesService(opt_options)
Parameters:
opt_options:
{H.service.PlacesService.Options=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
591
Method Details
request (entryPoint, entryPointParams, onResult, onError) :
{H.service.JsonpRequestHandle}
This is generic method to query places RestAPI.
Example
// assuming that platform was already instantiated
var places = platform.getPlacesService(),
entryPoint = H.service.PlacesService.EntryPoint;
places.request(entryPoint.SEARCH, { 'at': '52.5044,13.3909', 'q':
'pizza'}, function(resp) {
console.log(resp);
}, function(resp) {
console.log('ERROR: '+resp);
});
Parameters:
entryPoint:
{string}
can be one of available entry points H.service.PlacesService.EntryPoint i.e
value of H.service.PlacesService.EntryPoint.SEARCH
entryPointParams: {Object}
parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places restful api documentation documentation for available parameters for chose entry point
onResult:
{Function}
callback which is called when result is returned
onError:
{Function}
callback which is called when error occured (i.e request timeout)
Returns:
{H.service.JsonpRequestHandle}
jsonp request handle
search (searchParams, onResult, onError) : {H.service.JsonpRequestHandle}
Maps API for JavaScript Developer's Guide
► API Reference
592
Function triggers places api 'search' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
searchParams:
{H.service.ServiceParameters}
places api search entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Returns:
{H.service.JsonpRequestHandle}
jsonp request handle
suggest (suggestParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
suggestParams:
{H.service.ServiceParameters}
places api suggest entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Returns:
{H.service.JsonpRequestHandle}
jsonp request handle
Maps API for JavaScript Developer's Guide
► API Reference
593
explore (exploreParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'explore' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
exploreParams:
{H.service.ServiceParameters}
places api explore entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Returns:
{H.service.JsonpRequestHandle}
jsonp request handle
around (aroundParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'around' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
aroundParams:
{H.service.ServiceParameters}
places api around entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Returns:
{H.service.JsonpRequestHandle}
Maps API for JavaScript Developer's Guide
► API Reference
594
jsonp request handle
here (hereParams, onResult, onError) : {H.service.JsonpRequestHandle}
Function triggers places api 'here' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
hereParams:
{H.service.ServiceParameters}
places api here entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Returns:
{H.service.JsonpRequestHandle}
jsonp request handle
categories (categoriesParams, onResult, onError) :
{H.service.JsonpRequestHandle}
Function triggers places api 'categories' entry point. Please refer to documentation for parameter
specification and response handling.
Parameters:
categoriesParams: {H.service.ServiceParameters}
places api here entry point parameters please refer to places api documentation
onResult:
{Function}
onError:
{Function}
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
595
{H.service.JsonpRequestHandle}
jsonp request handle
follow (hyperlink, onResult, onError, opt_additionalParameters) :
{H.service.JsonpRequestHandle}
This method should be used to follow hyperlinks available in results returned by dicovery queries.
Example
// assuming that platform was already instantiated
var places = platform.getPlacesService(),
entryPoint = H.service.PlacesService.EntryPoint;
places.request(entryPoint.SEARCH, { 'at': '52.5044,13.3909', 'q':
'pizza'}, function(response) {
var items = response.results.items;
places.follow(items[0].href, function(resp) {
console.log(resp);
},
function(resp) {
console.log('ERROR: '+resp);
});
}, function(resp) {
console.log('ERROR: '+resp);
});
Parameters:
hyperlink:
{string}
onResult:
{Function}
onError:
{Function}
opt_additionalParameters:
{Object=} [optional]
additional parameters to send with request
Returns:
{H.service.JsonpRequestHandle}
Maps API for JavaScript Developer's Guide
► API Reference
596
jsonp resquest handle
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Enumeration: EntryPoint
This enumeration is a member of the class
Enumeration Summary
List of available entry points
H.service.PlacesService .
Maps API for JavaScript Developer's Guide
► API Reference
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 204: Constants
Constants
static
SEARCH
static
SUGGEST
static
EXPLORE
static
AROUND
static
HERE
static
CATEGORIES
Enumeration Details
List of available entry points
Enumeration Constants Details
static SEARCH
static SUGGEST
static EXPLORE
static AROUND
static HERE
static CATEGORIES
Type definition: Options
This type definition is a member of the class
Type Definition Summary
H.service.PlacesService .
597
Maps API for JavaScript Developer's Guide
► API Reference
598
[ For full details, see the Type Definition Details ]
Property Summary
Table 205: Properties
Properties
subDomain
the sub-domain of the places service relative to the platform's base URL, default is 'places'
path
the path of the places service, default is 'places/v1'
baseUrl
an optional base URL if it differs from the platform's default base URL
Type Definition Description
Property Details
subDomain: {string=} [optional]
the sub-domain of the places service relative to the platform's base URL, default is 'places'
path: {string=} [optional]
the path of the places service, default is 'places/v1'
baseUrl: {H.service.Url=} [optional]
an optional base URL if it differs from the platform's default base URL
Class: Platform
This class is a member of the namespace
H.service .
Class Summary
The Platform class represents central class from which all other service stubs are created. It also
contains the shared settings to be passed to the individual service stubs, for example the root URL of
the platform, application credentials, etc.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
Method Summary
Table 206: Methods
Methods
configure (configurable) : {H.service.IConfigurable}
Method attempts to configure object that implements H.service.IConfigurable
setUseHTTPS (useHTTPS)
This method enables or disables HTTPS communication with the platform
setUseCIT (useCIT)
This method configures whether to use the "customer integration testing" instance of the platform.
setBaseUrl (baseUrl)
This method modifies the base URL to be used when creating service stubs.
getBaseUrl () : {H.service.Url}
This method returns the currently used base URL.
getPlacesService () : {H.service.PlacesService}
This method returns an instance of H.service.PlacesService to query the Places API.
getTrafficIncidentsService () : {H.service.TrafficIncidentsService}
This method returns an instance of H.service.TrafficIncidentsService to query the Traffic API Traffic Incident Data
getMapTileService (opt_options) : {H.service.MapTileService}
This method returns an instance of H.service.MapTileService to query the Map Tile API.
getMetaInfoService (opt_params) : {H.service.metaInfo.Service}
This method returns an instance of H.service.metaInfo.Service to query the Map Tile API Metainfo Tiles
getVenueService (opt_params) : {H.service.venues.Service}
This method returns an instance of H.service.venues.Service to query the Venue Maps API
createDefaultLayers (opt_tileSize, opt_ppi, opt_lg, opt_lg2, opt_style, opt_pois) :
{Object<string, H.service.MapType>}
This method creates a pre-configured set of HERE tile layers for convenient use with the map.
getEnterpriseRoutingService (opt_options) : {H.service.EnterpriseRoutingService}
This method returns an instance of H.service.EnterpriseRoutingService to query the Enterprise Routing API.
getRoutingService (opt_options) : {H.service.RoutingService}
This method returns an instance of H.service.RoutingService to query the Routing API.
getGeocodingService (opt_options) : {H.service.GeocodingService}
599
Maps API for JavaScript Developer's Guide
► API Reference
600
Methods
This method returns an instance of H.service.GeocodingService to query the Geocoder API
Class Description
The Platform class represents central class from which all other service stubs are created. It also
contains the shared settings to be passed to the individual service stubs, for example the root URL of
the platform, application credentials, etc.
Example
var platform = new H.service.Platform({
app_id: [your app_id],
//set your app_id
app_code: [your app_code],
//set your app_code
useCIT: true
//configure all services to use the 'CIT'
environment
});
var geocoder = platform.getGeocodingService();
//Now you are ready to talk to the HERE Geocoder API
Constructor Details
H.service.Platform(options)
Parameters:
options:
{H.service.Platform.Options}
Method Details
configure (configurable) : {H.service.IConfigurable}
Method attempts to configure object that implements H.service.IConfigurable
Parameters:
configurable:
{H.service.IConfigurable}
Returns:
{H.service.IConfigurable}
Maps API for JavaScript Developer's Guide
► API Reference
601
setUseHTTPS (useHTTPS)
This method enables or disables HTTPS communication with the platform
Parameters:
useHTTPS:
{boolean}
a boolean value indicating whether to communicate with the platform via
HTTPS
setUseCIT (useCIT)
This method configures whether to use the "customer integration testing" instance of the platform.
Parameters:
useCIT:
{boolean}
a boolean value indicating whether the CIT platform instance is to be used
setBaseUrl (baseUrl)
This method modifies the base URL to be used when creating service stubs.
Parameters:
baseUrl:
{H.service.Url}
the new base URL to use
getBaseUrl () : {H.service.Url}
This method returns the currently used base URL.
Returns:
{H.service.Url}
getPlacesService () : {H.service.PlacesService}
This method returns an instance of H.service.PlacesService to query the Places API.
Returns:
{H.service.PlacesService}
a new places service instance
getTrafficIncidentsService () : {H.service.TrafficIncidentsService}
Maps API for JavaScript Developer's Guide
► API Reference
602
This method returns an instance of H.service.TrafficIncidentsService to query the Traffic API Traffic
Incident Data
Returns:
{H.service.TrafficIncidentsService}
a new places service instance
getMapTileService (opt_options) : {H.service.MapTileService}
This method returns an instance of H.service.MapTileService to query the Map Tile API.
Parameters:
opt_options:
{H.service.MapTileService.Options=} [optional]
Returns:
{H.service.MapTileService}
getMetaInfoService (opt_params) : {H.service.metaInfo.Service}
This method returns an instance of H.service.metaInfo.Service to query the Map Tile API Metainfo
Tiles
Parameters:
opt_params:
{H.service.metaInfo.Service.Options=} [optional]
additional service parameters
Returns:
{H.service.metaInfo.Service}
getVenueService (opt_params) : {H.service.venues.Service}
This method returns an instance of H.service.venues.Service to query the Venue Maps API
Parameters:
opt_params:
{H.service.venues.Service.Options=} [optional]
additional service parameters
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
603
{H.service.venues.Service}
createDefaultLayers (opt_tileSize, opt_ppi, opt_lg, opt_lg2, opt_style,
opt_pois) : {Object<string, H.service.MapType>}
This method creates a pre-configured set of HERE tile layers for convenient use with the map.
This method returns an object holding the three default map types
•
•
•
normal
satellite
terrain
Each of the map types in turn contains the following variant tile layers:
•
•
•
map
xbase
base
•
•
•
traffic
panorama
labels
In addition the normal map type contains the transit and metaInfo variant. Collection of default
map types also includes incidents type, that provides an overlay that displays current traffic
incidents, and venues type, that encapsulates indoor maps overlay.
Example
// Create the default layers
// assuming that platform and map was already instantiated
var layers = platform.createDefaultLayers();
// Set the satellite map type's traffic variant as the map's base layer
map.setBaseLayer(layers.satellite.traffic);
Parameters:
opt_tileSize:
{number=} [optional]
optional tile size to be queried from the HERE Map Tile API, default is 256
opt_ppi:
{number=} [optional]
optional 'ppi' parameter to use when querying tiles, default is not specified
opt_lg:
{string=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
optional primary language parameter, default is not specified
opt_lg2:
{string=} [optional]
optional secondary language parameter, default is not specified
opt_style:
{string=} [optional]
optional 'style' parameter to use when querying map tiles, default is not
604
specified
opt_pois:
{boolean=} [optional]
indicates if pois are displayed on the map
Returns:
{Object<string, H.service.MapType>}
a set of tile layers ready to use
getEnterpriseRoutingService (opt_options) :
{H.service.EnterpriseRoutingService}
This method returns an instance of H.service.EnterpriseRoutingService to query the Enterprise
Routing API.
Parameters:
opt_options:
{H.service.EnterpriseRoutingService.Options=} [optional]
Returns:
{H.service.EnterpriseRoutingService}
getRoutingService (opt_options) : {H.service.RoutingService}
This method returns an instance of H.service.RoutingService to query the Routing API.
Parameters:
opt_options:
{H.service.RoutingService.Options=} [optional]
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.service.RoutingService}
getGeocodingService (opt_options) : {H.service.GeocodingService}
This method returns an instance of H.service.GeocodingService to query the Geocoder API
Parameters:
opt_options:
{H.service.GeocodingService.Options=} [optional]
an optional set of options for the new geocoding service to connect to
Returns:
{H.service.GeocodingService}
a new geocoding service instance
Type definition: Options
This type definition is a member of the class
H.service.Platform .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 207: Properties
Properties
app_id
The application ID to identify the client against the platform (mandatory to provide)
app_code
The application code to identify the client against the platform (mandatory to provide)
baseUrl
The base URL of the platform, default is http://api.here.com
useCIT
Indicates whether the Customer Integration Testing should be used, default is false
useHTTPS
605
Maps API for JavaScript Developer's Guide
► API Reference
606
Properties
Indicates whether secure communication should be used, default is false
Type Definition Description
Property Details
app_id: {string}
The application ID to identify the client against the platform (mandatory to provide)
app_code: {string}
The application code to identify the client against the platform (mandatory to provide)
baseUrl: {H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com
useCIT: {boolean=} [optional]
Indicates whether the Customer Integration Testing should be used, default is false
useHTTPS: {boolean=} [optional]
Indicates whether secure communication should be used, default is false
Class: RoutingService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.service.AbstractRestService
This class encapsulates the Routing REST API as a service stub. An instance of this class can be
retrieved by calling the factory method on a platform instance. H.service.Platform#getRoutingService.
[ For full details, see the Class Details ]
Method Summary
Table 208: Methods
Methods
calculateRoute (calculateRouteParams, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
607
Methods
This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service
response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error
occured.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Class Description
This class encapsulates the Routing REST API as a service stub. An instance of this class can be
retrieved by calling the factory method on a platform instance. H.service.Platform#getRoutingService.
Example
// assuming that platform was already instantiated
router = platform.getRoutingService();
var calculateRouteParams = {
'waypoint0': 'geo!52.5,13.4',
'waypoint1': 'geo!52.5,13.45',
'mode': 'fastest;car;traffic:disabled'
},
onResult = function(result) {
console.log(result.response.route[0]);
},
onError = function(error) {
console.log(error);
};
router.calculateRoute(calculateRouteParams, onResult, onError);
Constructor Details
H.service.RoutingService(opt_options)
Parameters:
opt_options:
{H.service.RoutingService.Options=} [optional]
Method Details
calculateRoute (calculateRouteParams, onResult, onError)
Maps API for JavaScript Developer's Guide
► API Reference
608
This method sends a "calculateroute" request to Routing REST API and calls the onResult callback
function once the service response was received - providing a H.service.ServiceResult object - or the
onError callback if a communication error occured.
Please refer to the Routing REST API documentation for information on available parameters and the
response object structure.
Parameters:
calculateR-
{H.service.ServiceParameters}
outeParams:
the service parameters to be sent with the routing request.
onResult:
{function(H.service.ServiceResult)}
this function will be called once the Routing REST API provides a response
to the request.
onError:
{function(Error)}
this function will be called if a communication error occurs during the JSONP request
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Maps API for JavaScript Developer's Guide
► API Reference
609
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Type definition: Options
This type definition is a member of the class
H.service.RoutingService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 209: Properties
Properties
subDomain
the sub-domain of the routing service relative to the platform's base URL, default is 'route'
path
the path of the map tile service, default is 'routing/7.2'
baseUrl
an optional base URL if it differs from the platform's default base URL
Type Definition Description
Property Details
subDomain: {string=} [optional]
the sub-domain of the routing service relative to the platform's base URL, default is 'route'
Maps API for JavaScript Developer's Guide
► API Reference
610
path: {string=} [optional]
the path of the map tile service, default is 'routing/7.2'
baseUrl: {H.service.Url=} [optional]
an optional base URL if it differs from the platform's default base URL
Type definition: ServiceParameters
This type definition is a member of the namespace
H.service .
Type Definition Summary
This type encapsulates URL parameters to be sent to a HERE platform service.
[ For full details, see the Type Definition Details ]
Type Definition Description
This type encapsulates URL parameters to be sent to a HERE platform service.
When calling HERE REST APIs additional URL parameters can be sent by providing an object parameter
which contain URL parameters in key-value format, where keys are URL parameter names and the
values are the parameter values.
Note: The object assumes that values are in string format.
Example
serviceParameters = {
paramA: 'valueA',
paramB: 'valueB'
}
Type definition: ServiceResult
This type definition is a member of the namespace
H.service .
Type Definition Summary
This type encapsulates a response object provider by a HERE platform service.
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
611
Type Definition Description
This type encapsulates a response object provider by a HERE platform service.
In most cases the HERE Maps API for JavaScript will communicate to the HERE REST APIs via the
JSON-P protocol. In such cases the resulting JSON response is parsed and provided to the callback
function.
The structure of a service response object is specific to each service.
Class: TrafficIncidentsProvider
This class is a member of the namespace
H.service .
Class Summary
Extends: H.map.provider.MarkerTileProvider
This class represents traffic incidents provider which requests traffic incidents data from platform
traffic incidents service and converts it to map objects.
[ For full details, see the Class Details ]
Property Summary
Table 210: Properties
Properties
min : {number}
Minimum zoom level at which provider can serve data, set at construction time
max : {number}
Maximum zoom level at which provider can server data, set at construction time
uid : {string}
Provider instance unique identifier, generated at construction time
tileSize : {number}
The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is {@code 256
Maps API for JavaScript Developer's Guide
► API Reference
612
Method Summary
Table 211: Methods
Methods
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
Request data on a tile basis
cancelTile (x, y, z)
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
cancelTileByKey (tileKey)
Cancels tile from being requested using a tile-key
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by
underscores e.g.: "4711_7_42_23"
getCache () : {H.util.Cache}
This method returns cache which should be used to store tiles
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
reload (hard)
This method instructs the provider to reload data from it's source.
Maps API for JavaScript Developer's Guide
► API Reference
613
Methods
invalidateObject (marker, flags)
To signal to this provider that a map object has been changed. The method marks tile, that contains that objectm as invalid
and triggers dispatchUpdate()
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing H.map.DomMarker map objects.
Class Description
This class represents traffic incidents provider which requests traffic incidents data from platform
traffic incidents service and converts it to map objects.
Constructor Details
H.service.TrafficIncidentsProvider(service, opt_refreshTime,
opt_additionalParameters)
Parameters:
service:
{H.service.TrafficIncidentsService}
traffic incidents service that serves incidents data
opt_refreshTime:
{number=} [optional]
argument indicates timeframe when provider tiles should be updated (in ms)
defaults to 3 minutes
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
an additional set of URL parameters
Property Details
min: {number}
Minimum zoom level at which provider can serve data, set at construction time
max: {number}
Maximum zoom level at which provider can server data, set at construction time
uid: {string}
Provider instance unique identifier, generated at construction time
Maps API for JavaScript Developer's Guide
► API Reference
614
tileSize: {number}
The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default
is {@code 256
Method Details
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
Maps API for JavaScript Developer's Guide
► API Reference
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method returns the copyrights of the provided content for a certain geographical area at a
specified zoom level.
Note: This function must be overridden by any class inheriting the Provider class. The default
implementation returns null.
Parameters:
bounds:
{H.geo.Rect}
The bounding area for which to retrieve the copyright information
level:
{number}
The zoom level for which to retrieve the copyright information
Returns:
{?Array<H.map.ICopyright>}
615
Maps API for JavaScript Developer's Guide
► API Reference
616
a list of copyright information objects for the provided area and zoom level
requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}
Request data on a tile basis
Parameters:
x:
{number}
The row number of the tile
y:
{number}
The column number of the tile
z:
{number}
The zoom level for which the tile is requested
cacheOnly:
{boolean}
Indicates whether only cached tiles are to be considered
Returns:
{(H.map.provider.Tile | undefined)}
tile object
cancelTile (x, y, z)
Cancels tile from being requested using x, y, z coordinates (column, row, zoom)
Parameters:
x:
{number}
x tile coordinate (row)
y:
{number}
y tile coordinate (column)
z:
{number}
tile coordinate (zoom)
cancelTileByKey (tileKey)
Cancels tile from being requested using a tile-key
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
tileKey:
{string}
The key of the tile
617
getTileKey (x, y, z) : {string}
This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates,
seperated by underscores e.g.: "4711_7_42_23"
Parameters:
x:
{number}
The x tile coordinate (row)
y:
{number}
The y tile coordinate (column)
z:
{number}
The z tile coordinate (zoom level)
Returns:
{string}
string
getCache () : {H.util.Cache}
This method returns cache which should be used to store tiles
Returns:
{H.util.Cache}
cache
requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}
This method request tile from remote service
Parameters:
x:
{number}
The row number of the tile
Maps API for JavaScript Developer's Guide
► API Reference
618
y:
{number}
The column number of the tile
z:
{number}
The zoom level for which the tile is requested
onResponse:
{function((Array<H.map.Object> | HTMLImageElement | HTMLCanvasElement | null))}
function which is called after response arrives
onError:
{function(string)}
function which is called in case of communication error
Returns:
{H.util.ICancelable}
reload (hard)
This method instructs the provider to reload data from it's source.
Two reload modes are possible:
•
•
hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to
re-fetch the tiles. Currently cached tiles will not be used for rendering.
soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the
earliest convenience. The provider does not invalidate the cache immediately in this case. This
means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
hard:
{boolean}
a boolean flag indicating whether to invalidate in hard mode (true) or in
soft mode (false);
invalidateObject (marker, flags)
To signal to this provider that a map object has been changed. The method marks tile, that contains
that objectm as invalid and triggers dispatchUpdate()
Parameters:
marker:
{!H.map.AbstractMarker}
Maps API for JavaScript Developer's Guide
► API Reference
The map object to be invalidated
flags:
{H.math.BitMask}
The flags indicating the types of occurred changes
providesDomMarkers () : {boolean}
Checks whether this provider is currently providing H.map.DomMarker map objects.
Returns:
{boolean}
Class: TrafficIncidentsService
This class is a member of the namespace
H.service .
Class Summary
Extends: H.service.AbstractRestService
TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API
documentation where it is possible to retrieve traffic incident information on a tile basis
[ For full details, see the Class Details ]
Method Summary
Table 212: Methods
Methods
requestIncidents (serviceParams, onResponse, onError) : {H.service.JsonpRequestHandle}
This method requests traffic incidents based on the service parameters provided.
requestIncidentsByTile (x, y, z, onResponse, onError, opt_serviceParams) :
{H.service.JsonpRequestHandle}
This method requests traffic incident information by tile coordinates
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
619
Maps API for JavaScript Developer's Guide
► API Reference
620
Class Description
TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API
documentation where it is possible to retrieve traffic incident information on a tile basis
Constructor Details
H.service.TrafficIncidentsService(opt_options)
Parameters:
opt_options:
{H.service.TrafficIncidentsService.Options=} [optional]
Method Details
requestIncidents (serviceParams, onResponse, onError) :
{H.service.JsonpRequestHandle}
This method requests traffic incidents based on the service parameters provided.
Parameters:
serviceParams:
{H.service.ServiceParameters}
onResponse:
{function(H.service.ServiceResult)}
onError:
{function()}
Returns:
{H.service.JsonpRequestHandle}
requestIncidentsByTile (x, y, z, onResponse, onError, opt_serviceParams) :
{H.service.JsonpRequestHandle}
This method requests traffic incident information by tile coordinates
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
x:
{number}
tile column number
y:
{number}
tile row number
z:
{number}
zoom level
onResponse:
{function(H.service.ServiceResult)}
callback to handle service resposne
onError:
{function()}
callback to habdle communication error
621
opt_serviceParams: {H.service.ServiceParameters=} [optional]
optional service parameters to be added to the request
Returns:
{H.service.JsonpRequestHandle}
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
Maps API for JavaScript Developer's Guide
► API Reference
622
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Type definition: Options
This type definition is a member of the class
H.service.TrafficIncidentsService .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 213: Properties
Properties
subDomain
the sub-domain of the traffic incidents service relative to the platform's base URL, default is 'traffic'
path
the path of the traffic incidents service, default is 'traffic/6.1'
baseUrl
an optional base URL if it differs from the platform's default base URL
Type Definition Description
Property Details
subDomain: {string=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
623
the sub-domain of the traffic incidents service relative to the platform's base URL, default is
'traffic'
path: {string=} [optional]
the path of the traffic incidents service, default is 'traffic/6.1'
baseUrl: {H.service.Url=} [optional]
an optional base URL if it differs from the platform's default base URL
Class: Url
This class is a member of the namespace
H.service .
Class Summary
This class represents a URL giving access to the individual parts that make up a URL,such as the
scheme, host/domain, path, etc. Use the static parse method to populate a new URL object from a
URL string. Be aware that URLs with user and password like "ftp://user:[email protected]/" are not
supported!
[ For full details, see the Class Details ]
Method Summary
Table 214: Methods
Methods
static
parse (url, opt_baseURL) : {H.service.Url}
This function parses a URL string and returns a H.service.Url object. The URL string must contain at least a scheme and a
host.
clone () : {H.service.Url}
Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note
that URL parameters are not replaced but merged with the parameters of this instance.
setScheme (scheme) : {H.service.Url}
This function sets the scheme of this URL object.
getScheme () : {string}
This function returns the scheme of this Url object.
setHost (host) : {H.service.Url}
This function sets the host of this URL object.
Maps API for JavaScript Developer's Guide
► API Reference
624
Methods
getHost () : {string}
This function returns the host name of this Url object.
setPath (path) : {H.service.Url}
This function sets the path of this URL object.
getPath () : {(string | undefined)}
This function returns the path part of this Url object.
setQuery (params) : {H.service.Url}
This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined
values will be treated as query string parameters with no value.
hasQuery () : {boolean}
This function returns a boolean value indicating whether there are any query string parameter associated with this URL.
getQuery () : {Object}
This function returns the query object of this Url object.
setAnchor (anchor) : {H.service.Url}
This function sets the anchor of this URL object.
getAnchor () : {(string | undefined)}
This function returns the anchor of this Url object.
mergeQuery (other) : {H.service.Url}
This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in
the argument and this URL's parameters will be overwritten. Key-value pairs which are defined in the argument and are not
defined in this URL's parameters will be added. Prototype properties and function properties will not be merged.
addSubDomain (subDomain) : {H.service.Url}
This function adds a sub-domain to the host of this URL object.
addSubPath (subPath) : {H.service.Url}
This function adds a sub-path to this URL's path
toString () : {string}
This function formats this URL object to a full URL string.
Class Description
This class represents a URL giving access to the individual parts that make up a URL,such as the
scheme, host/domain, path, etc. Use the static parse method to populate a new URL object from a
Maps API for JavaScript Developer's Guide
► API Reference
625
URL string. Be aware that URLs with user and password like "ftp://user:[email protected]/" are not
supported!
Constructor Details
H.service.Url(scheme, host, opt_path, opt_params, opt_port, opt_anchor)
Parameters:
scheme:
{string}
the URL scheme (e.g. "http" or "https" or "mailto")
host:
{string}
the host (or domain) part of the URL
opt_path:
{string=} [optional]
the path following the host pointing to a resource
opt_params:
{Object=} [optional]
the query string parameters of this URL
opt_port:
{number=} [optional]
The port of the host on which the host listens. If a string is passed it must be
convertible to an integer.
opt_anchor:
{string=} [optional]
an optional anchor part of the URL (usually preceded by '#');
Method Details
static
parse (url, opt_baseURL) : {H.service.Url}
This function parses a URL string and returns a H.service.Url object. The URL string must contain at
least a scheme and a host.
Parameters:
url:
{string}
The URL string to parse.
opt_baseURL:
{string=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
626
The base URL to use to resolve relative URLs. If ommited the base URL of
the document which loaded the API is taken.
Returns:
{H.service.Url}
the parsed URL object
clone () : {H.service.Url}
Clones this URL object. Optionally, mutations can be passed to this function to modify properties of
the cloned object. Note that URL parameters are not replaced but merged with the parameters of
this instance.
Returns:
{H.service.Url}
the clone of the URL object
setScheme (scheme) : {H.service.Url}
This function sets the scheme of this URL object.
Parameters:
scheme:
{string}
the new scheme
Returns:
{H.service.Url}
this URL object
getScheme () : {string}
This function returns the scheme of this Url object.
Returns:
{string}
the scheme (for example 'http')
setHost (host) : {H.service.Url}
Maps API for JavaScript Developer's Guide
► API Reference
This function sets the host of this URL object.
Parameters:
host:
{string}
the new host
Returns:
{H.service.Url}
this URL object
getHost () : {string}
This function returns the host name of this Url object.
Returns:
{string}
the host (for example 'api.here.com')
setPath (path) : {H.service.Url}
This function sets the path of this URL object.
Parameters:
path:
{(string | undefined)}
the new path or a boolean to clear the path
Returns:
{H.service.Url}
this URL object
getPath () : {(string | undefined)}
This function returns the path part of this Url object.
Returns:
{(string | undefined)}
the path (for example 'myresources/resource.html')
setQuery (params) : {H.service.Url}
627
Maps API for JavaScript Developer's Guide
► API Reference
628
This function sets the specified parameters for this URL object. Keys in this object, which are
associated with undefined values will be treated as query string parameters with no value.
Parameters:
params:
{(Object | undefined)}
a hash of query string parameters specifying the parameters to be set.or a
boolean to clear the parameters.
Returns:
{H.service.Url}
this URL object
hasQuery () : {boolean}
This function returns a boolean value indicating whether there are any query string parameter
associated with this URL.
Returns:
{boolean}
true if there are parameters, false if none are present
getQuery () : {Object}
This function returns the query object of this Url object.
Returns:
{Object}
the query object
setAnchor (anchor) : {H.service.Url}
This function sets the anchor of this URL object.
Parameters:
anchor:
{(string | boolean | undefined)}
the new anchor or undefined to clear the anchor
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
629
{H.service.Url}
this URL object
getAnchor () : {(string | undefined)}
This function returns the anchor of this Url object.
Returns:
{(string | undefined)}
the anchor
mergeQuery (other) : {H.service.Url}
This function merges the provided parameters into this URL's existing parameters. Key-value pairs
which are defined in the argument and this URL's parameters will be overwritten. Key-value pairs
which are defined in the argument and are not defined in this URL's parameters will be added.
Prototype properties and function properties will not be merged.
Example
var url = new H.service.Url('http', 'api.here.com');
url.setQuery({ 'foo': 'bar' });
url.mergeQuery({ 'foo': 'baz', 'bar': 'foo' });
var newQuery = url.getQuery();
newQuery['foo'] === 'bar' // false
newQuery['foo'] === 'baz' // true
newQuery['bar'] === 'foo' // true
Parameters:
other:
{Object}
the parmeters to be merged into this URL's query string parameters
Returns:
{H.service.Url}
this URL object
addSubDomain (subDomain) : {H.service.Url}
This function adds a sub-domain to the host of this URL object.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
subDomain:
{string}
the sub domain (non-empty string) to be added
Returns:
{H.service.Url}
this URL object
addSubPath (subPath) : {H.service.Url}
This function adds a sub-path to this URL's path
Parameters:
subPath:
{string}
the path to be added
Returns:
{H.service.Url}
this URL object
toString () : {string}
This function formats this URL object to a full URL string.
Returns:
{string}
the URL's string representation
Namespace: metaInfo
Namespace Summary
This namespace contains classes related to the Metainfo Tiles Service.
Namespace Description
This namespace contains classes related to the Metainfo Tiles Service.
630
Maps API for JavaScript Developer's Guide
► API Reference
631
Class: Service
This class is a member of the namespace
H.service.metaInfo .
Class Summary
Implements: H.service.IConfigurable
Extends: H.util.EventTarget
This class encapsulates a Metainfo Tile end point of the HERE Map Tile API.
[ For full details, see the Class Details ]
Method Summary
Table 215: Methods
Methods
getVersion () : {string}
This method returns the meta info tile service's newest version hash.
getInfo () : {(H.service.metaInfo.Service.Info | undefined)}
This method returns the meta info tile service's meta information. The method will return an object once the map tile
service's data has been fetched.
createTileProvider (tileSize, pixelRatio, opt_categoryFilter, opt_additionalParameters) :
{H.map.provider.TileProvider}
This method creates a tile provider which uses the meta info tile backend. This provider can be used as a data source for an
TileLayer.
createTileLayer (tileSize, pixelRatio, opt_categoryFilter, opt_additionalParameters) :
{H.map.layer.TileLayer}
This method creates a tile layer. This layer can be used as a layer on a map's data model.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Maps API for JavaScript Developer's Guide
► API Reference
Events Summary
Table 216: Events
Events
infoupdate : {H.util.Event}
This event is fired when the service's info resource was successfully retrieved and processed.
versionupdate : {H.util.Event}
This event is fired when the service's version hash was successfully updated.
copyrightupdate : {H.util.Event}
This event is fired when the service's copyrights were successfully retrieved.
Class Description
This class encapsulates a Metainfo Tile end point of the HERE Map Tile API.
An instance of this class can be retrieved by calling the factory method on a platform instance.
H.service.Platform#getMetaInfoService.
Constructor Details
H.service.metaInfo.Service(opt_options)
Parameters:
opt_options:
{H.service.metaInfo.Service.Options=} [optional]
additional service parameters
Method Details
getVersion () : {string}
This method returns the meta info tile service's newest version hash.
Returns:
{string}
meta information for this map tile service
getInfo () : {(H.service.metaInfo.Service.Info | undefined)}
632
Maps API for JavaScript Developer's Guide
► API Reference
633
This method returns the meta info tile service's meta information. The method will return an object
once the map tile service's data has been fetched.
Returns:
{(H.service.metaInfo.Service.Info | undefined)}
meta information for this meta info tile service
createTileProvider (tileSize, pixelRatio, opt_categoryFilter,
opt_additionalParameters) : {H.map.provider.TileProvider}
This method creates a tile provider which uses the meta info tile backend. This provider can be used
as a data source for an TileLayer.
Parameters:
tileSize:
{number}
The tile size
pixelRatio:
{number}
opt_categoryFilter:{Array<string>=} [optional]
A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names.
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
Additional parameters for the meta info service
Returns:
{H.map.provider.TileProvider}
the tile provider
createTileLayer (tileSize, pixelRatio, opt_categoryFilter,
opt_additionalParameters) : {H.map.layer.TileLayer}
This method creates a tile layer. This layer can be used as a layer on a map's data model.
Parameters:
tileSize:
{number}
The tile size
Maps API for JavaScript Developer's Guide
► API Reference
pixelRatio:
{number}
The tile's pixel ratio, should be aligned with base map tile
634
opt_categoryFilter:{Array<string>=} [optional]
A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names.
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
Additional parameters for the meta info service
Returns:
{H.map.layer.TileLayer}
the tile layer
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
635
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Event Details
infoupdate: {H.util.Event}
This event is fired when the service's info resource was successfully retrieved and processed.
versionupdate: {H.util.Event}
This event is fired when the service's version hash was successfully updated.
copyrightupdate: {H.util.Event}
This event is fired when the service's copyrights were successfully retrieved.
Type definition: Info
This type definition is a member of the class
H.service.metaInfo.Service .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 217: Properties
Properties
maps
schemes
tiletypes
formats
resolutions
Maps API for JavaScript Developer's Guide
► API Reference
Properties
languages
Type Definition Description
Property Details
maps: {Object<string, Object>}
schemes: {Object<string, Object>}
tiletypes: {Object<string, Object>}
formats: {Object<string, Object>}
resolutions: {Object<string, Object>}
languages: {Object<string, Object>}
Type definition: Options
This type definition is a member of the class
H.service.metaInfo.Service .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 218: Properties
Properties
version
the map version hash to use for retrieving tiles, default is newest and will be automatically updated
subDomain
the sub-domain of the map tile service relative to the platform's base URL, default is 'maps'
636
Maps API for JavaScript Developer's Guide
► API Reference
637
Type Definition Description
Property Details
version: {string=} [optional]
the map version hash to use for retrieving tiles, default is newest and will be automatically updated
subDomain: {string=} [optional]
the sub-domain of the map tile service relative to the platform's base URL, default is 'maps'
Class: TileProvider
This class is a member of the namespace
H.service.metaInfo .
Class Summary
Extends: H.map.provider.RemoteTileProvider
This class utilizes Metainfo Tiles functionality provided by the Map Tile API to load meta information
about map objects (buildings, labels, public transport etc.).
[ For full details, see the Class Details ]
Class Description
This class utilizes Metainfo Tiles functionality provided by the Map Tile API to load meta information
about map objects (buildings, labels, public transport etc.).
Constructor Details
H.service.metaInfo.TileProvider(service, opt_params, opt_options)
Parameters:
service:
{H.service.metaInfo.Service}
the meta tile service which holds information from about the soutce of the
tiles
opt_params:
{H.service.ServiceParameters=} [optional]
an additional set of URL parameters
opt_options:
{H.service.metaInfo.TileProvider.Options=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
additional parameters
Type definition: Options
This type definition is a member of the class
H.service.metaInfo.TileProvider .
Type Definition Summary
Configuration object which can be used to initialize the TileProvider.
[ For full details, see the Type Definition Details ]
Property Summary
Table 219: Properties
Properties
tileCacheSize
The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
tileSize
The size of the tiles rendered by this provider (must be power of 2, default is 256)
pixelRatio
The pixel ratio to use for over-sampling in cases of high-resolution displays
categoryFilter
A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names.
Type Definition Description
Configuration object which can be used to initialize the TileProvider.
Property Details
tileCacheSize: {number=} [optional]
The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
tileSize: {number=} [optional]
The size of the tiles rendered by this provider (must be power of 2, default is 256)
pixelRatio: {number=} [optional]
638
Maps API for JavaScript Developer's Guide
► API Reference
639
The pixel ratio to use for over-sampling in cases of high-resolution displays
categoryFilter: {Array<string>=} [optional]
A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category
names.
Namespace: venues
Namespace Summary
This namespace contains classes related to the Venue Maps API.
Namespace Description
This namespace contains classes related to the Venue Maps API.
Class: Building
This class is a member of the namespace
H.service.venues .
Class Summary
Extends: H.map.Group
The class represents the building in the venue hiearachy (see H.service.venues.Venue) and holds
floors that belong to the building.
[ For full details, see the Class Details ]
Method Summary
Table 220: Methods
Methods
getVenue () : {H.service.venues.Venue}
Method returns the parent object - venue (see H.service.venues.Venue) to which the building belongs to.
getMinLevel () : {number}
Method returns the minimum floor level of this building.
getMaxLevel () : {number}
Method returns the maximum floor level of this building
Maps API for JavaScript Developer's Guide
► API Reference
640
Methods
getFloor (level) : {(H.service.venues.Floor | undefined)}
Method returns the floor (see H.service.venues.Floor) if one was already loaded. This method doesn't make attempt to fetch
the floor data.
Class Description
The class represents the building in the venue hiearachy (see H.service.venues.Venue) and holds
floors that belong to the building.
Constructor Details
H.service.venues.Building(provider, uid, minLevel, maxLevel)
Parameters:
provider:
{H.map.provider.ObjectProvider}
The object provider of this venue building
uid:
{string}
The unique identifier of this building
minLevel:
{number}
The minimum floor level of this building
maxLevel:
{number}
The maximum floor level of this building
Method Details
getVenue () : {H.service.venues.Venue}
Method returns the parent object - venue (see H.service.venues.Venue) to which the building belongs
to.
Returns:
{H.service.venues.Venue}
getMinLevel () : {number}
Method returns the minimum floor level of this building.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
641
{number}
getMaxLevel () : {number}
Method returns the maximum floor level of this building
Returns:
{number}
getFloor (level) : {(H.service.venues.Floor | undefined)}
Method returns the floor (see H.service.venues.Floor) if one was already loaded. This method doesn't
make attempt to fetch the floor data.
Parameters:
level:
{number}
floor level within minimum and maximum level boundaries for the building
Returns:
{(H.service.venues.Floor | undefined)}
The floor object or undefined if floor was not loaded
Class: Floor
This class is a member of the namespace
H.service.venues .
Class Summary
Extends: H.map.Group
The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class
holds information about floor geometry and spaces (see H.service.venues.Space) that belong to this
floor.
[ For full details, see the Class Details ]
Maps API for JavaScript Developer's Guide
► API Reference
642
Method Summary
Table 221: Methods
Methods
getLevel () : {number}
Method returns the level of the floor in the building.
getFloorSpace () : {(H.service.venues.Space | undefined)}
Method returns map geometry that represents floor boundaries.
getSpaces () : {H.map.Group}
Method returns the H.map.Group of all spaces that belong to the floor.
getBuilding () : {H.service.venues.Building}
Method returns parent object - building (see H.service.venues.Building) of the floor.
getData () : {*}
Method returns raw data associated with the floor. For more details on data format see http://developer.here.com/rest-apis/
documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html
getSpace (id) : {(H.service.venues.Space | undefined)}
Method returns the space object with the given ID, that belongs to the floor.
Class Description
The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class
holds information about floor geometry and spaces (see H.service.venues.Space) that belong to this
floor.
Constructor Details
H.service.venues.Floor(provider, data, level)
Parameters:
provider:
{H.map.provider.ObjectProvider}
The object provider of this venue floor
data:
{*}
The meta data of this floor
level:
{number}
Maps API for JavaScript Developer's Guide
► API Reference
643
The level of this floor
Method Details
getLevel () : {number}
Method returns the level of the floor in the building.
Returns:
{number}
getFloorSpace () : {(H.service.venues.Space | undefined)}
Method returns map geometry that represents floor boundaries.
Returns:
{(H.service.venues.Space | undefined)}
getSpaces () : {H.map.Group}
Method returns the H.map.Group of all spaces that belong to the floor.
Returns:
{H.map.Group}
getBuilding () : {H.service.venues.Building}
Method returns parent object - building (see H.service.venues.Building) of the floor.
Returns:
{H.service.venues.Building}
getData () : {*}
Method returns raw data associated with the floor. For more details on data format see http://
developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tilefloor.html
Returns:
{*}
the raw floor data object
Maps API for JavaScript Developer's Guide
► API Reference
644
getSpace (id) : {(H.service.venues.Space | undefined)}
Method returns the space object with the given ID, that belongs to the floor.
Parameters:
id:
{string}
The ID of the space.
Returns:
{(H.service.venues.Space | undefined)}
The requested space or undefined if space not found.
Class: Service
This class is a member of the namespace
H.service.venues .
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 222: 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 was received - providing a H.service.ServiceResult object, or the onError callback if a communication error
occured.
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 Interaction Tile endpoint
of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-getinteraction-tile.html.
getState () : {H.service.venues.Service.State}
Maps API for JavaScript Developer's Guide
► API Reference
Methods
Method returns current state of the service.
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object implementing the
interface.
Events Summary
Table 223: Events
Events
statechange : {H.util.Event}
This event is fired once service state changes, see H.service.venues.Service#getState. If state is
H.service.venues.Service.State#ERROR, 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
// assuming that platform was already 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]
additional service parameters
Method Details
discover (serviceParams, onResult, onError)
645
Maps API for JavaScript Developer's Guide
► API Reference
646
This method sends a discovery request to the Venue Maps API and calls the onResult callback
function once the service response was received - providing a H.service.ServiceResult object, or the
onError callback if a communication error occured.
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
// assuming that platform was already 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)}
this function will be called once the Venue Maps API provides a response to
the request
onError:
{function(string)}
this function will be called if a communication error occurs during request
and error type is passed 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
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.
Maps API for JavaScript Developer's Guide
► API Reference
647
Example
// assuming that platform was already 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]
Tile provider options
Returns:
{H.map.layer.TileLayer}
the tile layer
getState () : {H.service.venues.Service.State}
Method returns current state of the service.
Returns:
{H.service.venues.Service.State}
State of the service
configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) :
{H.service.IConfigurable}
This methods receive configuration parameters from the platform, that can be used by the object
implementing the interface.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
648
appId:
{string}
The application ID to identify the client against the platform (mandatory to
provide)
appCode:
{string}
The application code to identify the client against the platform (mandatory
to provide)
useHTTPS:
{boolean}
Indicates whether secure communication should be used, default is false
useCIT:
{boolean}
Indicates whether the Customer Integration Testing should be used, default
is false
opt_baseUrl:
{H.service.Url=} [optional]
The base URL of the platform, default is http://api.here.com. Note that
if useHTTPS flag is passed it will override the URL scheme specified in the
opt_baseUrl to use HTTPS.
Returns:
{H.service.IConfigurable}
Event Details
statechange: {H.util.Event}
This event is fired once service state changes, see H.service.venues.Service#getState. If state is
H.service.venues.Service.State#ERROR, fired event has an errorCode property.
Type definition: Options
This type definition is a member of the class
H.service.venues.Service .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Maps API for JavaScript Developer's Guide
► API Reference
649
Property Summary
Table 224: Properties
Properties
subDomain
the sub-domain of the Venue Maps service relative to the platform's base URL, default is 'venue.maps'
path
the path to append after host name when making requests to the Venue Maps API, default is empty
Type Definition Description
Property Details
subDomain: {string=} [optional]
the sub-domain of the Venue Maps service relative to the platform's base URL, default is
'venue.maps'
path: {string=} [optional]
the path to append after host name when making requests to the Venue Maps API, default is empty
Enumeration: State
This enumeration is a member of the class
H.service.venues.Service .
Enumeration Summary
The state types of the H.service.venues.Service. Possible states are:
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 225: Constants
Constants
static
ERROR
static
INIT
static
READY
Maps API for JavaScript Developer's Guide
► API Reference
650
Constants
Enumeration Details
The state types of the H.service.venues.Service. Possible states are:
•
•
•
ERROR - error occurred during initialization
INIT - service is in initialization state
READY - service is ready
Enumeration Constants Details
static ERROR
static INIT
static READY
Class: Space
This class is a member of the namespace
H.service.venues .
Class Summary
Represents a spatial object for this space. Each space object contains data associated with that space
and can be retrieved by using H.service.venues.Space#getData method.
[ For full details, see the Class Details ]
Method Summary
Table 226: Methods
Methods
isFloorSpace () : {boolean}
The method indicates whether the spatial object represents the whole floor space or a space within a floor boundaries, that
belongs to the floor.
initLabelStyle (labelStyle)
This method sets custom style to use for rendering the labels. Should be called before the first render of the space,
otherwise has no any effect. Note that due to the design consistency currently it is not allowed to change the font family and
the size of the labels.
getFloor () : {H.service.venues.Floor}
Maps API for JavaScript Developer's Guide
► API Reference
651
Methods
Method returns parent object - floor (see H.service.venues.Floor) of the space.
getData () : {Object}
Method returns raw data associated with the space. For more details on data format see http://developer.here.com/rest-apis/
documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html
Class Description
Represents a spatial object for this space. Each space object contains data associated with that space
and can be retrieved by using H.service.venues.Space#getData method.
Constructor Details
H.service.venues.Space(provider, uid, data, opt_isFloorSpace)
Parameters:
provider:
{H.map.provider.ObjectProvider}
The provider of this object.
uid:
{string}
The unique identifier of this space
data:
{*}
The meta data of this space
opt_isFloorSpace: {boolean=} [optional]
Indicates whether this space represents a floor itself, defaults to false
Method Details
isFloorSpace () : {boolean}
The method indicates whether the spatial object represents the whole floor space or a space within a
floor boundaries, that belongs to the floor.
Returns:
{boolean}
True if this spatial object represents the floor space.
Maps API for JavaScript Developer's Guide
► API Reference
652
initLabelStyle (labelStyle)
This method sets custom style to use for rendering the labels. Should be called before the first
render of the space, otherwise has no any effect. Note that due to the design consistency currently it
is not allowed to change the font family and the size of the labels.
Example
space.initLabelStyle({
fillcolor: 'rgba(255, 0, 0, 0.7)'
});
Parameters:
labelStyle:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)}
Custom label style
getFloor () : {H.service.venues.Floor}
Method returns parent object - floor (see H.service.venues.Floor) of the space.
Returns:
{H.service.venues.Floor}
getData () : {Object}
Method returns raw data associated with the space. For more details on data format see http://
developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tilespace.html
Returns:
{Object}
raw space data object
Class: TileProvider
This class is a member of the namespace
H.service.venues .
Class Summary
Extends: H.map.provider.RemoteTileProvider
Maps API for JavaScript Developer's Guide
► API Reference
653
This class represents a Venue Maps tile provider which requests venues tiles from a platform venue
tile service.
[ For full details, see the Class Details ]
Method Summary
Table 227: Methods
Methods
setCurrentLevel (level)
Method specifies which floor level of the venues must be fetched by provider. Floor level is global to all venues and defaults
to 0.
getCurrentLevel () : {number}
Method returns the floor level that provider uses for tile fetching.
Class Description
This class represents a Venue Maps tile provider which requests venues tiles from a platform venue
tile service.
Constructor Details
H.service.venues.TileProvider(service, opt_options)
Parameters:
service:
{H.service.venues.Service}
opt_options:
{H.service.venues.TileProvider.Options=} [optional]
Method Details
setCurrentLevel (level)
Method specifies which floor level of the venues must be fetched by provider. Floor level is global to
all venues and defaults to 0.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
level:
654
{number}
getCurrentLevel () : {number}
Method returns the floor level that provider uses for tile fetching.
Returns:
{number}
current provider's floor level
Type definition: Options
This type definition is a member of the class
H.service.venues.TileProvider .
Type Definition Summary
Configuration object which can be used to initialize the TileProvider.
[ For full details, see the Type Definition Details ]
Property Summary
Table 228: Properties
Properties
tileCacheSize
The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
pixelRatio
The pixel ratio to use for over-sampling in cases of high-resolution displays
onSpaceCreated
A callback function that is called on every created space (see H.service.venues.Space) object. The function can be used for
space object styling.
Type Definition Description
Configuration object which can be used to initialize the TileProvider.
Maps API for JavaScript Developer's Guide
► API Reference
655
Property Details
tileCacheSize: {number=} [optional]
The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32
pixelRatio: {number=} [optional]
The pixel ratio to use for over-sampling in cases of high-resolution displays
onSpaceCreated: {function(H.service.venues.Space)=} [optional]
A callback function that is called on every created space (see H.service.venues.Space) object. The
function can be used for space object styling.
Class: Venue
This class is a member of the namespace
H.service.venues .
Class Summary
Extends: H.map.Group
The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from
H.map.Group and holds building objects (see H.service.venues.Building). Building objects hold floor
objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces
(see H.service.venues.Space) that are spatial map objects and reside inside floor containers.
[ For full details, see the Class Details ]
Method Summary
Table 229: Methods
Methods
getBuilding (id) : {(H.service.venues.Building | undefined)}
Method returns the building object, that belongs to the venue, with the given ID . The method doesn't attempt to fetch
building data.
getBuildings () : {Object<*, H.service.venues.Building>}
Method returns map of all loaded buildings associated with the venue.
Maps API for JavaScript Developer's Guide
► API Reference
656
Class Description
The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from
H.map.Group and holds building objects (see H.service.venues.Building). Building objects hold floor
objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces
(see H.service.venues.Space) that are spatial map objects and reside inside floor containers.
Constructor Details
H.service.venues.Venue(provider, uid)
Parameters:
provider:
{H.map.provider.ObjectProvider}
The object provider of this venue
uid:
{string}
The unique identifier of this venue
Method Details
getBuilding (id) : {(H.service.venues.Building | undefined)}
Method returns the building object, that belongs to the venue, with the given ID . The method doesn't
attempt to fetch building data.
Parameters:
id:
{string}
the ID of the building
Returns:
{(H.service.venues.Building | undefined)}
The requested building or undefined if building wasn't loaded
getBuildings () : {Object<*, H.service.venues.Building>}
Method returns map of all loaded buildings associated with the venue.
Returns:
{Object<*, H.service.venues.Building>}
Maps API for JavaScript Developer's Guide
► API Reference
Namespace: ui
Namespace Summary
This namespace contains classes and functionality for UI elements.
Namespace Description
This namespace contains classes and functionality for UI elements.
Class: Control
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.base.Container
This class represents the base class for UI controls on the map.
[ For full details, see the Class Details ]
Method Summary
Table 230: Methods
Methods
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
657
Maps API for JavaScript Developer's Guide
► API Reference
658
Methods
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
659
Methods
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 231: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Class Description
This class represents the base class for UI controls on the map.
Constructor Details
H.ui.Control()
Method Details
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
engineType:
{H.Map.EngineType}
the engine type the map currently uses
660
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
Maps API for JavaScript Developer's Guide
► API Reference
661
|
|
|
|
|
^
|
^
^
|
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
Maps API for JavaScript Developer's Guide
► API Reference
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
662
Maps API for JavaScript Developer's Guide
► API Reference
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
663
Maps API for JavaScript Developer's Guide
► API Reference
664
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
Maps API for JavaScript Developer's Guide
► API Reference
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
665
Maps API for JavaScript Developer's Guide
► API Reference
666
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Class: DistanceMeasurement
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents a distance measurement control which helps calculating distances between
geographical locations indicated by the user clicks.
[ For full details, see the Class Details ]
Method Summary
Table 232: Methods
Methods
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Maps API for JavaScript Developer's Guide
► API Reference
667
Methods
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
Maps API for JavaScript Developer's Guide
► API Reference
668
Methods
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 233: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Class Description
This class represents a distance measurement control which helps calculating distances between
geographical locations indicated by the user clicks.
This control adds direct user-interaction to the map. The user can click on the map to specify the
locations and build a path length of which is measured. The locations are indicated by markers and
the path by lines connecting the markers.
A marker that has been added to the map in this way can be removed by holding down the ALT/CMD
key and clicking on the marker. The user can also split the line connecting two markers by clicking on
the line between the markers. Pass H.ui.DistanceMeasurement.Options to customize the icons of the
markers and the connecting lines.
When specifying custom icons for the markers, note that you might need to specify the
H.map.Icon.Options#anchor option in order to position the icon exactly on the position where user
clicked.
Example
var distanceMeasurementTool = new H.ui.DistanceMeasurement({
'startIcon': new H.map.Icon('[START ICON URL]'),
'stopoverIcon': new H.map.Icon('[STOPOVER ICON URL]'),
'endIcon': new H.map.Icon('[END ICON URL]'),
'splitIcon': new H.map.Icon('[SPLIT ICON URL]'),
'lineStyle': {
'strokeColor': 'rgba(18, 65, 145, .8)',
'lineWidth': 6
}
});
ui.addControl('distancemeasurement', distanceMeasurementTool);
Maps API for JavaScript Developer's Guide
► API Reference
669
Constructor Details
H.ui.DistanceMeasurement(opt_options)
Parameters:
opt_options:
{H.ui.DistanceMeasurement.Options=} [optional]
optional parameters to be passed to this control
Method Details
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
the engine type the map currently uses
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
670
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
Maps API for JavaScript Developer's Guide
► API Reference
671
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
672
Maps API for JavaScript Developer's Guide
► API Reference
673
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
Maps API for JavaScript Developer's Guide
► API Reference
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
674
Maps API for JavaScript Developer's Guide
► API Reference
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.DistanceMeasurement .
Type Definition Summary
[ For full details, see the Type Definition Details ]
675
Maps API for JavaScript Developer's Guide
► API Reference
676
Property Summary
Table 234: Properties
Properties
alignment
the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM
startIcon
the icon to use for the first measurement point
stopoverIcon
the icon to use for the intermediate measurement points
endIcon
the icon to use for the last measurement point
splitIcon
the icon to use for indicating position under pointer over the line where new point will be created once user clicks
lineStyle
the style to use for connecting lines of the measurement points
distanceFormatter
Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to
the specified measurement unit (see H.ui.UI.Options#unitSystem)
Type Definition Description
Property Details
alignment: {string=} [optional]
the layout alignment which should be applied to this control, default is
H.ui.LayoutAlignment.RIGHT_BOTTOM
startIcon: {H.map.Icon=} [optional]
the icon to use for the first measurement point
stopoverIcon: {H.map.Icon=} [optional]
the icon to use for the intermediate measurement points
endIcon: {H.map.Icon=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
677
the icon to use for the last measurement point
splitIcon: {H.map.Icon=} [optional]
the icon to use for indicating position under pointer over the line where new point will be created
once user clicks
lineStyle: {(H.map.SpatialStyle | H.map.SpatialStyle.Options)}
the style to use for connecting lines of the measurement points
distanceFormatter: {function(number)=} [optional]
Optional function used for formatting a distance. By default distance measurement tool will do the
formatting according to the specified measurement unit (see H.ui.UI.Options#unitSystem)
Class: InfoBubble
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.base.Element
This class represents an information bubble bound to a geo-position on the map.
[ For full details, see the Class Details ]
Method Summary
Table 235: Methods
Methods
dispose ()
Disposes of this InfoBubble instance.
setPosition (position)
This method sets the geo-position of this info bubble.
getState () : {H.ui.InfoBubble.State}
This method returns this info bubbles current state.
setState (state)
This method sets the info bubble's state.
close ()
Maps API for JavaScript Developer's Guide
► API Reference
678
Methods
This method closes the info bubble (setting its state to CLOSED)
open ()
This method opens the info bubble (setting its state to OPEN)
getContentElement () : {?HTMLElement}
This method returns the bubble's content element.
setContent (content)
This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element
of this info bubble or a HTML node which is appended to the content element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 236: Events
Events
statechange : {H.util.Event}
This event is dispatched when state of the bubble has changed
Class Description
This class represents an information bubble bound to a geo-position on the map.
Constructor Details
H.ui.InfoBubble(position, opt_options)
Parameters:
position:
{H.geo.IPoint}
the geo-position to which this info bubble corresponds
opt_options:
{H.ui.InfoBubble.Options=} [optional]
optional parameters to be passed to the info bubble
Method Details
dispose ()
Disposes of this InfoBubble instance.
Note: Disposing of an info bubble does not automatically remove it from the UI's info bubble
collection. Please call H.ui.UI#removeBubble before disposing of an info bubble instance.
setPosition (position)
This method sets the geo-position of this info bubble.
679
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
position:
{(H.geo.IPoint | H.geo.Point)}
the new geo-position of this bubble
680
getState () : {H.ui.InfoBubble.State}
This method returns this info bubbles current state.
Returns:
{H.ui.InfoBubble.State}
this bubble's current state
setState (state)
This method sets the info bubble's state.
Parameters:
state:
{H.ui.InfoBubble.State}
the new state
close ()
This method closes the info bubble (setting its state to CLOSED)
open ()
This method opens the info bubble (setting its state to OPEN)
getContentElement () : {?HTMLElement}
This method returns the bubble's content element.
Note: Before adding an info bubble to a UI object the content element is null.
Returns:
{?HTMLElement}
the content element of this info bubble
setContent (content)
This methods sets the content of the info bubble. This can either be a string (applied as innerHTML)
to the content element of this info bubble or a HTML node which is appended to the content element.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
content:
{(string | Node)}
the content for this bubble
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
681
Maps API for JavaScript Developer's Guide
► API Reference
682
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
683
Maps API for JavaScript Developer's Guide
► API Reference
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
statechange: {H.util.Event}
This event is dispatched when state of the bubble has changed
Type definition: Options
This type definition is a member of the class
H.ui.InfoBubble .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 237: Properties
Properties
onStateChange
684
Maps API for JavaScript Developer's Guide
► API Reference
Properties
a callback to be invoked when the info bubble's state changes
content
content to be added to the info bubble
Type Definition Description
Property Details
onStateChange: {function(H.util.Event)=} [optional]
a callback to be invoked when the info bubble's state changes
content: {(string | Node)}
content to be added to the info bubble
Enumeration: State
This enumeration is a member of the class
H.ui.InfoBubble .
Enumeration Summary
This enumeration holds the state an info bubble can have.
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 238: Constants
Constants
static
OPEN
This value represents the state where an info bubble is open and visible (value: 'open').
static
CLOSED
This value represents the state where an info bubble is closed and invisible (value: 'closed')
Enumeration Details
This enumeration holds the state an info bubble can have.
685
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration Constants Details
static OPEN
This value represents the state where an info bubble is open and visible (value: 'open').
static CLOSED
This value represents the state where an info bubble is closed and invisible (value: 'closed')
Enumeration: LayoutAlignment
This enumeration is a member of the namespace
H.ui .
Enumeration Summary
This enumeration holds the possible layout alignments for the UI elements.
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 239: Constants
Constants
static
TOP_LEFT
static
TOP_CENTER
static
TOP_RIGHT
static
LEFT_TOP
static
LEFT_MIDDLE
static
LEFT_BOTTOM
static
RIGHT_TOP
static
RIGHT_MIDDLE
static
RIGHT_BOTTOM
static
BOTTOM_LEFT
686
Maps API for JavaScript Developer's Guide
► API Reference
Constants
static
BOTTOM_CENTER
static
BOTTOM_RIGHT
Enumeration Details
This enumeration holds the possible layout alignments for the UI elements.
Enumeration Constants Details
static TOP_LEFT
static TOP_CENTER
static TOP_RIGHT
static LEFT_TOP
static LEFT_MIDDLE
static LEFT_BOTTOM
static RIGHT_TOP
static RIGHT_MIDDLE
static RIGHT_BOTTOM
static BOTTOM_LEFT
static BOTTOM_CENTER
static BOTTOM_RIGHT
Class: MapSettingsControl
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents a menu control allowing to control which map type the map shows, etc.
687
Maps API for JavaScript Developer's Guide
► API Reference
[ For full details, see the Class Details ]
Method Summary
Table 240: Methods
Methods
setIncidentsLayer (incidentsLayer)
Sets the traffic incidents layer to be shown when activating the respective button on the map settings control.
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
688
Maps API for JavaScript Developer's Guide
► API Reference
689
Methods
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 241: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Maps API for JavaScript Developer's Guide
► API Reference
690
Class Description
This class represents a menu control allowing to control which map type the map shows, etc.
Constructor Details
H.ui.MapSettingsControl(opt_options)
Parameters:
opt_options:
{H.ui.MapSettingsControl.Options=} [optional]
optional parameters to be passed to this control
Method Details
setIncidentsLayer (incidentsLayer)
Sets the traffic incidents layer to be shown when activating the respective button on the map
settings control.
Setting this layer to a falsy value will hide the button.
Parameters:
incidentsLayer:
{H.map.layer.Layer}
the incidents layer
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
Maps API for JavaScript Developer's Guide
► API Reference
691
the engine type the map currently uses
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
Maps API for JavaScript Developer's Guide
► API Reference
692
|
|
|
^
|
^
^
|
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
693
Maps API for JavaScript Developer's Guide
► API Reference
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
694
Maps API for JavaScript Developer's Guide
► API Reference
695
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Maps API for JavaScript Developer's Guide
► API Reference
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
696
Maps API for JavaScript Developer's Guide
► API Reference
697
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: MapTypeEntry
This type definition is a member of the class
H.ui.MapSettingsControl .
Type Definition Summary
The map type entry is an object containing a display name and a map type object to which it refers.
[ For full details, see the Type Definition Details ]
Property Summary
Table 242: Properties
Properties
name
label which describes the map type
mapType
reference to map type
Type Definition Description
The map type entry is an object containing a display name and a map type object to which it refers.
Property Details
name: {string}
label which describes the map type
mapType: {H.service.MapType}
reference to map type
Type definition: Options
This type definition is a member of the class
H.ui.MapSettingsControl .
Maps API for JavaScript Developer's Guide
► API Reference
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 243: Properties
Properties
alignment
the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT
entries
the map type entries to be shown in this map settings control
incidents
the traffic incidents layer to be activated by the map settings control
Type Definition Description
Property Details
alignment: {string=} [optional]
the layout alignment which should be applied to this control, default is
H.ui.LayoutAlignment.BOTTOM_RIGHT
entries: {Array<H.ui.MapSettingsControl.MapTypeEntry>=} [optional]
the map type entries to be shown in this map settings control
incidents: {H.map.layer.Layer}
the traffic incidents layer to be activated by the map settings control
Class: Overview
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents a small overview of the main map.
698
Maps API for JavaScript Developer's Guide
► API Reference
[ For full details, see the Class Details ]
Method Summary
Table 244: Methods
Methods
setBaseLayer (baseLayer) : {H.ui.Overview}
Method sets the base layer of the overview map.
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
699
Maps API for JavaScript Developer's Guide
► API Reference
700
Methods
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 245: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Maps API for JavaScript Developer's Guide
► API Reference
701
Class Description
This class represents a small overview of the main map.
Constructor Details
H.ui.Overview(baseLayer, opt_options)
Parameters:
baseLayer:
{H.map.layer.Layer}
the layer to be for display of overview map
opt_options:
{H.ui.Overview.Options=} [optional]
optional parameters to be passed to this control
Method Details
setBaseLayer (baseLayer) : {H.ui.Overview}
Method sets the base layer of the overview map.
Parameters:
baseLayer:
{H.map.layer.TileLayer}
Returns:
{H.ui.Overview}
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
Maps API for JavaScript Developer's Guide
► API Reference
702
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
the engine type the map currently uses
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
Maps API for JavaScript Developer's Guide
► API Reference
|
703
"lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
704
Maps API for JavaScript Developer's Guide
► API Reference
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
705
Maps API for JavaScript Developer's Guide
► API Reference
706
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
707
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
708
{H.ui.base.Element}
this UI element instance
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.Overview .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 246: Properties
Properties
alignment
the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM
zoomDelta
option defines delta between main map's zoom level and overview map's zoom level (defaults to 3)
scaleX
option defines the ratio between main map's view port width and overview map's width (defaults to 5 meaning overview
map's width is five times smaller)
scaleY
option defines the ratio between main map's view port height and overview map's height (defaults to 5 meaning overview
map's height is five times smaller)
Maps API for JavaScript Developer's Guide
► API Reference
709
Type Definition Description
Property Details
alignment: {string=} [optional]
the layout alignment which should be applied to this control, default is
H.ui.LayoutAlignment.RIGHT_BOTTOM
zoomDelta: {number=} [optional]
option defines delta between main map's zoom level and overview map's zoom level (defaults to 3)
scaleX: {number=} [optional]
option defines the ratio between main map's view port width and overview map's width (defaults to 5
meaning overview map's width is five times smaller)
scaleY: {number=} [optional]
option defines the ratio between main map's view port height and overview map's height (defaults to
5 meaning overview map's height is five times smaller)
Class: Pano
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents the UI controls for panorama
[ For full details, see the Class Details ]
Method Summary
Table 247: Methods
Methods
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
Maps API for JavaScript Developer's Guide
► API Reference
710
Methods
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 248: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Class Description
This class represents the UI controls for panorama
Constructor Details
H.ui.Pano(opt_options)
Parameters:
opt_options:
{H.ui.Pano.Options=} [optional]
optional parameters to be passed to the map.
Method Details
onUnitSystemChange (unitSystem)
711
Maps API for JavaScript Developer's Guide
► API Reference
712
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
the engine type the map currently uses
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
Maps API for JavaScript Developer's Guide
► API Reference
713
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
Maps API for JavaScript Developer's Guide
► API Reference
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
714
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
715
Maps API for JavaScript Developer's Guide
► API Reference
716
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
Maps API for JavaScript Developer's Guide
► API Reference
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
717
Maps API for JavaScript Developer's Guide
► API Reference
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.Pano .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 249: Properties
Properties
alignment
the preferred layout alignment for this control
mapTypes
The map types to use
Type Definition Description
Property Details
alignment: {H.ui.LayoutAlignment}
718
Maps API for JavaScript Developer's Guide
► API Reference
the preferred layout alignment for this control
mapTypes: {H.service.MapTypes}
The map types to use
Class: ScaleBar
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents a UI element showing the current zoom scale.
[ For full details, see the Class Details ]
Method Summary
Table 250: Methods
Methods
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
719
Maps API for JavaScript Developer's Guide
► API Reference
720
Methods
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Maps API for JavaScript Developer's Guide
► API Reference
721
Events Summary
Table 251: Events
Events
toggleunitsystem : {H.util.Event}
This event is fired when unit system is changed
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Class Description
This class represents a UI element showing the current zoom scale.
Constructor Details
H.ui.ScaleBar(opt_options)
Parameters:
opt_options:
{H.ui.ScaleBar.Options=} [optional]
optional parameters to be passed to this scale bar.
Method Details
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
engineType:
{H.Map.EngineType}
the engine type the map currently uses
722
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
Maps API for JavaScript Developer's Guide
► API Reference
723
|
|
|
|
|
^
|
^
^
|
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
Maps API for JavaScript Developer's Guide
► API Reference
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
724
Maps API for JavaScript Developer's Guide
► API Reference
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
725
Maps API for JavaScript Developer's Guide
► API Reference
726
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
Maps API for JavaScript Developer's Guide
► API Reference
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
727
Maps API for JavaScript Developer's Guide
► API Reference
Event Details
toggleunitsystem: {H.util.Event}
This event is fired when unit system is changed
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.ScaleBar .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 252: Properties
Properties
alignment
the preferred layout alignment for this control, default is "bottom-right"
Type Definition Description
Property Details
alignment: {string=} [optional]
the preferred layout alignment for this control, default is "bottom-right"
Class: UI
This class is a member of the namespace
H.ui .
Class Summary
Implements: H.util.ICapturable
This class encapsulates map UI functionality.
728
Maps API for JavaScript Developer's Guide
► API Reference
729
[ For full details, see the Class Details ]
Method Summary
Table 253: Methods
Methods
getElement () : {Element}
This method returns this ui's root element.
getMap () : {H.Map}
Returns the map instance to which this UI was added.
getUnitSystem () : {H.ui.UnitSystem}
This method returns this UI object's current unit system.
setUnitSystem (unitSystem)
This method sets this UI object's unit system for displaying distances.
toggleUnitSystem ()
Toggles this UI's unit system between H.ui.UnitSystem.METRIC and H.ui.UnitSystem.IMPERIAL.
addBubble (bubble)
This method adds an info bubble to the UI.
removeBubble (bubble)
This method removes a previously added info bubble from the UI.
getBubbles () : {Array<H.ui.InfoBubble>}
This method returns a list of info bubble objects which are currently attached to this UI.
addControl (name, control)
This method appends a control to the UI.
removeControl (name) : {H.ui.Control}
Removes a previously registered control from the UI object.
getControl (name) : {H.ui.Control}
This method returns a UI control which was previously registered with the provided name.
static
createDefault (map, mapTypes, opt_locale) : {H.ui.UI}
This function creates the default UI including the zoom control, map settings control and scalebar and panorama discovery
control. The default controls will be assigned the following values:
Maps API for JavaScript Developer's Guide
► API Reference
Class Description
This class encapsulates map UI functionality.
Constructor Details
H.ui.UI(map, opt_options)
Parameters:
map:
{H.Map}
opt_options:
{H.ui.UI.Options=} [optional]
Method Details
getElement () : {Element}
This method returns this ui's root element.
Returns:
{Element}
the root element
getMap () : {H.Map}
Returns the map instance to which this UI was added.
Returns:
{H.Map}
getUnitSystem () : {H.ui.UnitSystem}
This method returns this UI object's current unit system.
Returns:
{H.ui.UnitSystem}
the current unit system
setUnitSystem (unitSystem)
730
Maps API for JavaScript Developer's Guide
► API Reference
This method sets this UI object's unit system for displaying distances.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system to use
toggleUnitSystem ()
Toggles this UI's unit system between H.ui.UnitSystem.METRIC and H.ui.UnitSystem.IMPERIAL.
addBubble (bubble)
This method adds an info bubble to the UI.
Parameters:
bubble:
{H.ui.InfoBubble}
the info bubble to be added
removeBubble (bubble)
This method removes a previously added info bubble from the UI.
Parameters:
bubble:
{H.ui.InfoBubble}
the info bubble to be removed
getBubbles () : {Array<H.ui.InfoBubble>}
This method returns a list of info bubble objects which are currently attached to this UI.
Returns:
{Array<H.ui.InfoBubble>}
the list of info bubbles
addControl (name, control)
This method appends a control to the UI.
Parameters:
name:
{string}
the name under which to register this control
731
Maps API for JavaScript Developer's Guide
► API Reference
control:
{H.ui.Control}
the control to add to this UI
732
removeControl (name) : {H.ui.Control}
Removes a previously registered control from the UI object.
Parameters:
name:
{string}
the name under which this control was previously registered
Returns:
{H.ui.Control}
the removed control
getControl (name) : {H.ui.Control}
This method returns a UI control which was previously registered with the provided name.
Parameters:
name:
{string}
the name under which the control was registered.
Returns:
{H.ui.Control}
the control or undefined if the control does not exist.
static
createDefault (map, mapTypes, opt_locale) : {H.ui.UI}
This function creates the default UI including the zoom control, map settings control and scalebar
and panorama discovery control. The default controls will be assigned the following values:
•
Zoom control:
•
id: 'zoom'
◦
alignment: 'right-middle'
◦
Map settings control:
•
id: 'mapsettings'
◦
alignment: 'bottom-right'
◦
Scalebar:
Maps API for JavaScript Developer's Guide
► API Reference
◦
•
id: 'scalebar'
alignment: 'bottom-right'
◦
Pano:
◦
◦
id: 'panorama'
alignment: 'top-right'
Parameters:
map:
{H.Map}
The map instance to which to append the UI
mapTypes:
{Object<H.service.MapType>}
The map types to use
opt_locale:
{(H.ui.i18n.Localization | string=)}
the language to use (or a full localization object).
Returns:
{H.ui.UI}
the UI instance configured with the default controls
Type definition: Options
This type definition is a member of the class
H.ui.UI .
Type Definition Summary
Optional parameters to be passed to the UI constructor.
[ For full details, see the Type Definition Details ]
Property Summary
Table 254: Properties
Properties
unitSystem
An optional unit system to be used by the UI, default is H.ui.UnitSystem.METRIC
zoom
733
Maps API for JavaScript Developer's Guide
► API Reference
734
Properties
zoomrectangle
mapsettings
scalebar
panorama
distancemeasurement
locale
defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map,
or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zhCN'. If not defined ui will use 'en-US' by default
Type Definition Description
Optional parameters to be passed to the UI constructor.
Property Details
unitSystem: {H.ui.UnitSystem=} [optional]
An optional unit system to be used by the UI, default is H.ui.UnitSystem.METRIC
zoom: {(H.ui.ZoomControl.Options | boolean)=} [optional]
zoomrectangle: {(H.ui.ZoomRectangle.Options | boolean)=} [optional]
mapsettings: {(H.ui.MapSettingsControl.Options | boolean)=} [optional]
scalebar: {(H.ui.ScaleBar.Options | boolean)=} [optional]
panorama: {(H.ui.Pano.Options | boolean)=} [optional]
distancemeasurement: {(H.ui.DistanceMeasurement.Options | boolean)=}
[optional]
locale: {(H.ui.i18n.Localization | string)=} [optional]
defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with
custom translation map, or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nlNL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' by default
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration: UnitSystem
This enumeration is a member of the namespace
H.ui .
Enumeration Summary
This enumeration holds the possible unit systems for the UI to display distances.
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 255: Constants
Constants
static
IMPERIAL
This value represents the imperial unit system using miles and feet (value: 'imperial').
static
METRIC
This value represents the metric unit system using meters and kilometers, etc (value: 'metric').
Enumeration Details
This enumeration holds the possible unit systems for the UI to display distances.
Enumeration Constants Details
static IMPERIAL
This value represents the imperial unit system using miles and feet (value: 'imperial').
static METRIC
This value represents the metric unit system using meters and kilometers, etc (value: 'metric').
Class: ZoomControl
This class is a member of the namespace
Class Summary
Extends: H.ui.Control
H.ui .
735
Maps API for JavaScript Developer's Guide
► API Reference
This class represents the UI controls for zooming in an out of the map.
[ For full details, see the Class Details ]
Method Summary
Table 256: Methods
Methods
getZoomSpeed () : {number}
This method returns the zoom speed (in levels per millisecond) which is applied when the button is pressed constantly.
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
736
Maps API for JavaScript Developer's Guide
► API Reference
737
Methods
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 257: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Maps API for JavaScript Developer's Guide
► API Reference
738
Class Description
This class represents the UI controls for zooming in an out of the map.
Constructor Details
H.ui.ZoomControl(opt_options)
Parameters:
opt_options:
{H.ui.ZoomControl.Options=} [optional]
optional parameters to be passed to the map.
Method Details
getZoomSpeed () : {number}
This method returns the zoom speed (in levels per millisecond) which is applied when the button is
pressed constantly.
Returns:
{number}
the current zoom speed
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
the engine type the map currently uses
Maps API for JavaScript Developer's Guide
► API Reference
739
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
| "lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
|
|
Maps API for JavaScript Developer's Guide
► API Reference
|
^
|
^
^
740
|
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
741
Maps API for JavaScript Developer's Guide
► API Reference
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
742
Maps API for JavaScript Developer's Guide
► API Reference
743
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
744
Maps API for JavaScript Developer's Guide
► API Reference
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.ZoomControl .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 258: Properties
Properties
zoomSpeed
the speed if zooming in and out in levels per millisecond, defaults to 0.05
alignment
the layout alignment which should be applied to this control, defaults to H.ui.LayoutAlignment.RIGHT_MIDDLE
slider
flag whether to show the slider (true) or not, defaults to false
sliderSnaps
flag whether slider should snap to the integer values or not, defaults to false. This option has effect only if slider is
enabled.
Type Definition Description
Property Details
zoomSpeed: {number=} [optional]
the speed if zooming in and out in levels per millisecond, defaults to 0.05
alignment: {string=} [optional]
the layout alignment which should be applied to this control, defaults to
H.ui.LayoutAlignment.RIGHT_MIDDLE
745
Maps API for JavaScript Developer's Guide
► API Reference
746
slider: {boolean=} [optional]
flag whether to show the slider (true) or not, defaults to false
sliderSnaps: {boolean=} [optional]
flag whether slider should snap to the integer values or not, defaults to false. This option has effect
only if slider is enabled.
Class: ZoomRectangle
This class is a member of the namespace
H.ui .
Class Summary
Extends: H.ui.Control
This class represents a zoom rectangle control element that allows zooming to the selected area on
the screen.
[ For full details, see the Class Details ]
Method Summary
Table 259: Methods
Methods
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes.
onMapEngineTypeChange (engineType)
This abstract method can be overridden by deriving classes to be invoked when the underlying map engine changes.
getMap () : {?H.Map}
This method returns the map to which this control is attached.
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
Maps API for JavaScript Developer's Guide
► API Reference
747
Methods
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
Maps API for JavaScript Developer's Guide
► API Reference
748
Methods
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 260: Events
Events
alignmentchange : {H.util.Event}
This event is fired when control is realigned
Class Description
This class represents a zoom rectangle control element that allows zooming to the selected area on
the screen.
Constructor Details
H.ui.ZoomRectangle(opt_options)
Parameters:
opt_options:
{H.ui.ZoomRectangle.Options=} [optional]
optional parameters to be passed to this control
Method Details
onUnitSystemChange (unitSystem)
This abstract method can be overridden by deriving classes to be invoked when the UI object's unit
system changes.
Parameters:
unitSystem:
{H.ui.UnitSystem}
the unit system the UI currently uses
onMapEngineTypeChange (engineType)
Maps API for JavaScript Developer's Guide
► API Reference
749
This abstract method can be overridden by deriving classes to be invoked when the underlying map
engine changes.
Parameters:
engineType:
{H.Map.EngineType}
the engine type the map currently uses
getMap () : {?H.Map}
This method returns the map to which this control is attached.
Note: Before adding a control to a UI object this method returns null.
Returns:
{?H.Map}
return the map
getLocalization () : {H.ui.i18n.Localization}
This method returns the localization object which corresponds to the UI's current locale.
Returns:
{H.ui.i18n.Localization}
getAlignment () : {H.ui.LayoutAlignment}
This method returns this control's layout alignment.
Returns:
{H.ui.LayoutAlignment}
the control's current layout alignment
setAlignment (alignment) : {H.ui.Control}
This method sets the control's layout alignments.
The possible alignments are as follows within the map view port:
+-------------------------------------------------------------------------------+
| "top-left" > >
< < "top-center" > >
< < "topright" |
Maps API for JavaScript Developer's Guide
► API Reference
|
750
"lef-ttop"
"right-top" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-middle"
"rightmiddle" |
| v
v |
| v
v |
|
|
|
|
| ^
^ |
| ^
^ |
| "left-bottom"
"rightbottom" |
| "bottom-left" > >
< < "bottom-center" > >
< < "bottomright" |
+-------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows (see the
illustration above).
Parameters:
alignment:
{H.ui.LayoutAlignment}
The new alignment of the control
Returns:
{H.ui.Control}
returns this control instance
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
751
Maps API for JavaScript Developer's Guide
► API Reference
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
752
Maps API for JavaScript Developer's Guide
► API Reference
753
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
754
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
alignmentchange: {H.util.Event}
This event is fired when control is realigned
Type definition: Options
This type definition is a member of the class
H.ui.ZoomRectangle .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 261: Properties
Properties
alignment
the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT
adjustZoom
optional function that defines how zoom level should be changed, by default zoom level is picked to fit the bounding
rectangle into the view port.
Type Definition Description
Property Details
alignment: {string=} [optional]
the layout alignment which should be applied to this control, default is
H.ui.LayoutAlignment.BOTTOM_RIGHT
adjustZoom: {function(number, H.Map) : number=}
755
Maps API for JavaScript Developer's Guide
► API Reference
756
optional function that defines how zoom level should be changed, by default zoom level is picked to
fit the bounding rectangle into the view port.
Namespace: base
Namespace Summary
This namespace contains basic UI elements from which the UI controls are built.
Namespace Description
This namespace contains basic UI elements from which the UI controls are built.
Class: Button
This class is a member of the namespace
H.ui.base .
Class Summary
Extends: H.ui.base.Element
This class represents a button.
[ For full details, see the Class Details ]
Method Summary
Table 262: Methods
Methods
getState () : {H.ui.base.Button.State}
This method returns the current state of the button.
setState (state, opt_suppressEvent) : {H.ui.base.Button}
This method sets the state of this button.
getLabel () : {string}
This method returns the label string of this button.
setLabel (label, opt_force) : {H.ui.base.Button}
This method sets the label string of this button.
dispose ()
Maps API for JavaScript Developer's Guide
► API Reference
757
Methods
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Maps API for JavaScript Developer's Guide
► API Reference
Events Summary
Table 263: Events
Events
statechange : {H.util.Event}
This event is dispatched by the button when it's state changes.
Class Description
This class represents a button.
Constructor Details
H.ui.base.Button(opt_options)
Parameters:
opt_options:
{H.ui.base.Button.Options=} [optional]
optional parameters to be passed to the button instance
Method Details
getState () : {H.ui.base.Button.State}
This method returns the current state of the button.
Returns:
{H.ui.base.Button.State}
the current state of the button
setState (state, opt_suppressEvent) : {H.ui.base.Button}
This method sets the state of this button.
Parameters:
state:
{H.ui.base.Button.State}
the state to which this button is to be set
opt_suppressEvent: {boolean=} [optional]
758
Maps API for JavaScript Developer's Guide
► API Reference
759
an optional flag indicating that the onStateChange callback is not to be invoked
Returns:
{H.ui.base.Button}
this button instance
getLabel () : {string}
This method returns the label string of this button.
Returns:
{string}
the label string of this button
setLabel (label, opt_force) : {H.ui.base.Button}
This method sets the label string of this button.
Parameters:
label:
{string}
the label to set on this button
opt_force:
{boolean=} [optional]
a boolean flag indicating that the new label should be set and propagated
even if it has the same value as the current one.
Returns:
{H.ui.base.Button}
this button instance
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
760
Maps API for JavaScript Developer's Guide
► API Reference
761
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
Maps API for JavaScript Developer's Guide
► API Reference
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
762
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
statechange: {H.util.Event}
This event is dispatched by the button when it's state changes.
Type definition: Options
This type definition is a member of the class
H.ui.base.Button .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 264: Properties
Properties
disabled
A flag to indicate whether this button is disabled, default is false
label
The markup (used as innerHTML) to be rendered into this button
onStateChange
A event listener for the onstatechange event to be immediately added
data
An arbitrary data object to be stored with this button
763
Maps API for JavaScript Developer's Guide
► API Reference
Type Definition Description
Property Details
disabled: {boolean=} [optional]
A flag to indicate whether this button is disabled, default is false
label: {string=} [optional]
The markup (used as innerHTML) to be rendered into this button
onStateChange: {function(H.util.Event)=} [optional]
A event listener for the onstatechange event to be immediately added
data: {*}
An arbitrary data object to be stored with this button
Enumeration: State
This enumeration is a member of the class
H.ui.base.Button .
Enumeration Summary
This enumeration represents the possible state a button can have, namely 'UP' and 'DOWN'
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 265: Constants
Constants
static
UP
The button's state when it is not pressed. ('up')
static
DOWN
The button's state when it is pressed. ('down')
Enumeration Details
This enumeration represents the possible state a button can have, namely 'UP' and 'DOWN'
764
Maps API for JavaScript Developer's Guide
► API Reference
Enumeration Constants Details
static UP
The button's state when it is not pressed. ('up')
static DOWN
The button's state when it is pressed. ('down')
Class: Container
This class is a member of the namespace
H.ui.base .
Class Summary
Extends: H.ui.base.Element
This class represents an abstract base class for container UI elements such as Lists and Panels.
[ For full details, see the Class Details ]
Method Summary
Table 266: Methods
Methods
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
765
Maps API for JavaScript Developer's Guide
► API Reference
766
Methods
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Class Description
This class represents an abstract base class for container UI elements such as Lists and Panels.
Constructor Details
H.ui.base.Container(opt_elementType, opt_className, opt_children)
Parameters:
opt_elementType:
{string=} [optional]
the type of HTML element this UI element renders as, default is 'div'
Maps API for JavaScript Developer's Guide
► API Reference
opt_className:
{string=} [optional]
an optional class name to be used on this element
opt_children:
{Array<H.ui.base.Element>=} [optional]
optional child elements to be added to this container
Method Details
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
767
Maps API for JavaScript Developer's Guide
► API Reference
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
768
Maps API for JavaScript Developer's Guide
► API Reference
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
769
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
770
Maps API for JavaScript Developer's Guide
► API Reference
771
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Class: Element
This class is a member of the namespace
H.ui.base .
Class Summary
This class represents the base class of UI elements such as Buttons, ListEntries, etc.
[ For full details, see the Class Details ]
Method Summary
Table 267: Methods
Methods
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
Maps API for JavaScript Developer's Guide
► API Reference
Methods
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Class Description
This class represents the base class of UI elements such as Buttons, ListEntries, etc.
Constructor Details
H.ui.base.Element(opt_elementType, opt_className)
Parameters:
opt_elementType:
{string=} [optional]
the type of HTML element this UI element renders as, default is 'div'
opt_className:
{string=} [optional]
an optional class name to be used on this element
772
Maps API for JavaScript Developer's Guide
► API Reference
Method Details
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
773
Maps API for JavaScript Developer's Guide
► API Reference
774
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
775
Maps API for JavaScript Developer's Guide
► API Reference
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Class: OverlayPanel
This class is a member of the namespace
H.ui.base .
Class Summary
Extends: H.ui.base.Container
This class represents a panel that points to a control.
[ For full details, see the Class Details ]
Method Summary
Table 268: Methods
Methods
setState (state, opt_force) : {H.ui.base.OverlayPanel}
This method sets the state of this panel.
getState () : {H.ui.base.OverlayPanel.State}
776
Maps API for JavaScript Developer's Guide
► API Reference
777
Methods
This method returns the current state of the panel.
pointToControl (control)
This method adjusts the alignment of the overlay panel to point to the provided control.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
Maps API for JavaScript Developer's Guide
► API Reference
778
Methods
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Class Description
This class represents a panel that points to a control.
Constructor Details
H.ui.base.OverlayPanel()
Method Details
setState (state, opt_force) : {H.ui.base.OverlayPanel}
This method sets the state of this panel.
Parameters:
state:
{H.ui.base.OverlayPanel.State}
the state of this panel
opt_force:
{boolean=} [optional]
a boolean value indicating that the value should be propagated even if it is
the same as the current value
Returns:
{H.ui.base.OverlayPanel}
this panel instance
getState () : {H.ui.base.OverlayPanel.State}
This method returns the current state of the panel.
Returns:
Maps API for JavaScript Developer's Guide
► API Reference
{H.ui.base.OverlayPanel.State}
pointToControl (control)
This method adjusts the alignment of the overlay panel to point to the provided control.
Parameters:
control:
{H.ui.Control}
the control to which to point
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
779
Maps API for JavaScript Developer's Guide
► API Reference
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
780
Maps API for JavaScript Developer's Guide
► API Reference
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
781
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
Maps API for JavaScript Developer's Guide
► API Reference
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
782
Maps API for JavaScript Developer's Guide
► API Reference
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Enumeration: State
This enumeration is a member of the class
H.ui.base.OverlayPanel .
Enumeration Summary
[ For full details, see the Enumeration Details ]
Enumeration Constants Summary
Table 269: Constants
Constants
static
OPEN
Defines a state where the OverlayPanel is open and visible
static
CLOSED
Defines a state where the OverlayPanel is closed and invisible
Enumeration Details
Enumeration Constants Details
static OPEN
783
Maps API for JavaScript Developer's Guide
► API Reference
784
Defines a state where the OverlayPanel is open and visible
static CLOSED
Defines a state where the OverlayPanel is closed and invisible
Class: PushButton
This class is a member of the namespace
H.ui.base .
Class Summary
Extends: H.ui.base.Button
This class represents a button, which will keep its state when pressed. Pressing once will change this
button's state to down. Pressing it again will change the button's state to up.
[ For full details, see the Class Details ]
Method Summary
Table 270: Methods
Methods
toggleState () : {H.ui.base.PushButton}
This method toggles this button's state between the two possible button states (see H.ui.base.Button.State).
getState () : {H.ui.base.Button.State}
This method returns the current state of the button.
setState (state, opt_suppressEvent) : {H.ui.base.Button}
This method sets the state of this button.
getLabel () : {string}
This method returns the label string of this button.
setLabel (label, opt_force) : {H.ui.base.Button}
This method sets the label string of this button.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
Maps API for JavaScript Developer's Guide
► API Reference
785
Methods
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 271: Events
Events
statechange : {H.util.Event}
This event is dispatched by the button when it's state changes.
Maps API for JavaScript Developer's Guide
► API Reference
786
Class Description
This class represents a button, which will keep its state when pressed. Pressing once will change this
button's state to down. Pressing it again will change the button's state to up.
Constructor Details
H.ui.base.PushButton(opt_options)
Parameters:
opt_options:
{H.ui.base.Button.Options=} [optional]
optional parameters to be passed to this button instance.
Method Details
toggleState () : {H.ui.base.PushButton}
This method toggles this button's state between the two possible button states (see
H.ui.base.Button.State).
Returns:
{H.ui.base.PushButton}
this button instance
getState () : {H.ui.base.Button.State}
This method returns the current state of the button.
Returns:
{H.ui.base.Button.State}
the current state of the button
setState (state, opt_suppressEvent) : {H.ui.base.Button}
This method sets the state of this button.
Parameters:
state:
{H.ui.base.Button.State}
the state to which this button is to be set
opt_suppressEvent: {boolean=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
787
an optional flag indicating that the onStateChange callback is not to be invoked
Returns:
{H.ui.base.Button}
this button instance
getLabel () : {string}
This method returns the label string of this button.
Returns:
{string}
the label string of this button
setLabel (label, opt_force) : {H.ui.base.Button}
This method sets the label string of this button.
Parameters:
label:
{string}
the label to set on this button
opt_force:
{boolean=} [optional]
a boolean flag indicating that the new label should be set and propagated
even if it has the same value as the current one.
Returns:
{H.ui.base.Button}
this button instance
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
788
Maps API for JavaScript Developer's Guide
► API Reference
789
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
Maps API for JavaScript Developer's Guide
► API Reference
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
790
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
statechange: {H.util.Event}
This event is dispatched by the button when it's state changes.
Class: RadioGroup
This class is a member of the namespace
H.ui.base .
Class Summary
Extends: H.ui.base.Container
This class represents a group of push buttons of which only one can be active at a time.
[ For full details, see the Class Details ]
Method Summary
Table 272: Methods
Methods
setTitle (title, opt_force) : {H.ui.base.RadioGroup}
This method set the title of this group.
getTitle () : {string}
This method returns the current title string of this group.
addButton (button) : {H.ui.base.RadioGroup}
This method adds an button element to this group.
removeButton (button) : {H.ui.base.RadioGroup}
791
Maps API for JavaScript Developer's Guide
► API Reference
792
Methods
This method removes an button element from this group.
getButtons () : {Array<H.ui.base.PushButton>}
This method returns the buttons currently registered with this group.
setActiveButton (button, opt_suppressEvent)
This method sets the active button of this radio group.
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
removeChild (child)
Removes a child element from this container's child collection.
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the pre-rendered HTML element which
may be modified by deriving classes.
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
getData () : {*}
This method returns a previously stored arbitrary data from this element.
setData (data)
This method stores arbitrary data with this UI element.
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Maps API for JavaScript Developer's Guide
► API Reference
Methods
setVisibility (visibility)
Sets the visibility of this element.
getVisibility () : {boolean}
Returns the visibility of this element.
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Events Summary
Table 273: Events
Events
activebuttonchange : {H.util.Event}
This event is fired when a radio button becomes active.
statechange : {H.util.Event}
This event is fired when RadioGroup's state is modified.
Class Description
This class represents a group of push buttons of which only one can be active at a time.
Constructor Details
H.ui.base.RadioGroup(opt_options)
Parameters:
opt_options:
{H.ui.base.RadioGroup.Options=} [optional]
optional parameters to be passed to the group
Method Details
setTitle (title, opt_force) : {H.ui.base.RadioGroup}
This method set the title of this group.
793
Maps API for JavaScript Developer's Guide
► API Reference
794
Parameters:
title:
{string}
the new title of this group
opt_force:
{boolean=} [optional]
an optional flag indicating that the new value is to be updated and propagated even if it has the same value as the current title
Returns:
{H.ui.base.RadioGroup}
this group instance
getTitle () : {string}
This method returns the current title string of this group.
Returns:
{string}
the current title
addButton (button) : {H.ui.base.RadioGroup}
This method adds an button element to this group.
Parameters:
button:
{H.ui.base.PushButton}
the button to add
Returns:
{H.ui.base.RadioGroup}
this group instance
removeButton (button) : {H.ui.base.RadioGroup}
This method removes an button element from this group.
Parameters:
button:
{H.ui.base.PushButton}
Maps API for JavaScript Developer's Guide
► API Reference
the button to remove
Returns:
795
{H.ui.base.RadioGroup}
this group instance
getButtons () : {Array<H.ui.base.PushButton>}
This method returns the buttons currently registered with this group.
Returns:
{Array<H.ui.base.PushButton>}
the buttons
setActiveButton (button, opt_suppressEvent)
This method sets the active button of this radio group.
Parameters:
button:
{H.ui.base.PushButton}
the button to be made the active one
opt_suppressEvent: {boolean=} [optional]
an optional boolean flag indicating that no statechange event is to be fired
addChild (child) : {H.ui.base.Container}
Adds a child element to be rendered within the container element.
Parameters:
child:
{H.ui.base.Element}
the child element to be added
Returns:
{H.ui.base.Container}
this container instance
getChildren () : {Array<H.ui.base.Element>}
Returns the child collection of this container.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{Array<H.ui.base.Element>}
the children of this container
removeChild (child)
Removes a child element from this container's child collection.
Parameters:
child:
{H.ui.base.Element}
the child element to be removed
dispose ()
This method disposes of the element.
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
796
Maps API for JavaScript Developer's Guide
► API Reference
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
797
renderInternal (element, doc)
This method is the concrete implementation of the UI element. This method receives the prerendered HTML element which may be modified by deriving classes.
Parameters:
element:
{Element}
this UI element's HTML representation
doc:
{Document}
the HTML document into which the element is currently being rendered
isDisabled () : {boolean}
This method returns this UI element's disabled state as a boolean value.
Returns:
{boolean}
true if the element is disabled, false otherwise
setDisabled (disabled, opt_force) : {H.ui.base.Element}
This method set's the disabled state of this UI element.
Parameters:
disabled:
{boolean}
true to disabled the element, false to enabled it
opt_force:
{boolean=} [optional]
an optional boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{H.ui.base.Element}
this element instance
getData () : {*}
This method returns a previously stored arbitrary data from this element.
Returns:
{*}
the previously stored data object or null if not data was stored.
setData (data)
This method stores arbitrary data with this UI element.
Parameters:
data:
{*}
the data to be stored
getElement () : {?HTMLElement}
This method returns the HTML element this UI element renders.
Note: Before the UI element was rendered the method returns null.
Returns:
{?HTMLElement}
the element
setVisibility (visibility)
Sets the visibility of this element.
Parameters:
visibility:
{boolean}
getVisibility () : {boolean}
Returns the visibility of this element.
798
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{boolean}
visibility
addClass (className) : {H.ui.base.Element}
This method adds a CSS class to this UI element (if it is not already present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
removeClass (className) : {H.ui.base.Element}
This method removes a CSS class from this UI element (if it is present).
Parameters:
className:
{string}
the CSS class name to add
Returns:
{H.ui.base.Element}
this UI element instance
Event Details
activebuttonchange: {H.util.Event}
This event is fired when a radio button becomes active.
statechange: {H.util.Event}
This event is fired when RadioGroup's state is modified.
799
Maps API for JavaScript Developer's Guide
► API Reference
Type definition: Options
This type definition is a member of the class
H.ui.base.RadioGroup .
Type Definition Summary
[ For full details, see the Type Definition Details ]
Property Summary
Table 274: Properties
Properties
title
an optional title string for this group
buttons
an optional set of button options to be added to this group
Type Definition Description
Property Details
title: {string=} [optional]
an optional title string for this group
buttons: {Array<H.ui.base.Button.Options>=} [optional]
an optional set of button options to be added to this group
Namespace: i18n
Namespace Summary
Namespace contaisn functionality related to internationalization.
800
Maps API for JavaScript Developer's Guide
► API Reference
801
Property Summary
Table 275: Properties
Properties
static
defaultLocales : {Array<string>}
Default available locales. UI provides default translations for this set of locale codes.
Namespace Description
Namespace contaisn functionality related to internationalization.
Property Details
static defaultLocales: {Array<string>}
Default available locales. UI provides default translations for this set of locale codes.
Class: Localization
This class is a member of the namespace
H.ui.i18n .
Class Summary
This class is used for internationalization of UI components.
[ For full details, see the Class Details ]
Method Summary
Table 276: Methods
Methods
getLocale () : {string}
This method returns current locale code i.e 'en-US'
getKeys () : {Array<string>}
This method returns translation keys for current locale. Keys from this set can be used to get translations via translate
method.
hasKey (key) : {boolean}
This method returns a boolean value indicating whether this localization object has a translation for the specified translation
key.
Maps API for JavaScript Developer's Guide
► API Reference
802
Methods
translate (key) : {string}
This method returns translation for provided key. It throws exception if translation is not available
Class Description
This class is used for internationalization of UI components.
Constructor Details
H.ui.i18n.Localization(locale, opt_translationMap)
Parameters:
locale:
{string}
locale code i.e en-GB
opt_translationMap:{Object=} [optional]
optional translation map for this locale if not provided Locale will be initialized with default translations if available
Method Details
getLocale () : {string}
This method returns current locale code i.e 'en-US'
Returns:
{string}
locale code
getKeys () : {Array<string>}
This method returns translation keys for current locale. Keys from this set can be used to get
translations via translate method.
Returns:
{Array<string>}
hasKey (key) : {boolean}
Maps API for JavaScript Developer's Guide
► API Reference
803
This method returns a boolean value indicating whether this localization object has a translation for
the specified translation key.
Parameters:
key:
{string}
a transaltion key
Returns:
{boolean}
true if the key exists, otherwise false.
translate (key) : {string}
This method returns translation for provided key. It throws exception if translation is not available
Parameters:
key:
{string}
a translation key
Returns:
{string}
a localized string corresponding to provided key
Namespace: util
Namespace Summary
This namespace contains utility implementations.
Namespace Description
This namespace contains utility implementations.
Class: Cache
This class is a member of the namespace
H.util .
Maps API for JavaScript Developer's Guide
► API Reference
804
Class Summary
Implements: H.util.ICache
The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until
the cache's content exceeds a maximum size. Once the size of all content elements exceeds the
maximum size the cache will drop the least recently retrieved elements until the size of the cache is
within the bounds of its maximum size. Data elements are always associated with an identifier that
allow to retrieve them at a later stage and their content size.
[ For full details, see the Class Details ]
Method Summary
Table 277: Methods
Methods
setMaxSize (maxSize) : {H.util.Cache}
This method sets this cache's maximum size to a new size. If the cache's contents exceed the new size, least recently used
data elements will be dropped.
getMaxSize () : {number}
This method returns the maximum size of this cache.
getCurrentSize () : {number}
This method returns the current size of this cache.
add (id, data, size) : {boolean}
This method adds an element to the cache.
get (id, opt_noUpdate) : {*}
This method retrieves an element from the cache.
drop (id)
This method explicitly drops an element from the cache.
forEach (callback, opt_ctx, opt_matcher)
This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is
passed to this method the callback will only be executed on those entries for which the predicated returns true.
removeAll (opt_matcher)
This method removes all data elements from the cache. If the optional match predicate is passed to this method only those
data elements will be removed for which the predicate return true.
Maps API for JavaScript Developer's Guide
► API Reference
805
Class Description
The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until
the cache's content exceeds a maximum size. Once the size of all content elements exceeds the
maximum size the cache will drop the least recently retrieved elements until the size of the cache is
within the bounds of its maximum size. Data elements are always associated with an identifier that
allow to retrieve them at a later stage and their content size.
Constructor Details
H.util.Cache(maxSize, opt_onDrop, opt_filter)
Parameters:
maxSize:
{number}
the maximum size of the cache
opt_onDrop:
{function(string, ?, number)=} [optional]
A callback to be invoked when a data element is dropped from the cache
opt_filter:
{(function(string, ?, number) : boolean)=} [optional]
A function to filter data elements that are not to be cached
Method Details
setMaxSize (maxSize) : {H.util.Cache}
This method sets this cache's maximum size to a new size. If the cache's contents exceed the new
size, least recently used data elements will be dropped.
Parameters:
maxSize:
{number}
the new maximum size of this cache.
Returns:
{H.util.Cache}
this cache
getMaxSize () : {number}
This method returns the maximum size of this cache.
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
{number}
the maximum size of the cache
getCurrentSize () : {number}
This method returns the current size of this cache.
Returns:
{number}
the current size of the cache
add (id, data, size) : {boolean}
This method adds an element to the cache.
Parameters:
id:
{*}
The identifier of this data element, the value is converted to a string.
data:
{*}
the actual data to be stored
size:
{number}
the size of the data element
Returns:
{boolean}
a boolean value indicating whether the data was added
get (id, opt_noUpdate) : {*}
This method retrieves an element from the cache.
Parameters:
id:
{string}
the ID of the data element to be retrieved.
opt_noUpdate:
{boolean=} [optional]
806
Maps API for JavaScript Developer's Guide
► API Reference
807
and optional flag to indicate that the retrieved object should not be marked
as 'most recently used'.
Returns:
{*}
returns the data associated with the ID or undefined if the data element is
not currently in the cache.
drop (id)
This method explicitly drops an element from the cache.
Parameters:
id:
{*}
the id of the item to drop
forEach (callback, opt_ctx, opt_matcher)
This method will execute the provided callback function on each of the cache's entries. If the optional
match predicate is passed to this method the callback will only be executed on those entries for
which the predicated returns true.
Parameters:
callback:
{function(string, ?, number)}
the callback to be invoked for each entry
opt_ctx:
{Object=} [optional]
an optional context object to be used as this within the callback
opt_matcher:
{(function(string, ?, number) : boolean)=} [optional]
an optional match predicate to customize on which entries the callback will
be called
removeAll (opt_matcher)
This method removes all data elements from the cache. If the optional match predicate is passed to
this method only those data elements will be removed for which the predicate return true.
Parameters:
opt_matcher:
{(function(string, ?, number) : boolean)=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
808
an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively
Class: ChangeEvent
This class is a member of the namespace
H.util .
Class Summary
Extends: H.util.Event
This event indicates a change. It contains the old and the new value.
[ For full details, see the Class Details ]
Property Summary
Table 278: Properties
Properties
target : {*}
Object which triggered the event
currentTarget : {*}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 279: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Maps API for JavaScript Developer's Guide
► API Reference
Methods
Stops propagation for current event.
Class Description
This event indicates a change. It contains the old and the new value.
Constructor Details
H.util.ChangeEvent(type, newValue, oldValue)
Parameters:
type:
{string}
The type of the event
newValue:
{*}
The new value of the property
oldValue:
{*}
The previous value of the property
Property Details
target: {*}
Object which triggered the event
currentTarget: {*}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
809
Maps API for JavaScript Developer's Guide
► API Reference
stopPropagation ()
Stops propagation for current event.
Class: ContextItem
This class is a member of the namespace
H.util .
Class Summary
Extends: H.util.EventTarget
This class represents a contextual information/action.
[ For full details, see the Class Details ]
Property Summary
Table 280: Properties
Properties
static
SEPARATOR : {H.util.ContextItem}
Separator for the context items
Method Summary
Table 281: Methods
Methods
getLabel () : {string}
This method returns label of the context item
setLabel (label) : {H.util.ContextItem}
This method changes context item label to the specified one
isDisabled () : {boolean}
This method returns disabled state of the context item.
setDisabled (disabled) : {H.util.ContextItem}
This method enables/disables the context item
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
810
Maps API for JavaScript Developer's Guide
► API Reference
811
Methods
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Class Description
This class represents a contextual information/action.
Example
// Enable map events, like "contextmenu"
var events = new H.mapevents.MapEvents(map);
// Show default controls as well as the Context Menu control
var ui = H.ui.UI.createDefault(map, defaultLayers, 'en-EN');
// Add 'Zoom in' context menu item
map.addEventListener('contextmenu', function(e) {
e.items.push(new H.util.ContextItem({
label: 'Zoom in',
callback: function() {
map.setZoom(map.getZoom() + 1);
}
}));
});
Constructor Details
H.util.ContextItem(opt_options)
Parameters:
opt_options:
{H.util.ContextItem.Options=} [optional]
Maps API for JavaScript Developer's Guide
► API Reference
The values to initialize this context item
Property Details
static SEPARATOR: {H.util.ContextItem}
Separator for the context items
Method Details
getLabel () : {string}
This method returns label of the context item
Returns:
{string}
the label of the context item
setLabel (label) : {H.util.ContextItem}
This method changes context item label to the specified one
Parameters:
label:
{string}
New label for the context item
Returns:
{H.util.ContextItem}
this context item instance
isDisabled () : {boolean}
This method returns disabled state of the context item.
Returns:
{boolean}
true if the item is disabled, false otherwise
setDisabled (disabled) : {H.util.ContextItem}
This method enables/disables the context item
812
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
disabled:
{boolean}
true to disable and false to enabled it
Returns:
{H.util.ContextItem}
this context item instance
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
813
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
814
Maps API for JavaScript Developer's Guide
► API Reference
opt_scope:
{Object=} [optional]
Type definition: Options
This type definition is a member of the class
H.util.ContextItem .
Type Definition Summary
This type defines options which can be used to initialize the context item.
[ For full details, see the Type Definition Details ]
Property Summary
Table 282: Properties
Properties
label
the label of the context item
disabled
flag indicatting whether context item is disabled or no, by default false
callback
Optional callback function to call once context item is selected
Type Definition Description
This type defines options which can be used to initialize the context item.
Property Details
label: {string=} [optional]
the label of the context item
disabled: {boolean=} [optional]
flag indicatting whether context item is disabled or no, by default false
callback: {function(H.util.Event)=} [optional]
Optional callback function to call once context item is selected
815
Maps API for JavaScript Developer's Guide
► API Reference
Class: Disposable
This class is a member of the namespace
H.util .
Class Summary
Object which can be safely disposed.
[ For full details, see the Class Details ]
Method Summary
Table 283: Methods
Methods
addOnDisposeCallback (callback, opt_scope)
Method adds a callback which will be triggered when the object is disposed
Class Description
Object which can be safely disposed.
Constructor Details
H.util.Disposable()
Method Details
addOnDisposeCallback (callback, opt_scope)
Method adds a callback which will be triggered when the object is disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
816
Maps API for JavaScript Developer's Guide
► API Reference
Class: Event
This class is a member of the namespace
H.util .
Class Summary
Base Event class which is used for all events dispatched by any EventTarget within the api.
[ For full details, see the Class Details ]
Property Summary
Table 284: Properties
Properties
target : {*}
Object which triggered the event
currentTarget : {*}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 285: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class Description
Base Event class which is used for all events dispatched by any EventTarget within the api.
817
Maps API for JavaScript Developer's Guide
► API Reference
818
Constructor Details
H.util.Event(type, opt_target)
Parameters:
type:
{string}
Event Type.
opt_target:
{Object=} [optional]
Reference to the object that is the target of this event. It has to implement
the EventTarget interface.
Property Details
target: {*}
Object which triggered the event
currentTarget: {*}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Class: EventTarget
This class is a member of the namespace
H.util .
Maps API for JavaScript Developer's Guide
► API Reference
819
Class Summary
EventTarget enabled listening and dispatching events on all instances and derived classes.
[ For full details, see the Class Details ]
Method Summary
Table 286: Methods
Methods
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Class Description
EventTarget enabled listening and dispatching events on all instances and derived classes.
Constructor Details
H.util.EventTarget()
Method Details
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Maps API for JavaScript Developer's Guide
► API Reference
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
820
Maps API for JavaScript Developer's Guide
► API Reference
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
821
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Interface: ICache
This interface is a member of the namespace
H.util .
Interface Summary
An interface definition for the generic cache. Any data elements can be stored in the cache. They are
always associated with an identifier to retrieve them at a later stage and their content size.
[ For full details, see the Interface Details ]
Maps API for JavaScript Developer's Guide
► API Reference
822
Method Summary
Table 287: Methods
Methods
add (id, data, size) : {boolean}
This method adds an element to the cache.
get (id, opt_noUpdate) : {*}
This method retrieves an element from the cache.
drop (id)
This method explicitly drops an element from the cache.
forEach (callback, opt_ctx, opt_matcher)
This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is
passed to this method the callback will only be executed on those entries for which the predicated returns true.
removeAll (opt_matcher)
This method removes all data elements from the cache. If the optional match predicate is passed to this method only those
data elements will be removed for which the predicate return true.
Interface Description
An interface definition for the generic cache. Any data elements can be stored in the cache. They are
always associated with an identifier to retrieve them at a later stage and their content size.
Method Details
add (id, data, size) : {boolean}
This method adds an element to the cache.
Parameters:
id:
{*}
The identifier of this data element, the value is converted to a string.
data:
{*}
the actual data to be stored
size:
{number}
the size of the data element
Maps API for JavaScript Developer's Guide
► API Reference
Returns:
823
{boolean}
a boolean value indicating whether the data was added
get (id, opt_noUpdate) : {*}
This method retrieves an element from the cache.
Parameters:
id:
{string}
the ID of the data element to be retrieved.
opt_noUpdate:
{boolean=} [optional]
and optional flag to indicate that the retrieved object should not be marked
as 'most recently used'.
Returns:
{*}
returns the data associated with the ID or undefined if the data element is
not currently in the cache.
drop (id)
This method explicitly drops an element from the cache.
Parameters:
id:
{*}
the id of the item to drop
forEach (callback, opt_ctx, opt_matcher)
This method will execute the provided callback function on each of the cache's entries. If the optional
match predicate is passed to this method the callback will only be executed on those entries for
which the predicated returns true.
Parameters:
callback:
{function(string, ?, number)}
the callback to be invoked for each entry
Maps API for JavaScript Developer's Guide
► API Reference
824
opt_ctx:
{Object=} [optional]
an optional context object to be used as this within the callback
opt_matcher:
{(function(string, ?, number) : boolean)=} [optional]
an optional match predicate to customize on which entries the callback will
be called
removeAll (opt_matcher)
This method removes all data elements from the cache. If the optional match predicate is passed to
this method only those data elements will be removed for which the predicate return true.
Parameters:
opt_matcher:
{(function(string, ?, number) : boolean)=} [optional]
an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively
Interface: ICancelable
This interface is a member of the namespace
H.util .
Interface Summary
An interface to cancelable requests and actions.
[ For full details, see the Interface Details ]
Method Summary
Table 288: Methods
Methods
cancel ()
This method is used to cancel current action
Interface Description
An interface to cancelable requests and actions.
Maps API for JavaScript Developer's Guide
► API Reference
825
Method Details
cancel ()
This method is used to cancel current action
Interface: ICapturable
This interface is a member of the namespace
H.util .
Interface Summary
An interface for capturable elements
[ For full details, see the Interface Details ]
Method Summary
Table 289: Methods
Methods
capture (canvas, pixelRatio, callback, opt_errback)
This method is used to capture the element view
Interface Description
An interface for capturable elements
Method Details
capture (canvas, pixelRatio, callback, opt_errback)
This method is used to capture the element view
Parameters:
canvas:
{HTMLCanvasElement}
HTML Canvas element to draw the view of the capturable element
pixelRatio:
{number}
The pixelRatio to use for over-sampling in cases of high-resolution displays,
default is 1
Maps API for JavaScript Developer's Guide
► API Reference
callback:
{function(HTMLCanvasElement=)}
Callback function to call once result of the capturing is ready
opt_errback:
{function(string)=} [optional]
Callback function to call if error occurred during capturing
826
Class: OList
This class is a member of the namespace
H.util .
Class Summary
Extends: H.util.EventTarget
This class represents an list of ordered entries which dispatches events when the list is modified.
[ For full details, see the Class Details ]
Method Summary
Table 290: Methods
Methods
add (entry, opt_idx)
This method inserts an entry to the list. Optionally it can place new entry at provided index.
removeAt (idx) : {?}
This method removes an entry by a given index from the list.
remove (entry) : {boolean}
This method removes the the first entry which is identical with the given entry.
set (idx, entry) : {?}
This method replaces an entry at the given index with the given entry.
indexOf (entry) : {number}
This method retrieves the index of the first object in this list that is identical with the object supplied by the caller.
get (idx) : {?}
To get the entry at the specified index.
getLength () : {number}
Maps API for JavaScript Developer's Guide
► API Reference
827
Methods
This method returns the length of the list.
asArray () : {Array<*>}
This method returns all list's entries as an array.
flush ()
This method removes all entries from the list.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
dispatchEvent (evt)
This method will dispatch event on the event target object
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove
references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Events Summary
Table 291: Events
Events
add : {H.util.OList.Event}
Fired when an entry was added to the list.
remove : {H.util.OList.Event}
Fired when an entry was removed from the list.
set : {H.util.OList.Event}
Fired when an entry was set in the list.
move : {H.util.OList.Event}
Fired when an entry was moved within the list.
Maps API for JavaScript Developer's Guide
► API Reference
828
Class Description
This class represents an list of ordered entries which dispatches events when the list is modified.
Constructor Details
H.util.OList()
Method Details
add (entry, opt_idx)
This method inserts an entry to the list. Optionally it can place new entry at provided index.
Parameters:
entry:
{?}
The entry to insert
opt_idx:
{number=} [optional]
The index where the new entry should be inserted; if omitted or greater then
the current size of the list, the entry is added at the end of the list; a negative index is treated as being relative from the end of the list
removeAt (idx) : {?}
This method removes an entry by a given index from the list.
Parameters:
idx:
{number}
The index of the entry which should be removed; a negative index is treated
as being relative from the end of the list
Returns:
{?}
The removed entry
remove (entry) : {boolean}
This method removes the the first entry which is identical with the given entry.
Parameters:
Maps API for JavaScript Developer's Guide
► API Reference
entry:
{?}
The entry to remove
Returns:
829
{boolean}
signals if the entry could be found in the list and is removed
set (idx, entry) : {?}
This method replaces an entry at the given index with the given entry.
Parameters:
idx:
{number}
The index of the entry which should be replaced; a negative index is treated
as being relative from the end of the list
entry:
{?}
The entry which replaces the existing one
Returns:
{?}
The replaced entry
indexOf (entry) : {number}
This method retrieves the index of the first object in this list that is identical with the object supplied
by the caller.
Parameters:
entry:
{?}
The entry for which to return the index.
Returns:
{number}
The index of the first matching entry in this list or -1 if the entry provided by
the caller is not found in the list
Maps API for JavaScript Developer's Guide
► API Reference
830
get (idx) : {?}
To get the entry at the specified index.
Parameters:
idx:
{number}
The index of the entry to get a negative index is treated as being relative
from the end of the list
Returns:
{?}
The element at the given index
getLength () : {number}
This method returns the length of the list.
Returns:
{number}
asArray () : {Array<*>}
This method returns all list's entries as an array.
Returns:
{Array<*>}
The list as an array
flush ()
This method removes all entries from the list.
onceEventListener (type, handler, opt_capture, opt_scope)
Adds a one time listener for a specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
Maps API for JavaScript Developer's Guide
► API Reference
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
addEventListener (type, handler, opt_capture, opt_scope)
This method allows to listen for specific event triggered by the object
Parameters:
type:
{string}
name of event
handler:
{!Function}
event handler function
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
scope for the handler function
removeEventListener (type, handler, opt_capture, opt_scope)
This method will removed previously added listener from the event target
Parameters:
type:
{string}
name of event
handler:
{!Function}
previously added event handler
opt_capture:
{boolean=} [optional]
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
831
Maps API for JavaScript Developer's Guide
► API Reference
scope for the handler function
dispatchEvent (evt)
This method will dispatch event on the event target object
Parameters:
evt:
{(H.util.Event | string)}
event object or event name
dispose ()
Removes listeners from this object. Classes that extend EventTarget may need to override this
method in order to remove references to DOM Elements and additional listeners.
addOnDisposeCallback (callback, opt_scope)
This method adds callback which is triggered when the object is being disposed
Parameters:
callback:
{!Function}
opt_scope:
{Object=} [optional]
Event Details
add: {H.util.OList.Event}
Fired when an entry was added to the list.
remove: {H.util.OList.Event}
Fired when an entry was removed from the list.
set: {H.util.OList.Event}
Fired when an entry was set in the list.
move: {H.util.OList.Event}
Fired when an entry was moved within the list.
832
Maps API for JavaScript Developer's Guide
► API Reference
Class: Event
This class is a member of the class
H.util.OList .
Class Summary
Extends: H.util.Event
The event class for events that are dispatched by OList
[ For full details, see the Class Details ]
Property Summary
Table 292: Properties
Properties
target : {*}
Object which triggered the event
currentTarget : {*}
Object which has listener attached
type : {string}
Name of the dispatched event
defaultPrevented : {boolean}
Indicates if preventDefault was called on the current event
Method Summary
Table 293: Methods
Methods
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
833
Maps API for JavaScript Developer's Guide
► API Reference
Class Description
The event class for events that are dispatched by OList
Constructor Details
H.util.OList.Event(list, type, idx, added, removed, moved)
Parameters:
list:
{H.util.OList}
The OList instance which is emitting the event
type:
{H.util.OList.prototype.EventType}
The type of the event
idx:
{number}
The affected index within this list
added:
{?*}
The value of the entry which was added or set
removed:
{?*}
The value of the entry which was removed or replaced
moved:
{?*}
The value of the entry which was moved
Property Details
target: {*}
Object which triggered the event
currentTarget: {*}
Object which has listener attached
type: {string}
Name of the dispatched event
defaultPrevented: {boolean}
Indicates if preventDefault was called on the current event
834
Maps API for JavaScript Developer's Guide
► API Reference
Method Details
preventDefault ()
Sets defaultPrevented to true. Which can be used to prevent some default behavior.
stopPropagation ()
Stops propagation for current event.
Namespace: animation
Namespace Summary
This namespace holds utility functionality for animations
Namespace Description
This namespace holds utility functionality for animations
Namespace: ease
Namespace Summary
This mamespace contains easing functions used for Animation class.
Method Summary
Table 294: Methods
Methods
static
LINEAR (val) : {number}
This function defines linear ease.
static
EASE_IN_QUAD (val) : {number}
This function defines quadratic ease in.
static
EASE_OUT_QUAD (val) : {number}
This function defines quadratic ease out.
static
EASE_IN_OUT_QUINT (val) : {number}
This function defines ease in and out with slope.
static
EASE_OUT_CIRC (val) : {number}
835
Maps API for JavaScript Developer's Guide
► API Reference
Methods
This function defines ease out with circ function
Namespace Description
This mamespace contains easing functions used for Animation class.
Method Details
static
LINEAR (val) : {number}
This function defines linear ease.
Parameters:
val:
{number}
A value in range [0..1] to translate
Returns:
{number}
the translated value
static
EASE_IN_QUAD (val) : {number}
This function defines quadratic ease in.
Parameters:
val:
{number}
A value in range [0..1] to translate
Returns:
{number}
the translated value
static
EASE_OUT_QUAD (val) : {number}
This function defines quadratic ease out.
Parameters:
val:
{number}
836
Maps API for JavaScript Developer's Guide
► API Reference
A value in range [0..1] to translate
Returns:
837
{number}
the translated value
static
EASE_IN_OUT_QUINT (val) : {number}
This function defines ease in and out with slope.
Parameters:
val:
{number}
A value in range [0..1] to translate
Returns:
{number}
the translated value
static
EASE_OUT_CIRC (val) : {number}
This function defines ease out with circ function
Parameters:
val:
{number}
Parameter between 0..1 which is translated to output number between 0..1
regarding transforming function.
Returns:
{number}
0..1
Namespace: kinetics
Namespace Summary
This namespace holds functionality related to kinetic move calculation
Maps API for JavaScript Developer's Guide
► API Reference
838
Namespace Description
This namespace holds functionality related to kinetic move calculation
Interface: IKinetics
This interface is a member of the namespace
H.util.kinetics .
Interface Summary
This interface defines kinetic move parameters used by map for kinetic drag.
[ For full details, see the Interface Details ]
Property Summary
Table 295: Properties
Properties
power : {number}
Power multiplier. Multiplier is used to increase the speed of the kinetic move. By default map uses 1.
Method Summary
Table 296: Methods
Methods
ease (p) : {number}
Easing function modifies animation progress. In example it can modify the animation in a way it starts rapidaly and theb
slowes down at the end.
Interface Description
This interface defines kinetic move parameters used by map for kinetic drag.
Property Details
power: {number}
Power multiplier. Multiplier is used to increase the speed of the kinetic move. By default map uses 1.
Maps API for JavaScript Developer's Guide
► API Reference
839
Method Details
ease (p) : {number}
Easing function modifies animation progress. In example it can modify the animation in a way it starts
rapidaly and theb slowes down at the end.
Parameters:
p:
{number}
current progress
Returns:
{number}
modified progress