Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

nodata handling on ProjectedRaster toRF #60

Open
vpipkt opened this issue Mar 7, 2018 · 1 comment
Open

nodata handling on ProjectedRaster toRF #60

vpipkt opened this issue Mar 7, 2018 · 1 comment
Assignees
Labels

Comments

@vpipkt
Copy link
Contributor

vpipkt commented Mar 7, 2018

Consider the following

$ gdalinfo core/src/test/resources/L8-B4-Elkton-VA.tiff  -mm
Driver: GTiff/GeoTIFF
Files: core/src/test/resources/L8-B4-Elkton-VA.tiff
Size is 186, 169
....
Band 1 Block=186x22 Type=UInt16, ColorInterp=Gray
    Computed Min/Max=6396.000,27835.000

Then in spark repl:

scala> val r = SinglebandGeoTiff("L8-B4-Elkton-VA.tiff").projectedRaster
r: geotrellis.raster.ProjectedRaster[geotrellis.raster.Tile] = ProjectedRaster(Raster(geotrellis.raster.UShortRawArrayTile@36343207,Extent(703986.502389, 4249551.61978, 709549.093643, 4254601.8671)),EPSG:32617)
scala> r.tile.size
res0: Int =31434
scala> r.toRF(20,20).agg(aggDataCells($"tile"), min(tileMin($"tile"))).show
+--------------------+---------------------------------+
|agg_data_cells(tile)|min(UDF(tile) AS `tileMin(tile)`)|
+--------------------+---------------------------------+
|               36000|                              0.0|
+--------------------+---------------------------------+

Problem: NoData cells implied on tiles at edge of the raster are treated as zeros not as NoData. gdalinfo and GeoTrellis info leads us to expect less datacells than are present in the tile column. The min of the tile column is 0 instead of 6396 we expect from gdalinfo.

The source GeoTiff does not have any NoData defined, but to put it into an arbitrary layout we may need to define a NoData.

This may be a hard problem to solve well, as would involve selection of a safe NoData value for the entire tile column.

@vpipkt
Copy link
Contributor Author

vpipkt commented Mar 7, 2018

And I should say may also need to change CellTypes that are NoNoData to NoData....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants