Let the height of the temple be \( h_1 = 15 \, \text{m} \), and the height of the building be \( h_2 \). Let the distance between the temple and the building be \( d \).
We have two right-angled triangles formed by the temple, the building, and the road. Let's work with these triangles.
Triangle 1: Angle of elevation
In the first triangle, the angle of elevation from the top of the temple to the top of the building is \( 30^\circ \). Using the tangent function, we can write:
\[
\tan(30^\circ) = \frac{h_2 - h_1}{d} = \frac{h_2 - 15}{d}.
\]
Since \( \tan(30^\circ) = \frac{1}{\sqrt{3}} \), we have:
\[
\frac{1}{\sqrt{3}} = \frac{h_2 - 15}{d} \quad \Rightarrow \quad d = \sqrt{3}(h_2 - 15).
\]
Triangle 2: Angle of depression
In the second triangle, the angle of depression to the foot of the building is \( 45^\circ \). Using the tangent function again, we can write:
\[
\tan(45^\circ) = \frac{h_1}{d} = \frac{15}{d}.
\]
Since \( \tan(45^\circ) = 1 \), we have:
\[
1 = \frac{15}{d} \quad \Rightarrow \quad d = 15.
\]
Solving for \( h_2 \)
Substitute \( d = 15 \) into the equation \( d = \sqrt{3}(h_2 - 15) \):
\[
15 = \sqrt{3}(h_2 - 15).
\]
Now, solve for \( h_2 \):
\[
h_2 - 15 = \frac{15}{\sqrt{3}} = 5\sqrt{3},
\]
\[
h_2 = 15 + 5\sqrt{3}.
\]
Thus, the height of the building is:
\[
h_2 = 5(3 + \sqrt{3}) \, \text{metres}.
\]
Conclusion:
The height of the building is \( 5(3 + \sqrt{3}) \, \text{metres}. \)