kml files are text files that define overlays of various types (lines, borders, images, symbols) that can be displayed over a map on a webpage.

To use a kml file, the file must be saved in the images folder of the website, and then called up by means of a

kml='kml_filename'

parameter, where kml_filename represents the path and filename of the kml file. It is possible to overlay more than one kml file on a single map, in which case the parameters have the form kml[0]='filename0', kml[1]='filename1', etc.

Google provide documentation on the format of kml files. The following is a sample KML file, with comments:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">

<Document>
<name>Shops</name>

<Style id="shop_icon">
   <IconStyle>
     <Icon>
       <href>/images/Maps/Map_icons/shop_icon.png</href>
     </Icon>
     <hotSpot x="8" y="8" xunits="pixels" yunits="pixels"/>
   </IconStyle>
</Style>

<Placemark>
   <name>Baileys Stores</name>
   <styleUrl>#shop_icon</styleUrl>
   <Point>
     <coordinates>-2.4234708,50.6461904,0</coordinates>
   </Point>
</Placemark>

<Placemark>
   <name>Cooperative Store</name>
   <styleUrl>#shop_icon</styleUrl>
   <Point>
     <coordinates>-2.4203695,50.6463986,0</coordinates>
   </Point>
</Placemark>

</Document>

</kml>
Defines file as KML





Document, named "Shops"


Creates icon for marking shops


Actual icon image is a .PNG file





Placemark for first shop
Draws shop icon at specified geographical location






Placemark for second shop







End of document

End of file