Data Flow

The HERE Maps API data flow relies on a chain of class types like Service, Provider and Layer to fetch data from the server, position and style it on a map.

Service provides connectivity with the Geovisualization backend and must be configured with Platform. The Geovisualization JavaScript API includes a service for the Geovisualization REST API.

Provider defines the interface for layers to access data. It uses Service to load data from the Geovisualization backend. When data is loaded, Provider transforms the data into a format acceptable by Layer. The Geovisualization JavaScript API includes providers for loading data from tiled and non-tiled queries. Provider handles query dynamic parameters.

Layer renders data from Provider for the viewport requested by Map. There are different types of layers for different types of input data.

Map handles user inputs (like map zoom and moves) and fetches data for the current viewport from connected layers.

Figure 1. API data flow

When Layer is added on a Map, the following chain of calls is triggered:

Map calculates which tiles are visible and requests synchronously the tile images from Layer.

If Layer has no tile image in cache, it synchronously requests data for the tile from Provider to render it.

If Provider has no requested data, it loads data from the backend with Service. When Provider receives a response it triggers the update event, which bubbles to Map through the Layer.

When Map receives the update event from Layer, it requests synchronously the visible tiles again. If data for a tile is available in Provider, Layer renders the tile and returns the tile images to the Map.

Figure 2. API call chain

This loop repeats every time the viewport updates or new data arrives or changes.