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


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="" xmlns:gx="" xmlns:kml="" xmlns:atom="">


<Style id="shop_icon">
     <hotSpot x="8" y="8" xunits="pixels" yunits="pixels"/>

   <name>Baileys Stores</name>

   <name>Cooperative Store</name>


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