データを取得します

カタログからデータを取得するに data-engine は、プロジェクトへの依存関係としてモジュールを追加します。

data-engine このモジュールでは data-client 、 HERE platform データを操作するときに、の最上位に概要レベルの抽象化を提供します。 このモジュールでは、メタデータとデータの両方を読み取り、管理できます。

プラットフォームは、バージョン管理、揮発性、およびストリームの 3 種類のデータレイヤーをサポートしています。

バージョニングレイヤー

バージョン管理されたレイヤーのデータは、指定したバージョンのカタログが存在する限り使用できます。 つまり、フェッチされたブロブをクライアント側でキャッシュできます。

バージョン付レイヤーに属するパーティションのストリームのデータ( blob )を取得するには、次のものを追加します。

Scala
Java
val queryApi = DataClient().queryApi(catalogHrn, settings)

// create readEngine for source catalog
val readEngine = DataEngine().readEngine(catalogHrn, settings)

// stream of tuple of (partition, bytes)
val dataAsBytes: Future[Source[(Partition, Array[Byte]), NotUsed]] =
  queryApi
    .getPartitions(version, layer)
    .map { partitions =>
      // parallelism defines how many parallel requests would be made to fetch the data
      partitions.mapAsync(parallelism = 10) { partition =>
        readEngine.getDataAsBytes(partition).map { data =>
          (partition, data)
        }
      }
    }
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

// parallelism defines how many parallel requests would be made to fetch the data
int parallelism = 10;

// create readEngine for source catalog
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

// stream of tuple of (partition, bytes)
CompletionStage<Source<Pair<Partition, byte[]>, NotUsed>> dataAsBytes =
    queryApi
        .getPartitions(catalogVersion, layer, AdditionalFields.AllFields())
        .thenApply(
            metadata ->
                metadata.mapAsync(
                    parallelism,
                    partition ->
                        readEngine
                            .getDataAsBytes(partition)
                            .thenApply(data -> new Pair<>(partition, data))));

Akka ソースとしてデータを取得するには、次のものを追加します。

Scala
Java
// fetch data as lazy source of data
val dataAsSource: Future[Source[Source[ByteString, NotUsed], NotUsed]] =
  queryApi
    .getPartitions(version, layer)
    .map { partitions =>
      partitions.mapAsync(parallelism = 10) { partition =>
        readEngine.getDataAsSource(partition)
      }
    }
// fetch data as lazy source of data
CompletionStage<Source<Source<ByteString, NotUsed>, NotUsed>> dataAsSource =
    queryApi
        .getPartitions(catalogVersion, layer, AdditionalFields.AllFields())
        .thenApply(
            partitions ->
                partitions.mapAsync(
                    parallelism, partition -> readEngine.getDataAsSource(partition)));

データをカスタムオブジェクトに変換するには、次のものを追加します。

Scala
Java
// fetch data mapped directly to custom domain object
val data: Future[Source[CustomDomainObject, NotUsed]] =
  queryApi
    .getPartitions(version, layer)
    .map { partitions =>
      partitions.mapAsync(parallelism = 10) { partition =>
        readEngine.get(partition, bytes => CustomDomainObject.fromBytes(bytes))
      }
    }
// fetch data mapped directly to custom domain object
CompletionStage<Source<JavaCustomDomainObject, NotUsed>> data =
    queryApi
        .getPartitions(catalogVersion, layer, AdditionalFields.AllFields())
        .thenApply(
            partitions ->
                partitions.mapAsync(
                    parallelism,
                    partition ->
                        readEngine.get(
                            partition, bytes -> JavaCustomDomainObject.fromBytes(bytes))));

ストリーム レイヤー

ストリームレイヤーのデータは、プロデューサーが公開する限り、コンシューマーにプッシュされるイベントで構成されます。

ストリーム レイヤーにサブスクライブするには、次のものを追加します。

Scala
Java
// create queryApi for target catalog
val queryApi = DataClient().queryApi(catalogHrn, settings)

//Create read engine for target catalog
val readEngine = DataEngine().readEngine(catalogHrn, settings)

// define a function how to process payload
def processPayload(data: Array[Byte]): Done = {
  println("Received data: " + data)
  Done
}

// create subscription to stream layer
val subscription: Future[Subscription] =
  queryApi.subscribe(streamingLayerId,
                     ConsumerSettings("consumer-name", consumerId = "consumer-id"))

subscription.foreach { subscription =>
  subscription.partitions
    .mapAsync(parallelism = 10) { partition: Partition =>
      readEngine.getDataAsBytes(partition)
    }
    .map { payload: Array[Byte] =>
      processPayload(payload)
    }
    .runWith(Sink.ignore)
    .andThen {
      case Success(_) => println("Done")
      case Failure(exception) => println(s"Failed with $exception")
    }
}
// create readEngine and queryApi for a catalog
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

int parallelism = 10;

// subscribe to receive new publications from stream layer
CompletionStage<Subscription> subscriptionFuture =
    queryApi.subscribe(
        layer, new ConsumerSettings.Builder().withGroupName("test-consumer").build());

subscriptionFuture
    .thenApply(
        subscription -> {
          return subscription
              .getPartitions()
              .mapAsync(parallelism, readEngine::getDataAsBytes)
              .map(payload -> processPayload(payload))
              .runWith(Sink.ignore(), myMaterializer);
        })
    .whenCompleteAsync(
        (result, e) -> {
          if (e != null) {
            e.printStackTrace();
          } else {
            System.out.println("DONE!");
          }
        });
// define a function how to process payload
private Done processPayload(byte[] data) {
  System.out.println("Received data: " + data);
  return Done.getInstance();
}

サブスクリプションをシャットダウンするには、 SubscriptionControl を使用します。

Scala
Java
// shutdown stream subscription when done
subscription.subscriptionControl.shutdown()
// shutdown stream subscription when done
subscription.getSubscriptionControl().shutdown();

サブスクリプションプロセス中にハンドラ / コールバック関数を提供するには、次のものを追加します。

Scala
Java
// create queryApi for target catalog
val queryApi = DataClient().queryApi(catalogHrn, settings)

// define a function how to process partitions
def processPartition(partition: Partition): Unit =
  println("Received partition: " + partition)

// create subscription to stream layer
val subscriptionControl: Future[SubscriptionControl] =
  queryApi.subscribe(streamingLayerId,
                     ConsumerSettings("consumer-name"),
                     partition => processPartition(partition))
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);
CompletionStage<SubscriptionControl> subscriptionFuture =
    queryApi.subscribe(
        "stream-layer",
        new ConsumerSettings.Builder()
            .withGroupName("test-consumer")
            .withConsumerId("consumer-id")
            .build(),
        partition -> processPartition(partition));
// define a function how to process partitions
private void processPartition(Partition partition) {
  System.out.println("Received partition: " + partition);
}

複数の作業者のストリームレイヤーからデータを読み取ります

ストリーム レイヤースループットの設定に応じて、同じストリーム レイヤーを使用する分散ワーカーを設定できます。 すべてのワーカーが同じ コンシューマグループを共有している場合(サブスクリプションの作成時にConsumerSetting.groupNameによって定義され、各ワーカーに一意のConsumerSetting.consumerIdグループ(http-connectorのみ))、ストリームイベントがワーカー間で配布されます。 ストリームレイヤーを処理 するには、少なくとも 1 回の配信セマンティクスを使用して、同じワーカーまたは別のワーカーに同じイベントを送出します。

ユーザーがワーカーの復旧が必要な場合は ( 失敗した場合 ) 、同じ ConsumerSetting.groupName とを使用して新しいサブスクリプションを作成します ConsumerSetting.consumerId ( の http-connector 場合のみ ) 。

コンシューマが最初からストリーム レイヤーを再処理する必要がある場合 は、別の groupName を使用して新しいサブスクリプションを作成します。

初期オフセットとチェックポイント

ConsumerSettings.offset サブスクリプションでのオフセットおよびチェックポイントの管理方法を設定するために使用します。

  • EarliestOffset : 特定のグループ名で使用可能な最も古い(古い)パーティションをサブスクライブします。このとき、以前のチェックポイントが反映されます。 チェックポイントが自動的に生成されます。

  • 製造オフセット : 特定のグループ名で使用可能な最も古い(古い)パーティションをサブスクライブします。このとき、以前のチェックポイントが反映されます。 SubscriptionControl.acknowledge 受信したすべてのパーティションに電話をかける必要があります。 必要に SubscriptionControl.checkpoint 応じて、を使用してオフセットをプラットフォームに送信します。

  • LatestOffset : 最新の ( 新しい ) 利用可能なパーティションをサブスクライブします。 すでに利用可能なデータまたはチェックポイントは、サブスクリプションによって無視されます。

ボラタイル レイヤー

揮発性レイヤーのデータは時間の経過とともに変更される可能性があります。 つまり、同じパーティションのデータ( blob )には、異なるコンテンツが含まれている可能性があります。 通常、揮発性のレイヤーは、交通情報、天気、その他の類似のコンテンツを表すことができます。

揮発性データを使用する場合、パフォーマンスが重要な要素になることがよくあります。 HERE platform とのやり取りを高速化するために、メタデータをキャッシュして、必要に応じてブロブを取得できます。

ボラタイル レイヤーからデータを取得するには、次のものを追加します。

Scala
Java
// create queryApi and readEngine
val queryApi = DataClient().queryApi(catalogHrn, settings)
val readEngine = DataEngine().readEngine(catalogHrn, settings)

// download payload for partition
def downloadData(partition: Partition): Future[Option[String]] =
  readEngine
    .getDataAsBytes(partition)
    .map(bytes => Some(new String(bytes)))
    .recover { case _ => None }

// fetch metadata once, can be cached on the client
val partitions: Future[Source[Partition, NotUsed]] =
  queryApi.getVolatilePartitions(layerId)

// keep reading data for volatile layer as needed
partitions.flatMap { ps: Source[Partition, NotUsed] =>
  ps.mapAsync(parallelism = 10) { partition: Partition =>
      downloadData(partition)
    }
    .runWith(Sink.foreach(println))
}
// create queryApi and readEngine
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

// download payload for partition
Function<Partition, CompletionStage<Optional<byte[]>>> fetchData =
    (partition) -> {
      return readEngine
          .getDataAsBytes(partition)
          .thenApply(Optional::of)
          .exceptionally(failure -> Optional.empty());
    };

// fetch metadata once, can be cached on the client
CompletionStage<Source<Partition, NotUsed>> partitions =
    queryApi.getVolatilePartitions(
        layer, new VolatilePartitionsFilter.Builder().build(), Collections.emptySet());

int parallelism = 10;

// keep reading data for volatile layer as needed
partitions.thenApply(
    partitionsSource -> {
      return partitionsSource
          .mapAsync(parallelism, fetchData::apply)
          .runWith(Sink.foreach(System.out::println), myMaterializer);
    });

getVolatilePartitionsgetVolatilePartitionsAsIterator両方の関数で、オプションのフィルタパラメータを渡すことができます。VolatilePartitionsFilteremptysinceフィルタまたはフィルタbyIdsのいずれか、またはその両方の組み合わせにすることができます。 このようなフィルタの複数は、論理 and 演算子で結合できます。 ボラタイル レイヤー内のすべてのパーティションは VolatilePartitionsFilter 、がの場合に照合 emptyされます。

例 :

Scala
Java
// create queryApi and readEngine
val queryApi = DataClient().queryApi(catalogHrn, settings)
val readEngine = DataEngine().readEngine(catalogHrn, settings)

// download payload for partition
def downloadData(partition: Partition): Future[Option[String]] =
  readEngine
    .getDataAsBytes(partition)
    .map(bytes => Some(new String(bytes)))
    .recover { case _ => None }

// using this time as an example:
// Friday, October 18, 2019 1:45:20 PM GMT
val timestampSinceEpochInMs = 1571406320000L
val timestampSinceEpochInMsPlusOneHour = timestampSinceEpochInMs + 3600 * 1000

// empty filter means that no filter is applied
val emptyFilter: VolatilePartitionsFilter = VolatilePartitionsFilter.empty

// filter all partitions from timestampSinceEpochInMs to now
val sinceFilter1: VolatilePartitionsFilter =
  VolatilePartitionsFilter.since(timestampSinceEpochInMs)

// combination of two since filters will effectively use the younger/higher timestamp
val sinceFilter2: VolatilePartitionsFilter = VolatilePartitionsFilter.since(
  timestampSinceEpochInMs) and VolatilePartitionsFilter
  .since(timestampSinceEpochInMsPlusOneHour)

// filter partitions with ids 1, 2 and 3
val byIdsFilter1: VolatilePartitionsFilter =
  VolatilePartitionsFilter.byIds(Set("1", "2", "3"))

// combination of two byIds filter results in a filter with the intersection of the ids, in this case 1
val byIdsFilter2: VolatilePartitionsFilter = VolatilePartitionsFilter.byIds(
  Set("1", "2", "3")) and VolatilePartitionsFilter.byIds(Set("1"))

// combination of two byIds filter with non-overlapping sets results in empty ids, so no partition
val byIdsFilter3: VolatilePartitionsFilter = VolatilePartitionsFilter.byIds(
  Set("1", "2", "3")) and VolatilePartitionsFilter.byIds(Set("4"))

// combination of byIds filter and since filter
val combinedFilter
  : VolatilePartitionsFilter = VolatilePartitionsFilter.byIds(Set("1")) and VolatilePartitionsFilter
  .since(timestampSinceEpochInMs)

// fetch metadata once, can be cached on the client
val partitions: Future[Source[Partition, NotUsed]] =
  queryApi.getVolatilePartitions(layerId, combinedFilter)

// keep reading data for volatile layer as needed
partitions.flatMap { ps: Source[Partition, NotUsed] =>
  ps.mapAsync(parallelism = 10) { partition: Partition =>
      downloadData(partition)
    }
    .runWith(Sink.foreach(println))
}
// create queryApi and readEngine
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

// download payload for partition
Function<Partition, CompletionStage<Optional<byte[]>>> fetchData =
    (partition) -> {
      return readEngine
          .getDataAsBytes(partition)
          .thenApply(Optional::of)
          .exceptionally(failure -> Optional.empty());
    };

// using this time as an example:
// Friday, October 18, 2019 1:45:20 PM GMT
Long timestampSinceEpochInMs = 1571406320000L;
Long timestampSinceEpochInMsPlusOneHour = timestampSinceEpochInMs + 3600 * 1000;

// empty filter means that no filter is applied
VolatilePartitionsFilter emptyFilter = new VolatilePartitionsFilter.Builder().build();

// filter all partitions from timestampSinceEpochInMs to now
VolatilePartitionsFilter sinceFilter1 =
    new VolatilePartitionsFilter.Builder().withSinceTimestamp(timestampSinceEpochInMs).build();

// combination of two since filters will effectively use the younger/higher timestamp
VolatilePartitionsFilter sinceFilter2 =
    new VolatilePartitionsFilter.Builder()
        .withSinceTimestamp(timestampSinceEpochInMs)
        .build()
        .and(
            new VolatilePartitionsFilter.Builder()
                .withSinceTimestamp(timestampSinceEpochInMsPlusOneHour)
                .build());

String partition1 = "1";
String partition2 = "2";
String partition3 = "3";
String partition4 = "4";
Set<String> partitions1 = new HashSet<String>();
partitions1.add(partition1);
Set<String> partitions4 = new HashSet<String>();
partitions4.add(partition4);
Set<String> partitions123 = new HashSet<String>();
partitions123.add(partition1);
partitions123.add(partition2);
partitions123.add(partition3);

// filter partitions with ids 1, 2 and 3
VolatilePartitionsFilter byIdsFilter1 =
    new VolatilePartitionsFilter.Builder().withIds(partitions123).build();

// combination of two byIds filter results in a filter with the intersection of the ids, in this
// case 1
VolatilePartitionsFilter byIdsFilter2 =
    new VolatilePartitionsFilter.Builder()
        .withIds(partitions123)
        .build()
        .and(new VolatilePartitionsFilter.Builder().withIds(partitions1).build());

// combination of two byIds filter with non-overlapping sets results in empty ids, so no
// partition
VolatilePartitionsFilter byIdsFilter3 =
    new VolatilePartitionsFilter.Builder()
        .withIds(partitions123)
        .build()
        .and(new VolatilePartitionsFilter.Builder().withIds(partitions4).build());

// combination of byIds filter and since filter
VolatilePartitionsFilter combinedFilter =
    new VolatilePartitionsFilter.Builder()
        .withIds(partitions1)
        .build()
        .and(
            new VolatilePartitionsFilter.Builder()
                .withSinceTimestamp(timestampSinceEpochInMs)
                .build());

// fetch metadata once, can be cached on the client
CompletionStage<Source<Partition, NotUsed>> partitions =
    queryApi.getVolatilePartitions(layer, combinedFilter, Collections.emptySet());

int parallelism = 10;

// keep reading data for volatile layer as needed
partitions.thenApply(
    partitionsSource -> {
      return partitionsSource
          .mapAsync(parallelism, fetchData::apply)
          .runWith(Sink.foreach(System.out::println), myMaterializer);
    });

VolatilePartitionsFilter ビルダーを使用することもできます。

並列でデータを取得します

この例に示すよう parallelism に、パラメータを使用して、データ クライアント ライブラリが blob をフェッチするために行う並列要求の数を管理します。 最適な値は、ノードの設定、 RAM 、 CPU 、およびネットワークによって異なります。 100 を超える並列リクエストを使用すると、パフォーマンスに悪影響がありました。

インデックス レイヤー

改ページ調整を使用するには、メソッド QueryApi.queryIndexPartsを実行し 照会操作の範囲を制限するために使用できるレイヤーパーツを表すパーツ ID のリストを返します。 これにより、複数のパーツを使用して並列クエリを実行できます。 ユーザーが必要な数のパーツを入力する必要があります。サービスはパーツ ID のリストを返します。 リクエストされた数のパーツが小さすぎる場合があります。この場合、サービスからリクエストされた数よりも少ない量のパーツが返される可能性があります。 インデックスパーツを取得 する方法の例については、以下のサブセクション「インデックスパーツを取得」を参照してください。

インデックス レイヤーからデータを取得するに QueryApi.queryIndexは、まずメソッドを呼び出す必要があります。 QueryApi.queryIndex IndexPartition指定したクエリーに一致するを返します。 クエリーが指定されていない場合、デフォルトでは「 timestamp=ge =0 」の値が使用され、すべてのパーティションが照合されます。

次に ReadEngine.getDataAsBytes 、それぞれのメソッドを呼び出し IndexPartition 、 blob API を使用して対応するデータを取得します。 1 つのパーティションのデータの取得には時間がかかり、 QueryApi.queryIndex 数百、数千のパーティションが返される可能性があるため、これらのパーティションに対応するデータを並行して取得することをお勧めします。 以下の例では、まずインデックスを照会してから、に対応するデータ IndexPartitions を並行して取得する方法について説明します。

適切な並列処理のレベルは、コードを実行するマシンと取得するオブジェクトのサイズによって異なります。

  • 並列処理のレベルを低く設定しすぎると、要求の実行オーバーヘッドのためにネットワーク帯域幅が完全に使用されません
  • 1 つの ActorSystem で 200 を超える並列ダウンロードなど、並列処理の設定が高すぎると、 Akka HTTP 接続プールにかかる圧力が大きすぎることを知らせる警告が表示され始めます。 この問題は、コードが非同期タスクの数をいっぱいにし、この場合、データ クライアント ライブラリがバックプレッシャーメカニズムを提供しないために発生します。

複数のレベルの並列処理を試すことで、最適なダウンロードパフォーマンスを得ることができます。 1 台のマシンにつき 10 回の並列ダウンロードから開始でき、パフォーマンスが低下するまでこの数を 10 ずつ増やすことができます。

注 : 使用状況の詳細

QueryApi.queryIndex このメソッドは、既定でパーツのインデックスパーティションを問い合わせます。 この動作は、設定プロパティ query-by-parts を使用して変更できます (「設定」の章を参照)。

インデックスパーツを取得します

part クエリを実行するには QueryApi.queryIndexParts 、メソッドを実行します。

Scala
Java
// Query the index layer with pagination
import scala.concurrent.Await
import scala.concurrent.duration._
//number of parts you want to split all your index partitions in the layer
val numberOfParts = 50
val indexParts =
  Await.result(queryApi.queryIndexParts(indexLayerId, numberOfParts), 10.seconds)
// Query the index layer with pagination
int numberOfParts = 50;

IndexParts indexParts =
    queryApi.queryIndexParts(indexLayerId, numberOfParts).toCompletableFuture().join();

インデックス レイヤーを照会します

インデックス付けされたデータをクエリするに は、 RSQL クエリ言語でいくつかの検索条件を指定する必要があります。

RSQL は、次の論理演算子をサポートしています。

演算子 説明
; または and 論理積
, または or 論理和

RSQL は、次の比較演算子をサポートしています。

演算子 説明
== 等しい
!= 等しくありません
< または =lt= より小さい
<= または =le= 以下
> または =gt= より大きい
>= または =ge= 以上
< または =lt= より小さい

RSQL 式の例を次に示します。

  • someIntKey==42
  • someStringKey!=abc
  • someStringKey=="Hello World!"
  • someIntKey<100;someBooleanKey==true
  • (someIntKey=gt=23,someStringKey==xyz);someBooleanKey==true

上記の例を動作させるには IndexLayerType 、照会されたインデックス レイヤーのに次 IndexDefinition のオブジェクトが含まれている必要があります。

  • IndexDefinition ("someIntKey", IndexType.Int)
  • IndexDefinition ("someBooleanKey", IndexType.Boolean)
  • IndexDefinition ("someStringKey", IndexType.Boolean)

次のコード スニペットは someIntKey 、属性が 42 よりも上で someStringKey 、属性が「 abc 」でないパーティションを取得します。 返されたパーティションに対応するデータのパラレルフェッチを簡素化するために Akka ソースを返し ます。データの取得方法については、次のサブセクション「インデックスデータの取得」を参照してください。

Scala
Java
import scala.concurrent.Await
import scala.concurrent.duration._

val queryString = "someIntKey>42;someStringKey!=abc"
val parallelism = 10

val foundIndexPartitionsAsSource: Source[IndexPartition, NotUsed] =
  Source(indexParts.parts)
    .mapAsync(parallelism) { part =>
      queryApi
        .queryIndex(indexLayerId, Some(queryString), Some(part))
    }
    .flatMapConcat(identity)
// How to query the index layer
String queryString = "someIntKey>42;someStringKey!=abc";

Source<IndexPartition, NotUsed> indexPartitionsSource =
    Source.from(indexParts.getParts())
        .mapAsync(
            10, part -> queryApi.queryIndex(indexLayerId, Optional.of(queryString), part))
        .flatMapConcat(s -> s);

クエリの形式および制約の詳細について は、「 Data API 開発者ガイド」の「 Get the データ ハンドル」セクションも参照してください。

インデックスデータを取得します

前のサブセクション 「インデックス レイヤーのクエリ」では、QueryApi.queryIndexを使用してインデックス レイヤーをクエリする方法を示しました。 以下のコード スニペットは、 Akka ストリームReadEngine.getDataAsBytesを使用してQueryApi.queryIndex返されたIndexPartitionから、各パーティションに対応するデータを並列に取得する方法を示しています。

Scala
Java
println(
  "Download the data corresponding to the index partitions previously found by the queryIndex method")

implicit val materializer: ActorMaterializer = ActorMaterializer()
def youCanProcessTheDataHere(byteData: Array[Byte]): Unit = ???

foundIndexPartitionsAsSource
  .mapAsyncUnordered(parallelism)(partition => readEngine.getDataAsBytes(partition))
  .runForeach((byteData: Array[Byte]) => youCanProcessTheDataHere(byteData))
  .await

println("Computation finished. Shutting down the HTTP connections and the actor system.")
Await.ready(CoordinatedShutdown(actorSystem).run(UnknownReason), Duration.Inf)
ActorMaterializer actorMaterializer = ActorMaterializer.create(actorSystem);

System.out.println(
    "Download the data corresponding to the index partitions previously found by the queryIndex method");

int parallelism = 10;
indexPartitionsSource
    .mapAsyncUnordered(parallelism, readEngine::getDataAsBytes)
    // Replace the method youCanProcessTheDataHere with your own code.
    .runForeach(this::youCanProcessTheDataHere, actorMaterializer)
    .toCompletableFuture()
    .join();

System.out.println(
    "Computation finished. Shutting down the HTTP connections and the actor system.");
CoordinatedShutdown.get(actorSystem)
    .runAll(CoordinatedShutdown.unknownReason())
    .toCompletableFuture()
    .join();

オブジェクト ストア レイヤー

オブジェクト ストア レイヤー内のデータを参照するための制御権を持っているキー。 データは変更可能で、並列書き込みが可能です。 つまり、複数のライターが同じキーに並行して書き込みを行っている場合、サーバーで最後に完了したリクエストが処理されます。 クライアントコードは、その特定のキーのデータを取得するときにこの状況を想定できるように準備しておく必要があります。

Akka ソースとしてデータを取得するには、次のものを追加します。

Scala
Java
// create readEngine
val readEngine = DataEngine().readEngine(catalogHrn, settings)

val applyDecompression = readEngine
  .getObjectMetadata(layer, key)
  .map(_.getContentEncoding().contains(ContentEncoding.gzip))
  .await

// full object as dataSource
val dataAsSource: Future[Source[ByteString, NotUsed]] =
  readEngine
    .getObjectDataAsSource2(layer, key, applyDecompression)

// full object as an array of bytes
val dataAsBytes: Future[Array[Byte]] =
  readEngine
    .getObjectDataAsBytes2(layer, key, applyDecompression)

// partial object with provided range as dataSource
val dataAsSourceWithRange: Future[Source[ByteString, NotUsed]] =
  readEngine
    .getObjectDataAsSource2(layer, key, applyDecompression, ByteRange.fromRange(5, 10))

// partial object with provided range as an Array of bytes
val dataAsBytesWithRange: Future[Array[Byte]] =
  readEngine
    .getObjectDataAsBytes2(layer, key, applyDecompression, ByteRange.fromRange(5, 10))
// create readEngine
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

// full object as dataSource
CompletionStage<Source<ByteString, NotUsed>> dataAsSource =
    readEngine.getObjectDataAsSource2(layer, key, false, ByteRange.all());

// partial object with provided range as dataSource
CompletionStage<Source<ByteString, NotUsed>> dataAsSourceWithRange =
    readEngine.getObjectDataAsSource2(layer, key, false, ByteRange.fromRange(5, 10));

// full object as an Array of bytes
CompletionStage<byte[]> dataAsByteArray =
    readEngine.getObjectDataAsBytes2(layer, key, false, ByteRange.all());

// partial object as an Array of bytes with provided range
CompletionStage<byte[]> dataAsByteArrayWithRange =
    readEngine.getObjectDataAsBytes2(layer, key, false, ByteRange.fromRange(5, 10));

Interactive マップ レイヤー

指定したカタログが存在する限り、対話式マップ レイヤーのデータを利用できます。

インタラクティブなマップ レイヤーからデータを取得するには、次のメソッドを使用します。

提供されている ID のリストに含まれているすべての機能をインタラクティブなマップ レイヤーで戻すに QueryApi.getFeatureCollectionByIds は、 API 呼び出しを使用します。

このメソッドは、次の 6 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • ids - インタラクティブマップ レイヤーから取得する機能 ID のリスト。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )
  • author - フィーチャコレクションの作成者 ( オプションのパラメータ )

以下のスニペットで QueryApi.getFeatureCollectionByIds は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

val ids = Seq("feature-1", "feature-2")

// Adding interactive map context to execute operation in the extension
val context = InteractiveMapContext.EXTENSION

// Adding version to return features with the given version
val version = 123L

// Adding author to return features with the given author
val author = "<feature-collection-author>"

val response: Future[FeatureCollection] =
  queryApi.getFeatureCollectionByIds(
    layerId,
    ids,
    Set.empty,
    Some(context),
    Some(version),
    Some(author)
  )

val featureCollection = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

// list of ids to query
List<String> ids = Collections.singletonList("feature-1");
long version = 123L;
String author = "<feature-collection-author>";

FeatureCollection featureCollection =
    queryApi
        .getFeatureCollectionByIds(
            layerId,
            ids,
            Collections.emptySet(),
            Optional.of(context),
            OptionalLong.of(version),
            Optional.of(author))
        .toCompletableFuture()
        .join();

インタラクティブなマップ レイヤーのバウンディング ボックス内にある機能を戻すに QueryApi.getFeatureCollectionByBbox は、 API 呼び出しを使用します。

このメソッドは、次の 7 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • bbox - 機能を検索する必要があるバウンディング ボックス。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

インタラクティブなマップ レイヤーのバウンディング ボックス内にある 4 つの Bin を戻すに QueryApi.getQuadBinsByTileId は、 API 呼び出しを使用します。 4 つのビンについては、データ開発ガイドの「タイルでクラスタ化された機能を利用する」を参照してください。 この関数は、バウンディング ボックスが含まれている最小の quadkey の quadbins を返すことに注意してください。

このメソッドは、次の 8 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • bbox - 機能を検索する必要があるバウンディング ボックス。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • relativeResolution - 2 つのビンの解像度。 有効な値は [0,4] です。
  • noBuffer - 二段組みの周囲にはバッファを置かないでください。
  • countMode - quadbin の count モード。 有効な値については、以下を参照してください。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

インタラクティブなマップ レイヤーのバウンディング ボックス内にある 16 進数を戻すに QueryApi.getHexBinsByTileId は、 API 呼び出しを使用します。 hexbins の説明については、データ開発ガイドの「タイルでのクラスタ化された機能の取得」を参照してください。 この関数は、バウンディング ボックスを含む最小 quadkey の 16 進数を返します。

このメソッドは、次のように 11 の引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • bbox - 機能を検索する必要があるバウンディング ボックス。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • absoluteResolution - H3 六角分解能。 有効な値は [0,13] です。
  • relativeResolution - 絶対解像度に相対解像度が追加されました。 有効な値は [-2,2] です。
  • property - 統計情報を計算する元の機能のプロパティ。
  • pointMode - 六角形の中心点を GeoJSON フィーチャとして返します。 デフォルトは false です。
  • singleCoord - 最初のオブジェクトの座標のみを評価するように強制します。 デフォルトは false です。
  • sampling - 基盤となるデータセットのサンプリング比率。 有効な値については、以下を参照してください。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

インタラクティブマップ レイヤーのタイルタイプおよびタイル ID によって選択された機能を戻すに QueryApi.getFeatureCollectionByTile は、 API コールを使用できます。

このメソッドは、次の 8 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • tileId - クエリー対象のタイル ID 。
  • tileType - タイル識別子のタイプ。 使用できる値は、 quadkey 、 Web 、 TMS 、および HERE です。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

マップ レイヤータイプの対話型タイルを使用してタイル内にある quadbins を戻すに QueryApi.getQuadBinsByTileId は、 API 呼び出しを使用します。 4 つのビンについては、データ開発ガイドの「タイルでクラスタ化された機能を利用する」を参照してください。 タイルのタイプが quadkey でない場合、この関数はタイルを含む最小の quadkey の quadbins を返すことに注意してください。

このメソッドは、次の 7 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • tileId - クエリー対象のタイル ID 。
  • tileType - タイル識別子のタイプ。 使用できる値は、 quadkey 、 Web 、 TMS 、および HERE です。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • relativeResolution - 2 つのビンの解像度。 有効な値は [0,4] です。
  • noBuffer - 二段組みの周囲にはバッファを置かないでください。
  • countMode - quadbin の count モード。 有効な値については、以下を参照してください。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。

タイルタイプのインタラクティブマップ レイヤーを使用して、タイル内にある 16 進数を戻すに QueryApi.getHexBinsByTileId は、 API 呼び出しを使用します。 hexbins の説明については、データ開発ガイドの「タイルでのクラスタ化された機能の取得」を参照してください。 タイルのタイプが quadkey でない場合、この関数はタイルを含む最小の quadkey の 16 進数を返します。

このメソッドは、次の 9 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • tileId - クエリー対象のタイル ID 。
  • tileType - タイル識別子のタイプ。 使用できる値は、 quadkey 、 Web 、 TMS 、および HERE です。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • absoluteResolution - H3 六角分解能。 有効な値は [0,13] です。
  • relativeResolution - 絶対解像度に相対解像度が追加されました。 有効な値は [-2,2] です。
  • property - 統計情報を計算する元の機能のプロパティ。
  • pointMode - 六角形の中心点を GeoJSON フィーチャとして返します。 デフォルトは false です。
  • singleCoord - 最初のオブジェクトの座標のみを評価するように強制します。 デフォルトは false です。
  • sampling - 基盤となるデータセットのサンプリング比率。 有効な値については、以下を参照してください。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。

インタラクティブなマップ レイヤーからパラメータを検索して機能を戻すに QueryApi.getFeatureCollectionBySearchParam は、 API 呼び出しを使用します。

このメソッドは、次の 7 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )
  • author - フィーチャコレクションの作成者 ( オプションのパラメータ )

以下のスニペットで QueryApi.getFeatureCollectionBySearchParam は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

// Adding search parameters to fetch the filtered data
val searchParams = Set(SearchParam("p.prop1", SearchOperator.EQUAL, "some-value1"),
                       SearchParam.fromString("p.prop2>=10"))

// Adding list of properties to be returned in the features
val selection = Set("p.prop1", "p.prop2")

// Adding to limit the size of the response features to 100
val limit = 100

// Adding interactive map context to execute operation in the extension
val context = InteractiveMapContext.EXTENSION

// Adding version to return features with the given version
val version = 123L

// Adding author to return features with the given author
val author = "<feature-collection-author>"

val response: Future[FeatureCollection] =
  queryApi.getFeatureCollectionBySearchParam(layerId,
                                             searchParams,
                                             selection,
                                             Some(limit),
                                             Some(context),
                                             Some(version),
                                             Some(author))
val featureCollection = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

// Adding search parameters to fetch the filtered data
SearchParam searchParam1 = new SearchParam("p.prop1", SearchOperator.EQUAL, "some-value");
SearchParam searchParam2 = SearchParam.fromString("p.prop2>=10");
Set<SearchParam> searchParams = new HashSet<>();
searchParams.add(searchParam1);
searchParams.add(searchParam2);

// Adding list of properties to be returned in the features
Set<String> selection = new HashSet<>(Arrays.asList("p.prop1", "p.prop2"));

// Adding to limit the size of the response features to 100
int limit = 100;

// Adding interactive map context to execute operation in the extension
InteractiveMapContext context = InteractiveMapContext.EXTENSION;

// Adding version to return features with the given version
long version = 123L;

// Adding author to return features with the given author
String author = "<feature-collection-author>";

FeatureCollection featureCollection =
    queryApi
        .getFeatureCollectionBySearchParam(
            layerId,
            searchParams,
            selection,
            OptionalInt.of(limit),
            Optional.of(context),
            OptionalLong.of(version),
            Optional.of(author))
        .toCompletableFuture()
        .join();

指定した円の内側にあるフィーチャーを戻し、指定した円(緯度)と円(経度)を中心として戻すに QueryApi.getFeatureCollectionBySpatialSearchCircle は、 API 呼び出しを使用します。

このメソッドは、次の 9 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • latitude - 中心点の WGS '84 の 10 進度 (-90 ~ +90) の緯度。
  • longitude - 中心点の WGS '84 の 10 進度 (-180 ~ +180) の経度。
  • radius - 円の半径 ( メートル単位 ) 。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

指定した参照フィーチャーのジオメトリと交差するフィーチャーを戻すに QueryApi.getFeatureCollectionBySpatialSearchFeature は、 API 呼び出しを使用できます。

このメソッドは、次の 10 の引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • refCatalogHrn - 参照されているフィーチャーを含むレイヤーが保存されているカタログ HERE リソースネーム 。
  • refLayerId - 参照先のフィーチャーが保存されているレイヤー ID 。
  • refFeatureId - 参照されているレイヤーのフィーチャー ID 。
  • radius - ジオメトリにバッファとして追加される半径 ( メートル単位 ) 。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context -インタラクティブマップコンテキスト(オプションパラメータ)-有効な値のリストについては、以下を参照してください
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

提供された形状と交差するフィーチャーを戻すには QueryApi.getFeatureCollectionBySpatialSearchGeometry 、 API 呼び出しを使用できます。

このメソッドは、次の 8 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • geometry - 検索の原点として使用されるジオメトリ。
  • radius - ジオメトリにバッファとして追加される半径 ( メートル単位 ) 。
  • searchParam - 追加の機能フィルタのリスト。その結果、機能のサブセットが作成されます。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

以下のスニペットで QueryApi.getFeatureCollectionBySpatialSearchGeometry は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

val geometry = Point(coordinates = Some(immutable.Seq(10.0, 12.0)))
val radius = 50

// Adding interactive map context to execute operation in the extension
val context = InteractiveMapContext.EXTENSION

// Adding version to return features with the given version
val version = 123L

val response: Future[FeatureCollection] =
  queryApi.getFeatureCollectionBySpatialSearchGeometry(
    layerId,
    geometry,
    Some(radius),
    Set.empty,
    Set.empty,
    None,
    Some(context),
    Some(version)
  )

val featureCollection = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

Geometry geometry =
    new Point.Builder().withCoordinates(new ArrayList<>(Arrays.asList(10.0, 12.0))).build();
int radius = 50;

// Adding interactive map context to execute operation in the extension
InteractiveMapContext context = InteractiveMapContext.EXTENSION;
// Adding version to return features with the given version
OptionalLong version = OptionalLong.of(123L);

FeatureCollection featureCollection =
    queryApi
        .getFeatureCollectionBySpatialSearchGeometry(
            layerId,
            geometry,
            OptionalInt.of(radius),
            Collections.emptySet(),
            Collections.emptySet(),
            OptionalInt.empty(),
            Optional.of(context),
            version)
        .toCompletableFuture()
        .join();

インタラクティブなマップ レイヤーのすべての機能を反復処理して機能を戻すに QueryApi.getFeatureCollectionByIterate は、 API 呼び出しを使用します。

このメソッドは、次の 6 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • pageToken - イテレーションを続行するページトークン。
  • selection - フィーチャーの結果リストに返されるプロパティのリスト。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。
  • version - フィーチャコレクションのバージョン ( オプションのパラメータ )

指定したレイヤーからフィーチャーを含むすべてのタイルを取得するに QueryApi.getTilesContainingFeatures は、 API 呼び出しを使用します。

このメソッドは、次の 5 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • startingTiles - 反復処理する高レベルのタイル。 サポートされているタイルタイプは quadkey のみです。 空の場合、ウェブメルカトル図法の範囲内のすべてのタイル (-85.05 ° ~ +85.05 ° の緯度 ) が取得されます。
  • targetZoomLevel - 戻すタイルのターゲットレベル。 返されたすべてのタイルは同じターゲットレベルになります。
  • parallelization - 基盤となるサービスへの並列コールの最大数。
  • context - インタラクティブマップコンテキスト ( オプションのパラメータ )- 有効な値の一覧については、以下を参照してください。

以下のスニペットで QueryApi.getTilesContainingFeatures は、 API の使用方法について説明します。

Scala
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)
val startingTiles = Seq(Tile("120", TileType.QUADKEY))
val targetZoomLevel = 8
val parallelization = 1
val tilesAsSource: Future[Source[Seq[Tile], NotUsed]] =
  queryApi.getTilesContainingFeatures(layerId,
                                      startingTiles,
                                      targetZoomLevel,
                                      parallelization,
                                      Some(context))

val response: Future[Seq[Seq[Tile]]] =
  Await.result(tilesAsSource, timeout).runWith(Sink.seq[Seq[Tile]])
val tiles: Seq[Tile] = Await.result(response, timeout).flatten

// Check the total features in the layer
println(s"FeatureCount: ${tiles.size}")

インタラクティブマップ レイヤーの統計情報を返すに QueryApi.getIMLStatistics は、 API コールを使用します。

このメソッドは、次のように引数を 1 つ受け取ります。

  • layerId - レイヤーのレイヤー ID 。

以下のスニペットで QueryApi.getIMLStatistics は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

val response = queryApi.getIMLStatistics(layerId)
val statistics = Await.result(response, timeout)

// Check the total features in the layer
println(s"FeatureCount: ${statistics.getCount.getValue}")
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

Statistics statistics = queryApi.getIMLStatistics(layerId).toCompletableFuture().join();

インタラクティブなマップ レイヤーから既存の変更セットを取得するに QueryApi.getFeaturesChanges は、 API 呼び出しを使用します。

このメソッドは、次の 4 つのパラメータを使用します。

  • layerId - レイヤーのレイヤー ID 。
  • startVersion - version-range の開始 [version>=startVersion]
  • endVersion - version-range の末尾 [version<=endVersion]
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。

以下のスニペットで QueryApi.getFeaturesChanges は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

val startVersion = 0L
val endVersion = 1000L

// Adding limit to limit the size of the response features to 100
val limit = 100

// get all features with startVersion <= version <= endVersion
val response = queryApi.getFeatureChanges(
  layerId,
  startVersion,
  endVersion,
  Some(limit)
)

val source = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

long startVersion = 0L;
long endVersion = 1000L;

// Adding limit to limit the size of the response features to 100
int limit = 100;

// get all features with startVersion <= version <= endVersion
Source<Pair<Long, Changeset>, NotUsed> source =
    queryApi
        .getFeatureChanges(layerId, startVersion, endVersion, OptionalInt.of(limit))
        .toCompletableFuture()
        .join();

Changeset インタラクティブなマップ レイヤーからバージョンによって定義されたものを取得するに QueryApi.getFeatureChangesByVersion は、 API 呼び出しを使用します。

このメソッドは、次の 3 つのパラメータを使用します。

  • layerId - レイヤーのレイヤー ID 。
  • version - 変更セットのバージョン。
  • limit - 応答の最大機能数 ( デフォルトは 30K 、最大数は 100K) 。

以下のスニペットで QueryApi.getFeatureChangesByVersion は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)

// Adding version of the changeset to retrieve
val version = 8L

// Adding limit to limit the size of the response features to 100
val limit = 100

// get changeset from the layer corresponding to the given version
val response = queryApi.getFeatureChangesByVersion(
  layerId,
  version,
  Some(limit)
)
val changeset = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

// Adding version of the changeset to retrieve
long version = 8L;

// Adding limit to limit the size of the response features to 100
int limit = 100;

// get changeset from the layer corresponding to the given version
Changeset changeset =
    queryApi
        .getFeatureChangesByVersion(layerId, version, OptionalInt.of(limit))
        .toCompletableFuture()
        .join();

対話型マップ レイヤーの変更セットに関する統計情報を取得するに QueryApi.getFeatureChangesStatistics は、 API 呼び出しを使用します。

このメソッドは、次のように 1 つのパラメータを取ります。

  • layerId - レイヤーのレイヤー ID 。

以下のスニペットで QueryApi.getFeatureChangesStatistics は、 API の使用方法について説明します。

Scala
Java
// create queryApi
val queryApi = DataClient().queryApi(catalogHrn, settings)
val response = queryApi.getFeatureChangesStatistics(layerId)
val statistics = Await.result(response, timeout)
// create queryApi
QueryApi queryApi = DataClient.get(myActorSystem).queryApi(catalogHrn);

//
ChangesetStatistics statistics =
    queryApi.getFeatureChangesStatistics(layerId).toCompletableFuture().join();

インタラクティブなマップ レイヤーからすべての機能をエクスポートするに readEngine.exportIMLFeatures は、 API 呼び出しを使用します。

このメソッドは、次の 2 つの引数を取ります。

  • layerId - レイヤーのレイヤー ID 。
  • batchSize- インタラクティブなマップ レイヤーから反復するバッチサイズ

以下のスニペットで readEngine.exportIMLFeatures は、 API の使用方法について説明します。

Scala
Java
// create readEngine
val readEngine = DataEngine().readEngine(catalogHrn, settings)

val batchSize = 100

val futureResponse = readEngine.exportIMLFeatures(layerId, Some(batchSize)).runWith(Sink.seq)

val response: Seq[Seq[Feature]] = Await.result(futureResponse, timeout)
// create readEngine
ReadEngine readEngine = DataEngine.get(myActorSystem).readEngine(catalogHrn);

int batchSize = 100;

Source<List<Feature>, NotUsed> responseSource =
    readEngine.exportIMLFeatures(layerId, OptionalInt.of(batchSize));

List<List<Feature>> response =
    responseSource.runWith(Sink.seq(), myMaterializer).toCompletableFuture().join();

注 : SearchParams で追加のフィルタを使用すると、フィーチャのサブセットを作成できます。 プロパティ検索に使用できるプレフィックスは次のとおりです。

  'p.' - used to access values stored in 'properties' property of the feature
  'f.' - used to access values which are added by default in the stored feature,The possible values are: 'f.id', 'f.createdAt' and 'f.updatedAt'.

  Example -
  p.property_1=property_value_1 or
  f.special_property_1=special_property_value_1

ユーザーは、次の論理演算子を使用して、 SearchParams で検索条件を指定できます。

  "=" - equals
  "!=" - not equals
  ">=" or "=gte=" - greater than or equals
  "<=" or "=lte=" - less than or equals
  ">" or "=gt=" - greater than
  "<" or "=lt=" - less than
  "@>" or "=cs=" - contains

Interactive Map リクエストの有効な値

コンテキスト

  • DEFAULT = 指定されていない場合のデフォルト値。 複合レイヤーの場合、拡張ルールに基づいて操作が行われます。 通常のレイヤーでは、これが唯一の有効なコンテキストです。
  • EXTENSION = 操作は拡張内でのみ実行され、拡張レイヤーでは実行されません。
  • SUPER = 読み取り操作にのみ適用されます。 操作は、拡張するレイヤー(スーパーレイヤー)でのみ実行されます。

quadbin/hexbin リクエストの有効な値 :

CountMode

  • real = 実際の機能数。 最高の精度ですが、時間がかかります。 大きな結果セットにはお勧めできません
  • estimated = 推定機能数。 精度は低いですが、非常に高速です。 大きな結果セットに適しています。
  • mixed = ( デフォルト ) 。 実際の機能と合わせた推定機能数。 概算値が小さい場合は、実際の数が適用されます。 ほとんどのユースケースに適合します
  • bool = データがタイル に存在するが、機能をカウントしないかどうかをテストします。 空でないタイルの場合、返される count プロパティは 1 に設定されます

サンプリング

基になるデータセット値のサンプリング比率を設定します。

  • off = ( 既定 ) データセット全体がサンプリングされます。
  • low = データセットの 1/8 がサンプリングされます。
  • lowmed =1/32 のデータセットがサンプリングされます。
  • med =1/128 のデータセットがサンプリングされます。
  • medhigh =1/1024 のデータセットがサンプリングされます。
  • high =1/4096 のデータセットがサンプリングされます。

」に一致する結果は 件です

    」に一致する結果はありません