Afterward, he devoted himself to the work of missions and sailed in 1696 for China at the head of a company of brother Jesuits from Portugal and Genoa.
In China, where he was known as Pang Jiabin, he laboured with great success on Shangchuan Island and in the city of Foshan, then a competitor of Guangzhou.
Castner also wrote Relatio Sepulturæ Magno Orientis Apostolo S. Francisco Xaviero erectæ in Insula Sanciano MDCC, a description of Shangchuan Island and his work there from 19 March to 2 June 1700 erecting a memorial on the grave of Francis Xavier.
He called the attention of the Portuguese Government to the fact that the voyage to Macau would be much shorter if the vessels followed a direct course from the Cape of Good Hope by the way of the Sunda Islands, avoiding Mozambique and Goa, and the result showed that he was right.
He did excellent work in the mapping of the Chinese Empire, and had so great a reputation as a mathematician that he was made president of the mathematical tribunal and instructor of the heir to the throne.