File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
main/scala/org/locationtech/rasterframes/tiles
test/scala/org/locationtech/rasterframes Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 2121
2222package org .locationtech .rasterframes .tiles
2323import org .locationtech .rasterframes ._
24- import geotrellis .raster .Tile
24+ import geotrellis .raster .{ Tile , isNoData }
2525
2626class ShowableTile (val delegate : Tile ) extends FixedDelegatingTile {
2727 override def equals (obj : Any ): Boolean = obj match {
@@ -39,8 +39,14 @@ object ShowableTile {
3939 val dims = tile.dimensions
4040
4141 val data = if (tile.cellType.isFloatingPoint)
42- tile.toArrayDouble()
43- else tile.toArray()
42+ tile.toArrayDouble().map {
43+ case c if isNoData(c) => " --"
44+ case c => c.toString
45+ }
46+ else tile.toArray().map {
47+ case c if isNoData(c) => " --"
48+ case c => c.toString
49+ }
4450
4551 val cells = if (tile.size <= maxCells) {
4652 data.mkString(" [" , " ," , " ]" )
Original file line number Diff line number Diff line change 2020 */
2121
2222package org .locationtech .rasterframes
23- import geotrellis .raster .{CellType , Tile }
23+ import geotrellis .raster
24+ import geotrellis .raster .{CellType , NoNoData , Tile }
2425import org .apache .spark .sql .catalyst .encoders .ExpressionEncoder
2526import org .apache .spark .sql .rf ._
2627import org .apache .spark .sql .types .StringType
@@ -98,6 +99,12 @@ class TileUDTSpec extends TestEnvironment with TestData with Inspectors {
9899 forEveryConfig { tile =>
99100 val stringified = Seq (tile).toDF(" tile" ).select($" tile" .cast(StringType )).as[String ].first()
100101 stringified should be(ShowableTile .show(tile))
102+
103+ if (! tile.cellType.isInstanceOf [NoNoData ]) {
104+ val withNd = tile.mutable
105+ withNd.update(0 , raster.NODATA )
106+ ShowableTile .show(withNd) should include(" --" )
107+ }
101108 }
102109 }
103110 }
You can’t perform that action at this time.
0 commit comments