if (projCode == null|| projCode.equals(GeoTiffConstants.GTUserDefinedGeoKey_String)){
projUserDefined = true;
}
// is it user defined?
final Conversion conversionFromBase;
String projectionName=null;
final ParameterValueGroup parameters;
final MathTransform transform;
if (projUserDefined) {
// A user defined projection is made up by
// <ol>
// <li>PCSCitationGeoKey (NAME)
// <li>ProjCoordTransGeoKey
// <li>ProjLinearUnitsGeoKey
// </ol>
// NAME of this projection coordinate transformation
// getting user defined parameters
projectionName = metadata.getGeoKey(GeoTiffPCSCodes.PCSCitationGeoKey);
if (projectionName == null){
projectionName = "unnamed";
}
// //
//
// getting default parameters for this projection and filling them
// with the values found
// inside the geokeys list.
//
// //
parameters = createUserDefinedProjectionParameter(projectionName,metadata);
if (parameters == null){
throw new GeoTiffException(
metadata,
"GeoTiffMetadata2CRSAdapter::createUserDefinedPCS:Projection is not supported.",
null);
}
// set the remaining parameters.
refineParameters(baseCRS, parameters);
// create math transform
transform = mtFactory.createParameterizedTransform(parameters);
// create the conversion from base, aka the projection transform
conversionFromBase= new DefiningConversion(
Collections.singletonMap("name", cleanName(projectionName)),
new DefaultOperationMethod(transform),
transform);
} else {
// create the conversion from EPSG code
conversionFromBase = (Conversion) this.allAuthoritiesFactory.createCoordinateOperation(new StringBuilder("EPSG:").append(projCode).toString());
// prepare the parameters
parameters=conversionFromBase.getParameterValues();
refineParameters(baseCRS, parameters);
// create math transform
transform = mtFactory.createParameterizedTransform(parameters);