KML

From Testiwiki
Jump to: navigation, search

KML (Keyhole Markup Language) is an XML-based markup language which is used to display geographic data[1]. Coordinates in KML are used in 3D form (longitude, latitude and altitude). Data is divided into nested elements and attributes. KML was originally developed by Keyhole Inc but Google acquired it in 2004. [2]. Most commonly KML is used in Google Earth. KML is also approved as Open Geospatial Consortium standard[3].

This an example of KML syntax which shows a view of city of Kuopio in Finland:

<?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">
<Placemark>
	<name>Kuopio, Suomi</name>
	<open>1</open>
	<address>Kuopio, Suomi</address>
	<LookAt>
		<longitude>27.679328</longitude>
		<latitude>62.893334</latitude>
		<altitude>0</altitude>
		<range>42529.324219</range>
		<tilt>0</tilt>
		<heading>0</heading>
	</LookAt>
	<styleUrl>http://maps.google.com:80/maps?q=Kuopio&sll=63.9916,25.9735&sspn=98.3031,360&
output=kml&ie=utf-8&v=2.2&cv=5.0.11733.9347&hl=fi#default+
nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
	<Point>
		<coordinates>27.679328,62.893334,0</coordinates>
	</Point>
</Placemark>
</kml>

As seen from the example KML can contain much more information than just longitude and latitude. Coordinates inside <Point> -tags defines position of Placemark's name and icon. In addition to that coordinates inside <LookAt> -tags tells to user's browser where to position the camera view. In general understanding KML is not very difficult if one has basic understanding of XML.

References