330 Part IV — Google Earth Hacks
Setting a View
When dealing with photographs, the direction in which the camera was pointing when the
photograph was taken is a significant part of what makes the photo special. For example, a
photo of the Bay of Naples, where Pompeii is located, can show a number of different ele-
ments. If the photo was taken from Naples facing the southeast, you’d be taking a photo of
some mountains. To a visitor to the area, they are quite obviously the mountains to the east of
Sorrento, but they could easily be confused for a picture of Vesuvius. By adding a heading and
direction to a placemark, the direction of the camera lens is obvious.
To achieve this, a LookAtelement must be included with each tag. When the user double-
clicks a tag, the information in the LookAttag is used to determine the camera (or eye) view
point within Google Earth. There are six elements to the LookAtfragment:
Longitude:The longitude of the point.
Latitude:The latitude of the point.
Altitude of the point:(Optional.) The altitude of the point.
Range:The altitude of the camera or eye.
Tilt:The angle of the camera.
Heading:The compass heading of the camera.
Thus a view point equal to a bird’s-eye view of the main square in Pompeii can be created using
the following code:
<LookAt>
<longitude>14.4850001287074</longitude>
<latitude>40.74889804414286</latitude>
<altitude>0</altitude>
<range>254.0000000037327</range>
<tilt>67.63540763119519</tilt>
<heading>-17.02539065750064</heading>
</LookAt>
The LookAtelement is placed immediately within the Placemarkelement:
<Placemark>
<name>Council Building</name>
<open>1</open>
<LookAt>
...
</LookAt>
</Placemark>
When the placemark is double-clicked, the camera moves to this location. When it is single
clicked, nothing happens.