Skip to content

How to Index Pyramid Tiles with Custom Encoding #3512

@KiktMa

Description

@KiktMa
    Pyramid.upLevels(reprojected, tarlayoutScheme,startZoom, endZoom, Bilinear) { (rdd, z) =>
      val layerId = LayerId("layer_"+tableName, z)

      val tilesWithMetadata: RDD[(SpatialKey, Tile, TileLayerMetadata[String])] = rdd.map { case (key, tile) =>
        val topLeftCode = GeoSot.INSTANCE.getHexCode(rdd.metadata.extent.xmin, rdd.metadata.extent.ymax, 0, z)
        val bottomRightCode = GeoSot.INSTANCE.getHexCode(rdd.metadata.extent.xmax, rdd.metadata.extent.ymin, 0, z)
        val metaData = TileLayerMetadata(
          cellType = tile.cellType,
          layout = rdd.metadata.layout,
          extent = rdd.metadata.mapTransform(key),
          crs = rdd.metadata.crs,
          bounds = KeyBounds(topLeftCode, bottomRightCode)
        )
        (key, tile, metaData)
      }
      val indexKeyBounds: KeyBounds[SpatialKey] = {
        val KeyBounds(minKey, maxKey):KeyBounds[SpatialKey] = tilesWithMetadata.foreach((S) => S._1)
        KeyBounds(minKey, maxKey)
      }
      val keyIndex =
        ZCurveKeyIndexMethod.createIndex(indexKeyBounds)

      if (attributeStore.layerExists(layerId)) {
        AccumuloLayerDeleter(attributeStore).delete(layerId)
      }
      writer.write(layerId, rdd, keyIndex)
    }

Can someone help me solve this? I customized a tile encoding method, which obtains a string encoding based on the position information and hierarchy of each tile. I wanted to use this encoding to replace the encoding of the Z curve, but I reported an error during compilation,

[ERROR] D:\JavaConsist\Project\geotrellis-cuts\src\main\scala\com\spark\demo\index\SelfIndex.scala:113: type mismatch;
found : Unit
required: geotrellis.spark.KeyBounds[geotrellis.spark.SpatialKey]
[ERROR] val KeyBounds(minKey, maxKey):KeyBounds[SpatialKey] = tilesWithMetadata.foreach((S) => S._ 1)
[ERROR] ^
[WARNING] one warning found
[ERROR] one error found

May I ask how to apply custom encoding to the pyramid model

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions