340 Part IV — Google Earth Hacks
The outerBoundaryelement defines the outer line of the polygon. Everything inside is con-
sidered part of the solid shape. The coordinates are specified, one per line, but really you need
only separate each coordinate by a space. Remember, just as with bounding boxes in Google
Maps, you must specify at least one more point for each side of the shape because you are
drawing lines from point to point to point. In this case, four sides require five points, each of
the four corners and the first corner again to complete the polygon.
You can also generate shapes based on multiple polygons by using the MultiGeometry
option, including each Polygondefinition within the MultiGeometryelement.
Using these techniques, the simple flat image overlay demonstrated earlier could be redevel-
oped into a 3D model of the office building using the following KML:
<?xml version=”1.0” encoding=”UTF-8”?>
<kml xmlns=”http://earth.google.com/kml/2.0”>
<Document>
<Style id=”myDefaultStyles”>
<LineStyle id=”defaultLineStyle”>
<color>ff000000</color>
<width>1</width>
</LineStyle>
<PolyStyle id=”defaultPolyStyle”>
<color>77777777</color>
</PolyStyle>
</Style>
<Placemark>
<name>Sales Building</name>
<description>The new sales building, showing a readical structure to ;
provide a view for
clients.</description>
<styleUrl>#myDefaultStyles</styleUrl>
<MultiGeometry>
<Polygon id=”lowerfloors”>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing id=”lowerfloor”>
<coordinates> -97.58590936660767, 35.27654336061367, ;
50 -97.58590936660767,
35.28360260045482, 50 -97.58260488510132, ;
35.28360260045482, 50 -97.58260488510132,
35.27654336061367, 50 -97.58590936660767, ;
35.27654336061367, 50 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
<Polygon id=”middlefloors”>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>relativeToGround</altitudeMode>