In geologically active areas where hot magma approaches the surface,the heat from the underlying rock can be used to heat water. The heated water can then be used directly either to heat buildings or to generate electricity by way of a steam turbine.