Canongate Kirk.
This church was built because its people were moved out of their old one. After the Reformation, the people of the Canongate prayed in the nave of Holyrood Abbey. Then, in 1687, King James VII ordered the abbey to become a Roman Catholic chapel for the new Order of the Thistle. The congregation had to leave, and they prayed in Lady Yester's Church until they had a new church.
The money came from an old gift. In 1649, Thomas Moodie, a treasurer of Edinburgh, had left 20,000 merks (old Scottish money) to build a new church. For years, people argued about how to use it. In 1688, the King agreed that it should pay for a church in the Canongate. The architect was James Smith, and the congregation moved in when it was finished in 1691. Look up at the front: Moodie's coat of arms is there.
The church is still busy today. Its parish includes the Palace of Holyroodhouse and the Scottish Parliament, and it is also the parish church of Edinburgh Castle. Queen Elizabeth II used to come to services here on some of her visits to Edinburgh. In 2011, her granddaughter Zara Phillips married the rugby player Mike Tindall here.