locationtech / rasterframes

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

Focal Operations and Buffer Tile support #551

Closed echeipesh closed 2 years ago

echeipesh commented 3 years ago

This is a draft effort to add focal operations which require use of pixel buffer per tile to provide the cell neighborhood information around tile edges. This PR moves https://github.com/locationtech/rasterframes/pull/487 closer to develop and adds Python wrappers for focal operations along with elevation related operations (slope, aspect, hillshade).

Currently this PR brings over geotrellis.raster.BufferTile implementation for convenience of iteration. I don't think its in its final form and having it here greatly simplifies the development process. This will be moved to GeoTrellis proper at the end.

Screen Shot 2021-03-30 at 12 16 00 PM

Notebook Demo

Tasks

Notes

Delegate Tiles

The main remaining challenge is to reconcile the design of BufferTile with RasterFrame reliance of the delegate tiles. This is critical because the current pattern in GeoTrellis is to rely on matching argument tile types in order to activate special handling. For instance when combining two buffer tiles operation needs to be applied to "hidden" buffer pixels. This is not possible when both or either of the inputs are wrapped in a delegate tile. Likely pixel buffer information needs to be integrated into Tile interface itself.

zFactor

For surface calculations critical input is zFactor which is contingent on the resolution and CRS. For a DataFrame of tiles the zFactor can change as the location of the tile shifts relative to the projection distortion. GeoTrellis has some functionality to support this. Some design should be lifted from GeoPySpark API. From user perspective there are three modes that can be helpful:

Connects: #441

metasim commented 3 years ago

Awesome progress!