rasterframes
rasterframes copied to clipboard
ML supervised learning generating tiff distort
When using(fully filled with data value) tiff
toMultibandRaster
throws null pointer exception,which I still yet cannot understand why there are some null tile in the RasterFrameLayer.
Input geojson
Output classified result
My rough code
So I think out changing the rf by
val rr: RDD[(SpatialKey, MultibandTile)] = rf.select(rf.spatialKeyColumn, array($"bd_6")).as[(SpatialKey, Array[Tile])]
.rdd
.filter {
case (_: SpatialKey, b) if b(0) == null ⇒ false // remove any null Tiles
case _ ⇒ true
}
.map { case (sk, tiles) ⇒
(sk, MultibandTile(tiles))
}
And the classified result is distorted, the whole raster is squeezed in upper left direction compared with original one.
It seems the tlm meta doesn't behave correctly and I really cannot explain what causes this weird behavor.
And I even create a new tlm to generate the tiff,it's better than the one above with only tiles in the right-most and bottom cannot output normally. Code is here
For now,I still cannot figuire out what the point is.
This can easily reproduce by using demo data L8_LB2-Elkton-VA with tile size 16.
The result is: