Class: LocalObjectProvider
- Last UpdatedMay 21, 2025
- 7 minute read
A LocalObjectProvider
acts as a database for map objects.
It provides functionality to fetch visible objects for specific geographical bounding box and zoom levels.
All objects are organized in 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 the method
H.map.provider.LocalObjectProvider#getRootGroup
.
A H.Map
has its own LocalObjectProvider
and offer a means to add and remove objects.
Only in advanced use cases, is there a need to create an additional LocalObjectProvider
.
Name | Type | Description |
---|---|---|
opt_options |
H.map.provider.Provider.Options |
optional
An object containing configuration options |
Example
// Create your own LocalObjectProvider and add some hierarchical objects:
myProvider = new H.map.provider.LocalObjectProvider();
myMap.addLayer(new H.map.layer.ObjectLayer(myProvider));
position = {lat: 52.5308, lng: 13.3852};
myGroup = new H.map.Group();
myGroup.addObject(new H.map.Circle(position, 35));
myProvider.getRootGroup().addObjects([
myGroup,
new H.map.Marker(position)
]);
myMap.setCenter(position).setZoom(18);
Extends
Members
-
max number inherited
-
This property holds a value indicating the maximum zoom level at which the given provider can serve data. The value is set at construction time.
-
min number inherited
-
This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time.
-
uid string inherited
-
This property holds the unique identifier for the provider instance. The value is generated at construction time.
-
uri string inherited
-
This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's
uid
.
Methods
-
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method adds a listener for a specific event.
Note that to prevent potential memory leaks, you must either call
removeEventListener
ordispose
on the given object when you no longer need it. -
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which is triggered when the
EventTarget
object is being disposed.Name Type Description callback
function The callback function.
opt_scope
Object optional An optional scope for the callback function
-
dispatchEvent (evt) inherited
-
This method dispatches an event on the
EventTarget
object.Name Type Description evt
H.util.Event | string An object representing the event or a string with the event name
-
dispose () inherited
-
This method removes listeners from the given object. Classes that extend
EventTarget
may need to override this method in order to remove references to DOM Elements and additional listeners. -
getCopyrights (boundingBox, level)Array.<!H.map.ICopyright> inherited
-
This method retrieves the copyrights for the provided content for a certain geographical area and zoom level.
Note: This function may be overridden by
H.map.provider.Provider.Options
getCopyrights
property. The default implementation returnsnull
.Name Type Description boundingBox
H.geo.Rect The rectangular area for which to retrieve the copyright information
level
number The zoom level for which to retrieve the copyright information
Returns:
Type Description Array.<!H.map.ICopyright> A list of copyright information objects for the provided area and zoom level -
getInvalidations (opt_type)H.map.provider.Invalidations inherited
-
This method retrieves the accumulated invalidations of the given provider's objects.
Name Type Description 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:
Type Description H.map.provider.Invalidations An object specifying invalidations -
To obtain a list of map objects which intersect the provided area.
-
getRootGroup ()H.map.Group
-
This method retrieves the root group for the given provider.
Returns:
Type Description H.map.Group An object representing the root group for the given provider -
getStyleInternal ()H.map.render.Style.<!Object> inherited overrides
-
This methods returns the style used to render the provider data.
Returns:
Type Description H.map.render.Style.<!Object> -
This method signals to the provider that a map object has changed. The method updates the
Invalidations
of the given provider and the specified map object and triggersdispatchUpdate()
.Name Type Description mapObject
H.map.Object The map object to be invalidated
changes
H.math.BitMask.<!H.map.provider.Invalidations.Flag> The flags indicating the types of changes that have occurred
-
This method checks whether this provider will provide
DomMarker
map objects. A concrete implementation ofProvider
must override it if it will provideDomMarker
s.Returns:
Type Description boolean A value indicating if the given provider provides DomMarkers ( true
) or not (false
) -
providesGeoJSON ()boolean inherited
-
This method checks whether this provider will provide data in
GeoJSON
format. A concrete implementation ofProvider
must override it if it will provideGeoJSON
data.Returns:
Type Description boolean A value indicating if the given provider provides GeoJSON
data (true
) or not (false
) -
This method checks whether this provider will provide
Marker
map objects. A concrete implementation ofProvider
must override it if it will provideMarker
s.Returns:
Type Description boolean A value indicating if the given provider provides Markers ( true
) or not (false
) -
providesOMV ()boolean inherited
-
This method checks whether this provider will provide data in
OMV
format. A concrete implementation ofProvider
must override it if it will provideOMV
data.Returns:
Type Description boolean A value indicating if the given provider provides OMV
data (true
) or not (false
) -
This method checks whether this provider will provide overlay map objects. A concrete implementation of
Provider
must override it if it will provide overlays.Returns:
Type Description boolean true
if the provider provides overlays, otherwisefalse
-
providesRasters ()boolean inherited
-
This method checks whether this provider will provide bitmap images as tiles. A concrete implementation of
Provider
must override it if it will provide raster tiles.Returns:
Type Description boolean A value indicating if the given provider provides raster tiles ( true
) or not (false
) -
This method checks whether this provider will provide spatial map objects. A concrete implementation of
Provider
must override it if it will provideSpatial
s.Returns:
Type Description boolean A value indicating whether the provider provides map objects ( true
) or not (false
) -
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the
EventTarget
instance. -
This method removes an object from the given provider's database. It must not called directly. It is invoked by
H.map.Group
which checks beforehand that it is anH.map.Object
instance and its provider is the given provider.Name Type Description object
H.map.Object The object to remove
-
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.DomMarker> inherited overrides
-
This method retrieves all
DomMarker
map objects which intersect with the provided rectangular area.Returns:
Type Description Array.<!H.map.DomMarker> A list of intersecting objects -
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Marker> inherited overrides
-
This method retrieves all
Marker
map objects which intersect with the provided rectangular area.Returns:
Type Description Array.<!H.map.Marker> A list of intersecting objects -
requestOverlays (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Overlay> inherited overrides
-
This method retrieves all overlay objects which intersect with the specified area.
Returns:
Type Description Array.<!H.map.Overlay> A list of intersecting objects -
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Spatial> inherited overrides
-
This method retrieves all polyline, polygon, circle and rectangle objects which intersect with the provided area.
Returns:
Type Description Array.<!H.map.Spatial> A list of intersecting objects -
This method sets the style to be used to render the provider data.
Name Type Description style
H.map.render.Style.<!Object> The style to use for rendering the provider data.
opt_suppressChangeEvent
boolean optional Flag to suppress firing of config change event.
Type Definitions
-
This type defines options that can be used for
H.map.provider.LocalObjectProvider#getObjectsWithin
calls.Properties:
Events
-
update inherited
-
Event fired when this provider's data updates.
Type: