Skip to content
Permalink
Browse files

Fix bug in spark methods when clamp=false

Signed-off-by: jpolchlo <jpolchlopek@azavea.com>
  • Loading branch information
jpolchlo authored and pomadchin committed May 14, 2018
1 parent 0b6a508 commit 6f56071451621dac615b6b5acc75d05950111cd5
@@ -31,7 +31,7 @@ class RasterCropMethods[T <: CellGrid: (? => CropMethods[T])](val self: Raster[T
* [[Raster]].
*/
def crop(extent: Extent, options: Options): Raster[T] = {
val re = RasterExtent(self._2, self._1)
val re = RasterExtent(self.tile, self.extent)
val gridBounds = re.gridBoundsFor(extent, clamp = options.clamp)
val croppedExtent = re.extentFor(gridBounds, clamp = options.clamp)
val croppedTile = self._1.crop(gridBounds, options)
@@ -47,7 +47,7 @@ object Crop {
if (extent.contains(srcExtent)) {
Some((key, tile))
} else if (extent.interiorIntersects(srcExtent)) {
val newTile = tile.crop(srcExtent, extent, options)
val newTile = tile.crop(srcExtent, extent.intersection(srcExtent).get, options)
Some((key, newTile))
} else {
None

0 comments on commit 6f56071

Please sign in to comment.
You can’t perform that action at this time.