def writeToFile():
    ''' write the string 'muahaha' to a file located at
        Z:/Windata/Desktop/pin.kml '''
    # input: nothing
    # output: nothing
    string = 'muahaha'
    pinFile = open('Z:/Windata/Desktop/pin.kml', 'w')   
    pinFile.write(string)
    pinFile.close()
    return

def writeToFile2():
    ''' write the string contained in start.kml to a file located at
        Z:/Windata/Desktop/pin.kml '''
    # input: nothing
    # output: nothing
    string = '''<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>

  <Placemark>
    <name>Name goes here</name>
    <description>Description goes here</description>
   <Style>
      <IconStyle>
	 <scale>1.0</scale>
	 <Icon>
		<href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href>
	 </Icon>
	 <color>ff00ff00</color>
       </IconStyle>
    </Style>
    <Point>
      <coordinates>-87,41,0</coordinates>
    </Point>
  </Placemark>

  <Placemark>
    <name>Name goes here</name>
    <description>Description goes here</description>
   <Style>
      <IconStyle>
	 <scale>1.0</scale>
	 <Icon>
		<href>http://aux.iconpedia.net/uploads/1489452986.png</href>
	 </Icon>
	 <color>ffff0000</color>
       </IconStyle>
    </Style>
    <Point>
      <coordinates>-88,40,0</coordinates>
    </Point>
  </Placemark>

</Document>
</kml>

'''
    pinFile = open('Z:/Windata/Desktop/pin.kml', 'w')   
    pinFile.write(string)
    pinFile.close()
    return



def writeCoordinatesToFile(longitude, latitude):
    ''' Write to pin.kml which puts a pushpin at location
        (longitude, latitude, 0) on the earth. '''
    # input: two numbers
    # output: nothing

    part1 = '''<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>

  <Placemark>
    <name>Name goes here</name>
    <description>Description goes here</description>
   <Style>
      <IconStyle>
	 <scale>1.0</scale>
	 <Icon>
		<href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href>
	 </Icon>
	 <color>ff00ff00</color>
       </IconStyle>
    </Style>
    <Point>
      <coordinates>'''

    part2 = ''',0</coordinates>
    </Point>
  </Placemark>

</Document>
</kml>

'''

    changingPart = str(longitude) + ',' + str(latitude) 
    string = part1 + changingPart + part2
    
    
    pinFile = open('Z:/Windata/Desktop/pin.kml', 'w')   
    pinFile.write(string)
    pinFile.close()
    return
    

def writeCoordsColorToFile(longitude, latitude, color):
    ''' Create pin.kml that puts a single pushpin at
        (longitude, latitude, 0) with color specified by
        color '''
    # input: number, number, string (e.g. (28, 49, 'ff00ffff'))
    # output: nothing

    # build string here
    
    part1 = '''<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>

  <Placemark>
    <name>Name goes here</name>
    <description>Description goes here</description>
   <Style>
      <IconStyle>
	 <scale>1.0</scale>
	 <Icon>
		<href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href>
	 </Icon>
	 <color>'''
    part2 = '''</color>
       </IconStyle>
    </Style>
    <Point>
      <coordinates>'''

    part3 = ''',0</coordinates>
    </Point>
  </Placemark>

</Document>
</kml>

'''

    colorPart = color
    coordsPart = str(longitude) + ',' + str(latitude)
    string = part1 + colorPart + part2 + coordsPart + part3
    
    pinFile = open('Z:/Windata/Desktop/pin.kml', 'w')   
    pinFile.write(string)
    pinFile.close()
    return
    
    






    



