Step 1: Understanding the figure.
Let \( AB \) be the temple of height \( 15 \, \text{m} \), and \( CD \) be the building on the opposite side of the road.
Let the line of sight from \( A \) (top of temple) meet the building at point \( C \) (top of building) and \( D \) (foot of building).
Let the distance between the temple and the building (the road width) be \( x \, \text{m} \).
Step 2: From the given data.
\[
\angle CAD = 45^\circ \quad \text{and} \quad \angle CAE = 30^\circ
\]
where \( E \) is the top of the temple and \( A \) is the point of observation.
Step 3: Use right triangles.
In right triangle \( ABE \):
\[
\tan 45^\circ = \frac{BE}{AB}
\]
\[
1 = \frac{x}{15} \Rightarrow x = 15
\]
Step 4: For the angle of elevation to top of building.
Let the height of the building be \( h \, \text{m} \).
In right triangle \( ACD \):
\[
\tan 30^\circ = \frac{h - 15}{x}
\]
\[
\frac{1}{\sqrt{3}} = \frac{h - 15}{15}
\]
\[
h - 15 = \frac{15}{\sqrt{3}} = 5\sqrt{3}
\]
\[
h = 15 + 5\sqrt{3}
\]
\[
h = 5(3 + \sqrt{3}) \, \text{m}
\]
Step 5: Final Answer.
\[
\boxed{\text{Height of the building } = 5(3 + \sqrt{3}) \, \text{m}}
\]