/** * Return the raster coordinate denoted by the given world coordinate. This method is CENTER and OUTER aware. * * @param worldX * x position in the world coordinate system, for which raster coordinates should be calculated. * @param worldY * y position in the world coordinate system, for which raster coordinates should be calculated. * @return the (rounded) raster coordinate which the given world coordinate maps to. */ public int[] getRasterCoordinate( double worldX, double worldY ) { Point2D rslt = invTransform.transform( new Point2D.Double( worldX, worldY ), null ); if ( location == CENTER ) { return new int[] { (int) round( rslt.getX() ), (int) round( rslt.getY() ) }; } return new int[] { (int) floor( rslt.getX() ), (int) floor( rslt.getY() ) }; }