iDialog.open();
String newMapName = iDialog.getValue();
if (newMapName != null && newMapName.length() > 0) {
newMapName = newMapName.replaceAll("\\s+", "_");
JGrassMapEnvironment oldMapEnvironment = new JGrassMapEnvironment(oldMapFile);
JGrassRegion jGrassRegion = oldMapEnvironment.getActiveRegion();
GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
oldMapEnvironment.getCoordinateReferenceSystem());
AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
.createFormat();
AbstractGridCoverage2DReader reader = format.getReader(oldMapEnvironment.getCELL());
GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
geodata = geodata.view(ViewType.GEOPHYSICS);
File mapsetFile = oldMapEnvironment.getMAPSET();
JGrassMapEnvironment newMapEnvironment = new JGrassMapEnvironment(mapsetFile, newMapName);
format = new GrassCoverageFormatFactory().createFormat();
GridCoverageWriter writer = format.getWriter(newMapEnvironment.getCELL(), null);
writer.write(geodata, null);
JGrassCatalogUtilities.addMapToCatalog(mapsetFile.getParent(), mapsetFile.getName(),
newMapName, JGrassConstants.GRASSBINARYRASTERMAP);