locationtech / rasterframes

Geospatial Raster support for Spark DataFrames
http://rasterframes.io
Apache License 2.0
240 stars 46 forks source link

ML supervised learning generating tiff distort #543

Open tosen1990 opened 3 years ago

tosen1990 commented 3 years ago

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. image It seems the tlm meta doesn't behave correctly and I really cannot explain what causes this weird behavor.

tosen1990 commented 3 years ago

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 image For now,I still cannot figuire out what the point is.

tosen1990 commented 3 years ago

This can easily reproduce by using demo data L8_LB2-Elkton-VA with tile size 16. The result is: image