/** * @param params * the values to get the units or to_meter from. * @return a unit create from the +unit parameter or Unit.METRE if not found. * @throws CRSConfigurationException * if the given unit parameter could not be mapped to a valid deegree-crs unit. */ private Unit createUnit( Map<String, String> params ) throws CRSConfigurationException { Unit result = Unit.METRE; String tmpValue = params.remove( "units" ); if ( tmpValue != null && !"".equals( tmpValue.trim() ) ) { result = Unit.createUnitFromString( tmpValue ); if ( result == null ) { throw new CRSConfigurationException( Messages.getMessage( "CRS_CONFIG_PROJ4_UNKNOWN_UNIT", params.get( EPSG_PRE + "identifier" ), tmpValue ) ); } } else { tmpValue = params.remove( "to_meter" ); if ( tmpValue != null && !"".equals( tmpValue.trim() ) ) { result = new Unit( "Unknown", "unknown", Double.parseDouble( tmpValue ), Unit.METRE ); } } return result; }