val p3v1 = graph.target(edges.last)
println(s"... and one to $p3v1")try{
graph.outEdgeIterator(p3v1)}catch{case _: NoSuchElementException =>
println("which cannot be expanded")
println("because its partition is not present")}
val cutGraph =new TiledGraph(graphTiles.get)with TiledGraph.CutBorders
val cutEdges = cutGraph.outEdgeIterator(p3v1)
println(s"... unless we cut the graph's borders")
assert(cutEdges.isEmpty)
println("in which case the missing vertex will have no outgoing edges")
タイリングされたマップにアクセスするには、必要なパーティションのタイル ID を計算する方法が必要です。 使用しようとしているマップ データのパーティション分割方式またはタイルレベルを事前に把握できないため、この機能を一般的に実装する方法はありません。 そのため 、さまざまなエリアクエリのタイル ID を計算できる TileResolver を使用する必要があります。
Scala
Java
importcom.here.platform.location.inmemory.geospatial.TileResolver
importcom.here.platform.location.integration.herecommons.geospatial.{
HereTileLevel,
HereTileResolver
}// Construct a resolver for the HEREtile scheme on level 14val outputLevel = HereTileLevel(14)val resolver: TileResolver =new HereTileResolver(outputLevel)
importcom.here.platform.location.integration.herecommons.geospatial.HereTileLevel;importcom.here.platform.location.integration.herecommons.geospatial.javadsl.HereTileResolver;// Construct a resolver for the HEREtile scheme on level 14HereTileLevel outputLevel =newHereTileLevel(14);HereTileResolver resolver =newHereTileResolver(outputLevel);
次のスニペットは、クエリの例を示しています。
ポイントで検索 :
Scala
Java
importcom.here.platform.location.core.geospatial.GeoCoordinate
val point =new GeoCoordinate(latitude =0.0, longitude =53.0)val pointTile = resolver.fromCoordinate(point)
println(s"The $point is inside the level ${outputLevel.value} tile with id ${pointTile.value}")
importcom.here.platform.location.core.geospatial.GeoCoordinate;GeoCoordinate point =newGeoCoordinate(0.0,53.0);long pointTile = resolver.fromCoordinate(point);System.out.printf("The %s is inside the level %s tile with id %s%n", point, outputLevel.value(), pointTile);
半径で検索 :
Scala
Java
val radiusInMeters =1000.0val radiusTiles = resolver.fromCenterAndRadius(point, radiusInMeters)
println(s"The following tiles are within $radiusInMeters meters of $point:")
radiusTiles.foreach(println)
double radiusInMeters =1000.0;Set<Long> radiusTiles = resolver.fromCenterAndRadius(point, radiusInMeters);System.out.printf("The following tiles are within %s meters of %s: %s%n", radiusInMeters, point, radiusTiles);
バウンディングボックスで検索 :
Scala
Java
importcom.here.platform.location.core.geospatial.BoundingBox
val bb = BoundingBox(northLatitude =52.53047,
southLatitude =52.51708,
westLongitude =13.39632,
eastLongitude =13.42293)val bbTiles = resolver.fromBoundingBox(bb)
println(s"The following tiles are intersecting $bb:")
bbTiles.foreach(println)
importcom.here.platform.location.core.geospatial.BoundingBox;BoundingBox bb =newBoundingBox(52.53047,52.51708,13.42293,13.39632);Set<Long> bbTiles = resolver.fromBoundingBox(bb);System.out.printf("The following tiles are intersecting %s: %s%n", bb, bbTiles);
val boundingBox = HereTileResolver.boundingBoxOf(pointTile)
println(s"The following bbox are covered by tile ${pointTile.value}: $boundingBox")
importcom.here.platform.location.core.geospatial.BoundingBox;BoundingBox boundingBox =HereTileResolver.boundingBoxOf(pointTile);System.out.printf("The following bbox are covered by tile %s: %s%n", pointTile, boundingBox);