geotrellis / maml

Map Algebra Modeling Language: It's what we and whales are.
https://geotrellis.github.io/maml/
Apache License 2.0
16 stars 10 forks source link

Add TargetCell Parameter to Focal operations #116

Closed echeipesh closed 4 years ago

echeipesh commented 4 years ago

GeoTrellis is able to control target cells for focal operation. ex:

https://github.com/locationtech/geotrellis/blob/69f96d4b316e6bf679a80664fb3842effa3508fd/raster/src/main/scala/geotrellis/raster/mapalgebra/focal/Min.scala#L25

https://github.com/locationtech/geotrellis/blob/69f96d4b316e6bf679a80664fb3842effa3508fd/raster/src/main/scala/geotrellis/raster/mapalgebra/focal/FocalCalculation.scala#L29-L33

This parameter needs to be available here:

https://github.com/geotrellis/maml/blob/b98b56eb08a76929c65266426986254449a881f7/jvm/src/main/scala/eval/directive/FocalDirectives.scala#L29-L36

Setting this option can prevent the result of a focal operation writing to cell that contained NODATA value in the source layer. For instance many land cover rasters will label water as NODATA regions. The default behavior of focal operations will spread the values over the NODATA regions, thus blurring the land mass. Setting the target cell to "Data" cells will preserve the NODATA regions pixel-for-pixel in the resulting raster.