BRASILIA, Feb 2 (Reuters) - Brazil has shelved a planned railway to ship commodities destined for China through Peru as it was too costly and faced “absurd” engineering challenges, a Brazilian official said.

The 5,000-km (3,300-mile) railway over the Andes to the Pacific coast, announced during a visit by President Xi Jinping in 2014, was meant to speed up soybean and iron ore exports to China at a lower cost by bypassing the Panama Canal.

But at an estimated cost of $80 billion, the railway would not be commercially viable if it transported just commodities and not more valuable goods, Jorge Arbache, vice planning minister for international affairs, told Reuters in an interview late on Thursday.

Peru also opposed the planned route that cut through one of the country’s most important nature reserves, he said.

“The project has stopped, because it was extremely costly and the feasibility study was very unsatisfactory. At this time, the railway is not on the government’s agenda,” Arbache said. “The engineering challenges were absurd.”

The Peruvian government has said the railway could be feasible if it took a more direct route through Bolivia that would reduce costs and have less of an environmental impact, in addition to giving Peru’s landlocked neighbor better access to Pacific export markets.

Arbache said talks on an alternative route were only at an “embryonic” stage.

China is Brazil’s biggest trading partner and invested $20.9 billion in the South American country in 2017, the most since 2010, as a recession eroded asset prices and attracted investors, according to the planning ministry.

The bulk of that investment has gone into energy, logistics and agriculture.

Arbache said Brazil expects China to take a longer-term view and diversify its investments towards Brazilian manufacturing and services, including the health and education sectors. (Reporting by Anthony Boadle and Leonardo Goy; Editing by Bernadette Baum)