Get partition metadata from a volatile and versioned layer

Partition metadata from a versioned and volatile layer consists of the following information about the partition:

  • Data handle
  • ID
  • Version
  • Data size
  • Checksum
  • Compressed data size

You can get partition metadata from the versioned or volatile layer in one of the following ways:

  • Using the Metadata Service API
  • Using the Query Service API

You can get partition platform metadata using the Query Service API only if the partition has the HERE tile scheme. For more information on the HERE tile scheme, see Partitions.

For performance reasons, it is best to use the Query Service API only to get metadata for a specific partition. For batch processes, and to get metadata for many partitions or all partitions in a layer, use the Metadata Service API.

To get partition metadata from the versioned or volatile layer:

  1. Create the OlpClientSettings instance.

    For instructions, see Create platform client settings.

  2. Depending on the layer type, create a versioned or volatile layer client with the HERE Resource Name (HRN), layer ID, platform client settings from step 1, and layer version.

    Note

    You do not need to specify a version number if you want to get metadata for a volatile layer or the latest version of the versioned layer.

    const versionedLayerClient = new VersionedLayerClient({
      catalogHrn: HRN.fromString("your-catalog-hrn"),
      layerId: "your-layer-id",
      settings: olpClientSettings,
      version: number,
    });
    
  3. Do one of the following:

    • (For partitions with the HERE tile scheme) To get partition metadata using the Metadata Service API:

      1. Create the QuadKeyPartitionsRequest object with the version number of the layer for which you want to get the metadata, the quadkey, and the number of child partitions (from 0 to 4).

        Note

        You do not need to specify a version number if you want to get metadata for a volatile layer or the latest version of the versioned layer. Also, the version specified in the request overrides the version specified in the VersionedLayerClient object.

        const requestByQuadKey = new QuadKeyPartitionsRequest()
          .withQuadKey("QuadKey")
          .withDepth("NumberOfChildPartitions")
          .withBillingTag("MyBillingTag");
        
      2. Call the getPartitions method with the RequestByQuadKey parameter.

        const partitionsByQuadKey = await versionedLayerClient.getPartitions(
          requestByQuadKey
        );
        

      You get the quadkey tree index with metadata for the requested partition and its parent and children partitions.

    • To get partition metadata using the Metadata Service API:

      1. Create the PartitionsRequest object with the 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 partitionsRequest = new PartitionsRequest()
          .withBillingTag("MyBillingTag")
          .withFetchOption(FetchOptions.OnlineOnly);
        
      2. Call the getPartitions method with the PartitionsRequest parameter.

        const partitions = await versionedLayerClient.getPartitions(
          partitionsRequest
        );
        

      You get metadata for all the partitions in the layer.

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.

Example

const abortController = new AbortController();
const partitions = await versionedLayerClient.getPartitions(
  partitionsRequest,
  abortController.signal
);

results matching ""

    No results matching ""