Index: src/uk/me/parabola/splitter/RoundingUtils.java =================================================================== --- src/uk/me/parabola/splitter/RoundingUtils.java (revision 179) +++ src/uk/me/parabola/splitter/RoundingUtils.java (working copy) @@ -71,12 +71,12 @@ int minLat = Math.max(b.getMinLat(), Utils.toMapUnit(-85.0d)); int maxLat = Math.min(b.getMaxLat(), Utils.toMapUnit(85.0d)); - int roundedMinLat = roundUp(minLat, shift); + int roundedMinLat = roundDown(minLat, shift); int roundedMaxLat = roundUp(maxLat, shift); if ((roundedMinLat & alignment) != (roundedMaxLat & alignment)) { // The new height isn't a multiple of twice the alignment. Fix it by pushing // the tile edge that moved the least out by another 'alignment' units. - if (minLat - roundedMinLat < maxLat - roundedMaxLat) { + if (minLat - roundedMinLat < roundedMaxLat - maxLat) { roundedMinLat -= alignment; } else { roundedMaxLat += alignment; @@ -87,7 +87,7 @@ assert (roundedMaxLat - roundedMinLat) % doubleAlignment == 0 : "The area's height is not a multiple of " + doubleAlignment; int roundedMinLon = roundDown(b.getMinLong(), shift); - int roundedMaxLon = roundDown(b.getMaxLong(), shift); + int roundedMaxLon = roundUp(b.getMaxLong(), shift); if ((roundedMinLon & alignment) != (roundedMaxLon & alignment)) { // The new width isn't a multiple of twice the alignment. Fix it by pushing // the tile edge that moved the least out by another 'alignment' units.