Maps API for JavaScript Developer's Guide

H.map.provider.LocalObjectProvider

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 1. Properties
Properties

uri : {string}

This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid

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 2. Methods
Methods

getRootGroup () : {H.map.Group}

Returns the root group of this provider.

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.

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()

providesOverlays () : {boolean}

Checks whether this provider is currently providing overlay map objects. A concrete implementation of ObjectProvider must override it if it currently provides overlays.

requestOverlays (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Overlay>}

Returns all Overlay objects which intersect with the provided area.

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.

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible.

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 3. 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)
  ]);
  myMap.setCenter(hereDotCom).setZoom(18);

Constructor Details

H.map.provider.LocalObjectProvider(opt_options)

Parameters:
 
opt_options:
{H.map.provider.Provider.Options=} [optional]
 

Property Details

uri: {string}

This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid

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

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.

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

providesOverlays () : {boolean}

Checks whether this provider is currently providing overlay map objects. A concrete implementation of ObjectProvider must override it if it currently provides overlays.

Returns:
 
{boolean}

requestOverlays (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Overlay>}

Returns all Overlay 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.Overlay>}
a list of intersecting objects

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

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>}

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

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible.

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 ()

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}
 
The callback function.
opt_scope:
{Object=} [optional]
 
An optional scope to call the callback in.

Event Details

update: {H.util.Event}

Fired when this provider's data updates

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

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

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

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

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