[10] Graham next was head of the Scientific Corps and principal astronomer for the joint demarcation of the boundary between the United States and Canada, under the Treaty of Washington, from 1843 until 1847.
That year, he was made a brevet lieutenant-colonel, for "Valuable and Highly Distinguished Services, particularly on the Boundary Line between the United States and the Provinces of Canada and New Brunswick".
During 1850 and 1851, he was the principal astronomer and head of the Scientific Corps for the joint demarcation of the boundary between the United States and Mexico, under the Treaty of Guadalupe Hidalgo.
Graham was next superintending engineer of the harbor improvements on the North and Northwestern Lakes, December 11, 1856, to April 20, 1864, in which he documented the existence of a lunar tide in around 1859.
He died in Boston on December 28, 1865, and is buried in Congressional Cemetery in Washington, D.C.[6][1] James Duncan Graham is commemorated in the scientific names of three species of reptiles: Anolis grahami, Regina grahamii, and Salvadora grahamiae.
[11] Anolis grahami is a lizard species native to the territory of Bermuda that is named after him, and the it is notable in its vocalization and ability to change color.