Skip to content

Commit

Permalink
Merge pull request #2031 from snoe925/master
Browse files Browse the repository at this point in the history
Tile columns cannot be zero when rounding
  • Loading branch information
lossyrob authored Feb 28, 2017
2 parents b8605e6 + 7201045 commit 3517ac2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions raster/src/main/scala/geotrellis/raster/GridExtent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class GridExtent(val extent: Extent, val cellwidth: Double, val cellheight: Doub
* types.
*/
def toRasterExtent(): RasterExtent = {
val targetCols = math.round(extent.width / cellwidth).toLong
val targetRows = math.round(extent.height / cellheight).toLong
val targetCols = math.max(1L, math.round(extent.width / cellwidth).toLong)
val targetRows = math.max(1L, math.round(extent.height / cellheight).toLong)
if(targetCols > Int.MaxValue) {
throw new GeoAttrsError(s"Cannot convert GridExtent into a RasterExtent: number of columns exceeds maximum integer value ($targetCols > ${Int.MaxValue})")
}
Expand Down

0 comments on commit 3517ac2

Please sign in to comment.