try {
if (!tempCode.startsWith("EPSG") && !tempCode.startsWith("epsg")) {
projCode.insert(0, "EPSG:");
}
// it is an EPSG crs let's create it.
final ProjectedCRS pcrs = (ProjectedCRS) CRS.decode(projCode
.toString(), true);
// //
//
// We have nothing to do with the unit of measure
//
// //
if (linearUnit == null
|| linearUnit.equals(pcrs.getCoordinateSystem().getAxis(0)
.getUnit()))
return pcrs;
// //
//
// Creating anew projected CRS
//
// //
return new DefaultProjectedCRS(
java.util.Collections.singletonMap("name",
DefaultEllipsoidalCS.getName(pcrs,
new CitationImpl("EPSG"))), pcrs.getConversionFromBase()
.getMethod(), (GeographicCRS) pcrs.getBaseCRS(), pcrs
.getConversionFromBase().getMathTransform(),
createProjectedCS(linearUnit));
} catch (FactoryException fe) {
final IOException ex = new GeoTiffException(metadata, fe
.getLocalizedMessage(), fe);