Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: Reader

Table of Contents

Class: Reader

H.data.kml.Reader

new H.data.kml.Reader (url)

This class is responsible for fetching and interpreting KML data. It creates an instance of 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, the KML node itself, etc.) is bound to the map object and can be fetched by calling the method H.map.Object#getData on the map object.

Note that you can load a KML file even from a different domain, if that domain supports Cross-Origin Resource Sharing.

Name Type Description
url string

A URL from which to get KML data

Example
var reader = new H.data.kml.Reader('/path/to/kml/file.kml');
reader.parse();
// Assumption: map already exists
map.addLayer(reader.getLayer());

Extends

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 or dispose 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.

This method retrieves an object layer (H.map.layer.ObjectLayer) that contains parsed data and can be added directly to the map. The method gets a new instance of ObjectLayer with every invocation. If the data has not been parsed, the method returns an ObjectLayer that contains partial information, and the reader adds any new parsed objects to the provider associated with the layer later on.

Returns:
Type Description
H.map.layer.ObjectLayer

getParsedObjects ()Array.<!H.map.Object> inherited

This method retrieves a collection of objects representing parsed data converted to data objects. Note that the method returns only currently parsed objects if parsing is ongoing.

Returns:
Type Description
Array.<!H.map.Object> An array of objects representing parsed data

This method retrieves the processing state of the Reader. For possible states see H.data.AbstractReader.State.

Returns:
Type Description
H.data.AbstractReader.State A value indicating the state of the Reader

getUrl ()string | undefined inherited

This method retrieves the URL of the current file, which is either a file being fetched/parsed or a file that has been already parsed.

Returns:
Type Description
string | undefined url A string containing the URL or undefined

parse () inherited

This method launches parsing of the data file at the current URL (see H.data.AbstractReader#setUrl or H.data.AbstractReader). The method uses XHR as a transport, therefore the same origin policy applies, or the server should respond with the appropriate CORS headers.

removeEventListener (type, handler, opt_capture, opt_scope) inherited

This method removes a previously added listener from the EventTarget instance.

This method sets the URL for the Reader. It resets the current state of the Reader to its initial values (clears data about last parsed objects, etc.), and throws InvalidState exception if the state of the Reader is not READY or ERROR.

Name Type Description
url string

The new URL

Returns:
Type Description
H.data.AbstractReader An object reflecting the Reader after modification

Events

statechange inherited

Event fired when the reader state changes, see H.data.AbstractReader#getState.

Type:
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert