public RegionMap toSubRegion( double n, double s, double w, double e ) {
        double originalXres = getXres();
        double originalYres = getYres();
        double originalWest = getWest();
        double originalSouth = getSouth();

        double envWest = w;
        double deltaX = (envWest - originalWest) % originalXres;
        double newWest = envWest - deltaX;

        double envSouth = s;
        double deltaY = (envSouth - originalSouth) % originalYres;
        double newSouth = envSouth - deltaY;

        double newWidth = e - w;
        double deltaW = newWidth % originalXres;
        newWidth = newWidth - deltaW + originalXres;

        double newHeight = n - s;
        double deltaH = newHeight % originalYres;
        newHeight = newHeight - deltaH + originalYres;

        double newNorth = newSouth + newHeight;
        double newEast = newWest + newWidth;

        int rows = (int) ((newHeight) / originalYres);
        int cols = (int) ((newWidth) / originalXres);

        double newXres = (newWidth) / cols;
        double newYres = (newHeight) / rows;

        RegionMap regionMap = CoverageUtilities.makeRegionParamsMap(newNorth, newSouth, newWest, newEast, newXres, newYres, cols,
                rows);
        return regionMap;
    }
public RegionMap toSubRegion ( double n , double s , double w , double e ) { double originalXres = getXres ( ) ; double originalYres = getYres ( ) ; double originalWest = getWest ( ) ; double originalSouth = getSouth ( ) ; double envWest = w ; double deltaX = ( envWest - originalWest ) % originalXres ; double newWest = envWest - deltaX ; double envSouth = s ; double deltaY = ( envSouth - originalSouth ) % originalYres ; double newSouth = envSouth - deltaY ; double newWidth = e - w ; double deltaW = newWidth % originalXres ; newWidth = newWidth - deltaW + originalXres ; double newHeight = n - s ; double deltaH = newHeight % originalYres ; newHeight = newHeight - deltaH + originalYres ; double newNorth = newSouth + newHeight ; double newEast = newWest + newWidth ; int rows = ( int ) ( ( newHeight ) / originalYres ) ; int cols = ( int ) ( ( newWidth ) / originalXres ) ; double newXres = ( newWidth ) / cols ; double newYres = ( newHeight ) / rows ; RegionMap regionMap = CoverageUtilities . makeRegionParamsMap ( newNorth , newSouth , newWest , newEast , newXres , newYres , cols , rows ) ; return regionMap ; }
Creates a new {@link RegionMap} cropped on the new bounds and snapped on the original grid.

<p><b>The supplied bounds are contained in the resulting region.</b></p>

@param n the new north.
@param s the new south.
@param w the new west.
@param e the new east.
@return the new {@link RegionMap}.