Get data from a versioned layer

You can request any data version from a versioned layer. When you request a particular version of data from the versioned layer, the partition you receive in the response may have a lower version number than you requested. The version of a layer or partition represents the catalog version in which the layer or partition was last updated.

To get data from the versioned layer:

  1. Create the OlpClientSettings instance.

    For instructions, see Create platform client settings.

  2. Create the VersionedLayerClient object with the HERE Resource Name (HRN) of the catalog that contains the layer, layer ID, platform client settings from step 1, and catalog version.


    If the version is not specified, the latest version is used.

    const versionedLayerClient = new VersionedLayerClient({
      catalogHrn: HRN.fromString("your-catalog-hrn"),
      layerId: "your-layer-id",
      settings: olpClientSettings,
      version: number,
  3. Create the DataRequest object with the partition ID and fetch option.

    The default fetch option is OnlineIfNotFound. It queries the network if the requested resource is not found in the cache. If you want to skip cache lookups and query the network right away, set the withFetchOption method to OnlineOnly.

    const dataRequest = new DataRequest()
  4. Call the getData method with the DataRequest parameter.

    const partitions = await versionedLayerClient.getData(dataRequest);

You receive data from the requested partition of the selected layer version.

For examples, see Run the examples.

In browser and Node.js, to abort requests before they have completed, you can create the AbortController object, and then add the AbortController.signal property to your requests. For more information, see the AbortController documentation.


const abortController = new AbortController();
const partitions = await versionedLayerClient.getData(

results matching ""

    No results matching ""