#!/usr/bin/perl
print "Content-Type: application/vnd.google-earth.kml+xml\n\n";

print '<?xml version="1.0"?>
<kml xmlns="http://earth.google.com/kml/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://earth.google.com/kml/2.1 KMLSchema.xsd">
	 <Style id="examplePolyStyle">    
   	<LineStyle>
   		<color>ffff0000</color>
   	</LineStyle>
   	<PolyStyle>      
   		<color>ffff0000</color>     
   		<colorMode>random</colorMode>
   		<fill>1</fill>                    
  			<outline>1</outline>                		   
   	</PolyStyle>  
   </Style>
	<Placemark>
      <name>Hayden\'s House</name>
      <visibility>1</visibility>
      <description>Where I currently live</description>
      <LookAt>
          <longitude>170.507814</longitude>
          <latitude>-45.853825</latitude>
          <altitude>0</altitude>
          <range>1000</range>
          <tilt>45</tilt>
          <heading>0</heading>
      </LookAt>
      <styleUrl>#examplePolyStyle</styleUrl>
       <Polygon>
            <extrude>1</extrude>
            <altitudeMode>relativeToGround</altitudeMode>
            <outerBoundaryIs>
              <LinearRing>
                <coordinates> 
                	170.507814,-45.853825,100
                 	170.507900,-45.853825,100
                 	170.507900,-45.853900,100
               	170.507814,-45.853900,100
               	170.507814,-45.853825,100
                 </coordinates>
              </LinearRing>
            </outerBoundaryIs>
      </Polygon>
	</Placemark>      
</kml>';