A Psalm of worship as the people approached the temple.
v1: David our example; a life of affliction, especially from those close to him, even his family, less so from enemies outside.
v2-5: In that affliction his desire remained for the glory of God, see 1 Chr 13. Part of the affliction was his deep commitment and sacrifice that God might have a dwelling place. Further, he was afflicted in being disappointed that God did not allow him to build the temple, 1 Chr 28.3.
David sought the glory of God above personal comfort and convenience, contrast Hag 1.4, and even before necessary things, compare Job 23.12. There were few who truly shared this desire. David glorified God, by sharing Gods heart, in this instance over His dwelling place.
God answered David's desire in v14, making Zion His resting place. It was this "dwelling-place" to which the people were travelling.
v6: Good news spreads; people heard about the Lord's resting place.
v7: The people began to share David's desire; we will go up to worship God, and worship Him together. We are happy to worship at His footstool (1 Chr 28.2; Ps 99.5), and this reflects the humble attitude of Ps 84.10; 131.1.
v8-10: 2 Chr 6.41-42; Solomon's prayer at the dedication of the temple. Notice that the request of v9 is answered in v16.
God answered David's and Solomon's desires; it is very wonderful that God should be mindful of man, and that He should respond to the cry of our hearts. The on going testimony to the people was that, as they approached the city, they could see that those prayers had indeed been answered.
v11-12: 1Chr 17; see 2 Sam 7.14, God's promises to David. Nothing negative here, no threats, just promises of great blessing. How sad that David's sons did turn from God.
v13-14: God had chosen Zion, the place where His Name would dwell. This is God's desire, and David shared it; Ps 45.11, 1 Sam 23.15. God's power is such that His desire must be fulfilled, but He will use those who have willing hearts.
v15-16: God's presence in Zion meant blessing upon His people. The people of Gdo necessarily enjoy the blessings of God.
v17-18: Long term vision; as Christ will reign in Zion, wearing His resplendent crown, and His enemies are defeated.